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?

  • Hi,

    Sorry for the late answer. You can create a private ticket and upload your project there.

    Edit: I am afraid I cannot really see what you are doing wrong based on main.c. Have you tried to compare your solution against the nRF5_SDK_15.3.0_59ac345\examples\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay example? this example is a client to both HRS and RSCS so it should handle discovery in the same way you application has to do it.

  • Hi, I just created a private ticket with a link to download the whole project.

    I'm going to look at ble_app_hrs_rscs_relay, thank you for the advice.

  • I looked at the ble_app_hrs_rscs_relay exemple but for SDK 15.0 beacause it is the SDK I was using for my project. The service discovery look similar to my projects.

    I used this project with the ble_app_hrs and ble_app_rscs examples to test the following scenario : 

    Peripherals           Relay (central)
    +----------+            +-------------+
    | Heart    |              | Heart      | 
    | Rate     |   ----->   | Rate       |
    | Sensor |              | Collector | 
    +----------+            +-------------+ 
                                 | Running  |
    +-----------+            | Speed     |
    | Running|   ------>| Collector | 
    | Speed   |            +-------------+
    | Sensor  |
    +-----------+

    I found that there are some case with this example where it don't work neither. It is less frequent but sometimes the relay does not discover the HRS or the RSCS service.

    For example, in this case the relay discovered only the HRS service : 

    Edit : I tried with the example ble_app_hrs_rcsc_relay of the SDK 15.3 too and I found the same problem. Sometimes one service is not discovered during the service discovery, did you found this too? Do you have other suggestions? Did you saw my private ticket?

  • Hi JCombes, 

    I'm testing here with the ble_app_hrs_rcsc_relay and couldn't reproduce the issue. How often do you see the issue ? 
    Could you increase the log level to DEBUG level so we can see more information ? 

    I suspect it's the issue when you connect 2 device at the same time and before the service can be found on one device the other device start new service discovery. But it should not be the case if you wait until the first device finish and start the second one. 

    Could you check if you can reproduce the issue either on ble_app_hrs_rcsc_relay or in your code if you test with only one peripheral ? 

    In addition, I would strongly suggest to use the db_discovery library from SDK v15.3 we fixed an issue with characteristic discovery inside the db_discovery module. You don't have to move to SDK v15.3 , just need to use the db_discovery library in SDK v15.3 

  • Hi, thank you for your answer.

    I don't know if this info can be useful but for my hardware I use 2 nRF52840DK and 2 BMD-340-EVAL.

    My code : 

    I use now the db_discovery library from SDK v15.3.

    I did the following tests with one central and 2 RFID peripheral and 1 RELAY peripheral.

    With my code I get the issue 1 time for 2 try.

     

    This is an example of when it works :

    The discovery works and then I get the event “RFID_C_EVT_DISCOVERY_COMPLETE” and start scanning again.

    This is an example of when it doesn’t work :

    According to the DEBUG logs, it seems that the discovery is successful. But I don’t get the event “RELAY_C_EVT_DISCOVERY_COMPLETE”.

    I can’t reproduce the issue when I use only one peripheral.

    Example code (SDK 15.3) :

    For the following test I use 1 ble_app_hrs_rscs_relay, 1 ble_app_hrs and 1 ble_app_rscs.

    I had to try at least 15 time to reproduce the issue.

     

    Example of only the HRS service has been discovered :

    Here we have the connection handle 0x0 and 0x1 but only one service is discovered.

    I can’t reproduce the issue when I use only one peripheral.

Related