This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

S120 multiple connections problem

Hi there,

I want to connect multiple nus devices to S120 central. After connection with device, it starts to scan again after the BLE_GAP_EVT_CONNECTED event. And there is problem. After second device connects I always got NRF_ERROR_BUSY from ble_db_discovery function. Do I need to wait some time between connections ? Logs looks like that:

-------------RESTART-------------
Scan started
Connected to target <- BLE_GAP_EVT_CONNECTED event
Scan started
Connected to target <- second device
error #17 at ..\..\..\main.c, in function on_ble_evt, line 453 <- APP ERROR CHECK @ ble_db_discovery_start
Scan started
The device has the device RX characteristic
The device has the device TX characteristic

I've tried delaying some time between discovery, but with no results. Is there any solution to that?

Parents
  • Hi, good point. I see two possible solutions or workaround to this:

    • A workaround might be as you do, by delaying scanning for the next peripheral until the BLE_DB_DISCOVERY_COMPLETE event occurs from the registered callback in ble_db_discovery_evt_register(). This is the easiest, and might not be a bad idea, considering you can't really use the next peripheral until the the database discovery is finished in any case.

    • A better solution might be to allow scanning for next peripheral, but have an array of established connections and pending database discovery in your application. If a database discovery is in progress, then delay ble_db_discovery_start() until BLE_DB_DISCOVERY_COMPLETE event occurs or that connection disconnect.

Reply
  • Hi, good point. I see two possible solutions or workaround to this:

    • A workaround might be as you do, by delaying scanning for the next peripheral until the BLE_DB_DISCOVERY_COMPLETE event occurs from the registered callback in ble_db_discovery_evt_register(). This is the easiest, and might not be a bad idea, considering you can't really use the next peripheral until the the database discovery is finished in any case.

    • A better solution might be to allow scanning for next peripheral, but have an array of established connections and pending database discovery in your application. If a database discovery is in progress, then delay ble_db_discovery_start() until BLE_DB_DISCOVERY_COMPLETE event occurs or that connection disconnect.

Children
Related