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

Problems while discovering services on a multilink central

Hi,

I developped a multilink central based on the example code ble_app_multilink_central.

I want to connect to several peripherals with two different custom services as shown in the following schematic.

The connection work but I have problems while discovering the services.

Sometimes the central discover all the services but often some services are not discovered and I don't understand why.

The discovery handler executes many times for each connection and the event type is often BLE_DB_DISCOVERY_ERROR.

Here is my discovery handler :

Here is an example of what can happen during a connection with 2 RFID and 1 Relay :

Here we can see that we have the relay on conn_handle 0x0 and the RFIDs on conn_handle 0x1 and 0x2.

We can see that the RFID service is not discovered on the conn_handle 0x1.

My questions are :

-When does the discovery handler execute for each connection?

-How to obtain the event BLE_DB_DISCOVERY_COMPLETE?

-Why does the discovery handler execute several time on each connection? And why is it not executed again while the service is not discovered?

Parents
  • If I remember correctly there is a limitation with the discovery module. so you should only do service discovery on one peer at the time. Can you try to add a check so you do not start service discovery on the new device if the process is already ongoing?

  • Hi, thank you for your help.

    I changed my program so it start to scan again for new peripherals only when the services of the previously connected peripheral has been discovered. 

    I have now the funtion "scan_start();" in my central event handlers in "case C_EVT_DISCOVERY_COMPLETE".

    It works sometimes with this method but not always.

    Here is an example of when it does not work :

    On the conn_handle 0x0 the discovery handler continues even if the service is already discovered. Then the RFID service is discovered several times on conn_handle 0x0.

    On the conn_handle 0x1 the relay service is discovered.

    On the conn_handle 0x2 the RFID service is not discovered and the discovery handler stop.

Reply
  • Hi, thank you for your help.

    I changed my program so it start to scan again for new peripherals only when the services of the previously connected peripheral has been discovered. 

    I have now the funtion "scan_start();" in my central event handlers in "case C_EVT_DISCOVERY_COMPLETE".

    It works sometimes with this method but not always.

    Here is an example of when it does not work :

    On the conn_handle 0x0 the discovery handler continues even if the service is already discovered. Then the RFID service is discovered several times on conn_handle 0x0.

    On the conn_handle 0x1 the relay service is discovered.

    On the conn_handle 0x2 the RFID service is not discovered and the discovery handler stop.

Children
No Data
Related