Comments (7)
I tested this with FreeRTOS master branch (latest code) and amazon-freertos-ble-ios-sdk version 1.1.0 on IOS version 13.3.1, but couldn't reproduce the issue.
Could you provide the following information ?
- FreeRTOS version or commit ID
- amazon-freertos-ble-ios-sdk version
- Version of IOS running on your device.
Also, if possible, could you send the app side logs ( by clicking on the Debug button at the top right corner ) and the device side logs ?
from amazon-freertos-ble-ios-sdk.
@ravibhagavandas I am seeing this same issue.
I have to say I am not clear what version of Amazon FreeRTOS is running on the embedded side. It's an ESP32 AmazonFreeRTOS demo that I got running. It is using BLE PIN pairing.
On the iOS side I have iOS 13.2.2, and I'm using the latest SDK version, which currently is v1.1.0.
If I attempt to list networks as soon as I connect, AmazonFreeRTOSManager.listNetworks()
fails in the check for the NetworkConfig service/RXNetworkMessage characteristic. I tried putting a delay in my code, after connecting but before calling listNetworks()
, and then the failure occurs when listNetworks()
calls writeValueToRXMessage()
, in the check for whether the mtu
is nil: "Mtu unknown".
This is the app output in the former case, where I call listNetworks() immediately after connection:
2020-04-07 07:54:49.505663-0400 uvc[6793:1761847] [AFR][Central] afrCentralManagerDidDiscoverPeripheral: ED9863C5-7496-A775-A816-09F00100017E
UvcProvisioningManager.swift connect(device:) line: 119: Connecting
UvcProvisioningManager.swift subscribeToAfrListener() line: 58: .connected to XARTMAN-ESP32
2020-04-07 07:54:54.728336-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] afrCentralManagerDidConnectPeripheral
UvcProvisioningManager.swift getNetworks(device:) line: 132: Getting networks
2020-04-07 07:54:54.733464-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E][NETWORK] ↓ ListNetworkReq(maxNetworks: 15, timeout: 30)
2020-04-07 07:54:54.744093-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E][NETWORK][ERROR] NetworkConfig service or RXNetworkMessage characteristic doesn't exist
2020-04-07 07:54:55.145013-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrVersion
2020-04-07 07:54:55.146024-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get brokerEndpoint
2020-04-07 07:54:55.146549-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get mtu
2020-04-07 07:54:55.147064-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrPlatform
2020-04-07 07:54:55.147544-0400 uvc[6793:1761847] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrDevId
This is the app output in the latter case, where I delay prior to listNetworks()
:
2020-04-07 07:42:59.106847-0400 uvc[6781:1758957] [AFR][Central] afrCentralManagerDidDiscoverPeripheral: ED9863C5-7496-A775-A816-09F00100017E
UvcProvisioningManager.swift connect(device:) line: 119: Connecting
UvcProvisioningManager.swift subscribeToAfrListener() line: 58: .connected to XARTMAN-ESP32
2020-04-07 07:43:04.349937-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] afrCentralManagerDidConnectPeripheral
2020-04-07 07:43:04.769881-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrVersion
2020-04-07 07:43:04.770874-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get brokerEndpoint
2020-04-07 07:43:04.771379-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get mtu
2020-04-07 07:43:04.771885-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrPlatform
2020-04-07 07:43:04.772391-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E] ↓ get afrDevId
UvcProvisioningManager.swift getNetworks(device:) line: 132: Getting networks
2020-04-07 07:43:08.665462-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E][NETWORK] ↓ ListNetworkReq(maxNetworks: 15, timeout: 30)
2020-04-07 07:43:08.677471-0400 uvc[6781:1758957] [AFR][ED9863C5-7496-A775-A816-09F00100017E][ERROR] Mtu unknown
from amazon-freertos-ble-ios-sdk.
@roberthartman
The issue is because ESP32 stores a limited number of bonds using a temporary identifier from the phone. This identifier is rotated every X minutes, and when all the slots are occupied you'll not be able to do a correct pairing with the phone and the issue will appear.
You can do few things to solve this:
- use the esp tool to erase the flash on the ESP32 and then reflash the firmware. This is needed as simply reflashing the firmware does not erase the bonding data.
- change the configuration to not use secure parameters, so that you'll not be required to pair the ESP32 with the phone. You can do this by changing the code in https://github.com/aws/amazon-freertos/blob/master/libraries/c_sdk/standard/ble/include/iot_ble_config_defaults.h#L172 as follow:
#ifndef IOT_BLE_ENABLE_BONDING
#define IOT_BLE_ENABLE_BONDING ( 0)
#endif
/**
* @brief The flag to enable secure connection for the device.
*
* By default secure connection will be enable on all device.
*/
#ifndef IOT_BLE_ENABLE_SECURE_CONNECTION
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 0 )
#endif
/* Config if set, requires encryption to access services and characteristics */
/**
* @brief Configuration to force encryption to access all characteristics of services.
*/
#ifndef IOT_BLE_ENCRYPTION_REQUIRED
#define IOT_BLE_ENCRYPTION_REQUIRED ( 0 )
#endif
from amazon-freertos-ble-ios-sdk.
@massi-ang thanks. I had previously tried to get Just Works pairing working on the ESP32, but without luck. If you happen to know the settings required for that, that would be really helpful, because the eventual production HW will be using Just Works.
I will also try what you suggest with turning off pairing/bonding altogether.
I have used the ESP IDF tools to erase_flash
on the board, but I don't recall reconnecting working for a little while afterwards, though maybe I wasn't paying attention. I'll post here once I circle back to this.
from amazon-freertos-ble-ios-sdk.
@massi-ang Thank you for updates on the issue.
While as you suggested, setting
#define IOT_BLE_ENABLE_BONDING ( 0)
will turn off the bonding, whereas setting #define IOT_BLE_ENCRYPTION_REQUIRED ( 0 )
will lead to an open unencrypted connection.
The right set of overrides to enable just works pairing is
#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 0 )
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 0 )
#define IOT_BLE_INPUT_OUTPUT ( eBTIONone )
You can see more details about different modes here.
Also, I recommend you to override these configurations in the demo specific configuration file iot_ble_config.h
from amazon-freertos-ble-ios-sdk.
My understanding is that in order to have an encrypted connection, you need to enable bonding which will cause the issue with the ESP32.
As for the Just Works setup, thanks for providing the correct solution.
from amazon-freertos-ble-ios-sdk.
I'm closing this issue as there hasn't been activity in the past two years. Feel free to reopen if an issue persists.
from amazon-freertos-ble-ios-sdk.
Related Issues (19)
- Wi-Fi provisioning fails on ESP32 board with "Failed to allocate taskpool" error HOT 3
- Return error when incorrect password is provided HOT 8
- CBOR encoding crashes when saving a network SSID with UTF characters HOT 5
- Get afrVersion spelled gatAfrVersionOfPeripheral HOT 2
- Trying to compile demo throws errors on unknown symbols for arm64 HOT 1
- XCode 13 / Swift 5.5 Support, Cut new release? HOT 2
- Replace JSON with CBOR for efficiency HOT 1
- Bluetooth is not getting connected in one go HOT 2
- AFR LTS Release HOT 16
- Published (demo) app in appstore HOT 1
- Undefined symbols for architecture arm64 HOT 10
- PIN-Based Bluetooth Connection without Default Popup HOT 4
- Make Large Object Transfer as its own service and expose in SDK HOT 1
- Terminating app due to uncaught exception 'NSInvalidArgumentException' HOT 9
- https://github.com/aws/amazon-freertos-ble-ios-sdk.git: No such file or directory HOT 4
- Add auto reconnect on disconnect HOT 1
- pod is throwing the error: The SWIFT_VERSION is missing for "AWSMobileClient" & "CBORSWift". HOT 5
- Can't get WiFi provisioning demo to work with ESP32 board and Release 1.5 branch of amazon-freertos HOT 24
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-freertos-ble-ios-sdk.