After DM discovery, subscribe works on only one CCC Handle

Using the DM, in the discovery_complete callback, after finding two CCC handles from 2 custom UUID's, I can subscribe to only one of the two, the other fails with EALREADY. 

I've tried delaying the second subscription for several seconds after discovery completes and it still fails.

Even if I save both discovery contexts (bt_conn connection and bt_gatt_dm_attr pointers), and don't subscribe until multiple seconds later, I can only subscribe to a single one.
It doesn't matter which CCC handle I do first, either will subscribe fine, but the second always fails!

I have only a single peripheral sensor connected.  Eventually there will be several....
From nRF Connect App, I can subscribe to both and get the notifications.

Also, the first handle will begin its notifications prior to the second attempt, but those notifications stop when the second subscription fails.

(nRF52840 and nRF Connect SDK v2.0.0)

Parents
  • Hi Caycee, sorry for the delay.
    Are you by any chance using the same bt_gatt_subscribe_params struct for both the calls to bt_gatt_subscribe()? The subscribe params are added to an internal list to keep track of subscriptions. If the application tries to subscribe with the same struct again, this error will be returned. Adding the same linked list node to the list twice would cause an infinite loop when iterating over the list.
Reply
  • Hi Caycee, sorry for the delay.
    Are you by any chance using the same bt_gatt_subscribe_params struct for both the calls to bt_gatt_subscribe()? The subscribe params are added to an internal list to keep track of subscriptions. If the application tries to subscribe with the same struct again, this error will be returned. Adding the same linked list node to the list twice would cause an infinite loop when iterating over the list.
Children
Related