Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE DB Discovery module discovering same characteristics multiple times

Hi everbody,

I'm using the BLE Database Discovery module to discover services and characteristics of a BLE peripheral. This works fine, except for one strange quirk:

When I perform the discovery multiple times, the same characteristics are reported multiple times. To be precise, when I get a ble_db_discovery_evt_t with type == BLE_DB_DISCOVERY_COMPLETE for my service's UUID, the ble_db_discovery_evt_t.discovered_db.char_count keeps increasing for every discovery. The peripheral's service has 7 characteristics, so the first discovery will report char_count = 7, the next discovery will report char_count = 14, then 21, etc. When i dump the characteristics array to serial and check the UUIDs and handles, I can see that there are duplicates, the same characteristics appear multiple times.

Is this behavior to be expected (I assume not)? Am I missing some kind of reset of the module, i.e. should I call ble_db_discovery_close() after service discovery completes, and reinitialize it, including registering event handlers for service UUIDs? That would strike me as a bit cumbersome. It does solve the problem though.

This is happening with an nRF51 dongle,  nRF SDK 12.3.0 and the S130 SoftDevice version 2.0.1.

Kind Regards

Alex Suzuki

Related