I have a BLE system where multiple sensors operate as peripherals and send data to a BLE central. These sensors enter sleep mode after transmitting data and later wake up to send new information.
I have observed an issue when increasing the number of sensors connected to the same central. Specifically, when two sensors become available for connection simultaneously, communication starts to fail. This affects the system's stability and impacts the reliability of data transmission.
Currently, I establish connections using the UUID of the NUS service, while other BLE parameters, such as the device name, remain identical among the sensors.
Communication Flow:
-
The central identifies a peripheral through advertising.
-
The central establishes a connection with the peripheral.
-
The central stops the scanning process.
-
The peripheral and central exchange information.
-
The central disconnects from the peripheral.
-
The central restarts scanning while two peripherals are advertising simultaneously.
Observed Behavior:
-
If only one sensor is available for connection, the process works correctly.
-
If two sensors are available simultaneously, communication fails, and the central cannot manage connections properly.
-
When this issue occurs, communication starts timing out, there are unexpected disconnections, and intermittent failures appear, such as the following:
00> [01:58:53.731,842] <inf> BLE: scan_filter_match: Filters matched. Address: DE:62:6A:79:C5:A5 (random) connectable: 1
00> [01:58:54.357,177] <inf> BLE: connected: Connected: DE:62:6A:79:C5:A5 (random)
00> [01:58:54.461,456] <inf> BLE: exchange_func: MTU exchange done
00> [01:58:58.293,762] <inf> MAIN: ble_connected_state: Connection state timeout
00> [01:58:58.293,792] <inf> PROTO: log_protocol_infos: Num: 0 - Extra: 0 - Off: 0
00> [01:58:58.293,792] <inf> PROTO: log_protocol_infos: data: 00 00 00 00
00> [01:58:58.293,823] <inf> MAIN: set_state: [STATE_BLE_CONNECTED] -> [STATE_BLE_DISCONNECTION]
00> [01:58:58.393,920] <inf> MAIN: ble_disconnection_state: BLE Disconnection State
00> [01:58:58.393,951] <inf> MAIN: set_state: [STATE_BLE_DISCONNECTION] -> [STATE_BLE_DISCOVERY]
00> [01:58:58.494,049] <inf> MAIN: ble_discovery_state: BLE Discovery State
00> [01:58:58.610,198] <err> nus_c: bt_nus_handles_assign: Missing NUS TX characteristic.
00> [01:58:58.610,198] <err> nus_c: bt_nus_subscribe_receive: Subscribe failed (err -128)
00> [01:58:58.610,351] <inf> BLE: disconnected: Disconnected: DE:62:6A:79:C5:A5 (random) (reason 8)
00> [01:58:58.611,053] <inf> MAIN: ble_discovery_state: BLE Connected
00> [01:58:58.626,312] <inf> MAIN: set_state: [STATE_BLE_DISCOVERY] -> [STATE_BLE_CONNECTED]
00> [01:58:58.726,379] <inf> MAIN: ble_connected_state: START FLAG sent
00> [01:58:58.726,409] <err> BLE: bluetooth_central_send_data: Cannot send data, no BLE connection
Questions:
-
Are there any known limitations in managing multiple sequential connections with peripherals that have similar parameters?
-
Are there any recommendations to handle this scenario better? Any specific configurations in Zephyr or SoftDevice that could help?
-
Any best practices to differentiate peripherals and avoid connection conflicts?
I appreciate any guidance that can help resolve this issue.
Best regards,