Indication loss when multiple peripheral devices are connected

Hi,

First of all, let me confess I am new to NRF and BLE environment.

I am working on a project where the mobile device and NRF 52840 acts as a BLE peripheral and one NRF 52840 device acts as a central which monitors the distance of all the connected peripheral devices

Now, when the NRF52840 peripherals are connected to the central device we see no issue with the indication and any device on the network can communicate to the central and central also can communicate with all the peripherals on the network.

The problem occurs when we connect the mobile to our network. Let me explain my observation below

Case 1: NRF 52840 peripheral is connected to the NRF52840 central first, and mobile device is connected later

Both can communication with each other, central can write to the peripheral characteristic and peripheral indicates to the central.

Now, a mobile device is connected with the central, central can communicate with the mobile and mobile can also indicate to the central, whereas the other NRF 52840 peripheral cannot indicate to the central.

The central device is not receiving any indication from the NRF 52840 peripheral, whereas the central can send data to the peripheral using GATT WRITE and both peripherals can receive the data.

Case 2: Mobile is connected to the central first and later the NRF 52840 peripheral is connected to the central

Now, again the central and mobile device can communicate each other without any issue and when the NRF 52840 peripheral is connected to the central, any indication sent from the mobile device is not received to the central.

Whereas the central can send data to the peripheral using GATT WRITE and both peripherals can receive the data.

GATT WRITE is working at any time no matter which device is connected at last, the only issue is with the indication, the central receive the indication only from the latest device which is connected to the central.

Please help me to debug the issue. Let me share my project.

I am using VS Code with NRF extensions. NRF Toolchain version is 2.7.0

issue-build.zip

Parents
  • There seems to be a likely issue related to the management of CCCD (Client Characteristic Configuration Descriptor) settings or the BLE stack's event handling in your application.

    Looked at your code briefly, I think there is a flaw in your connection management as CCCD management is not done per connection.

    • Initial connection, First device connects and enables indications through a CCCD write.
    • The second device connects. If the application overwrites the CCCD or doesn't enable it for the first device, the first device is unsubscribed.
    • As a result, bt_gatt_indicate(NULL, &ind_params) now sends indications only to the second device.
    • The central receives indications only from the most recently connected device because it is the only one with an enabled CCCD.
    • CCCD writes are not handled per connection.
    • The application may be overwriting CCCD settings globally or failing to re-enable them for all active connections.
    • Using NULL as the connection handle for bt_gatt_indicate() sends indications to all subscribed devices. If only the most recent device has its CCCD enabled, only it will receive indications.
  • Hi Susheel,

    Thank you for the response, will review the subscription handle as you said and update.

    Is there any example reference I can refer to which support multi device subscription and handling, if so, can you please share the link or document which can help me for even better understanding.

Reply Children
Related