I am working off the ble_cts_c example, using SDK 14.0.0, SoftDevice S140, and nRF52840.
All works well when I pair a device for the first time: the nRF discovers services on the central device.
When I reset and connect to a previously bonded device, in pm_evt_handler
I first get the PM_EVT_BONDED_PEER_CONNECTED event (ok), then upon receiving the PM_EVT_CONN_SEC_SUCCEEDED event I attempt to start discovering services on the central device:
// Discover peer's services.
memset(&m_ble_db_discovery, 0x00, sizeof(m_ble_db_discovery));
err_code = ble_db_discovery_start(&m_ble_db_discovery, p_evt->conn_handle);
APP_ERROR_CHECK(err_code);
Problem is that the call to ble_db_discovery_start
returns NRF_ERROR_BUSY
. According to docs this means that discovery is already in progress (why/how? I don't call ble_db_discovery_start
anywhere else in my code). But I never see a call to my db discovery handler, so the cts service is never properly discovered.
Any help is greatly appreciated!