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

Problem in Multilink central and Multi peripheral when it comes to more than 2 connections.

Hi, I am working on SDK 15.0 Multilink central and Multi peripheral

Soft device: 6.0.0

Segger IDE

Application overview :

When the central request to all peripherals, which are connected with central, the peripherals will return some
predefined data,By that the central come to all peripherals states.

So I have modified the Multilink central and Multi peripheral but when it comes to the more than 2 peripheral connections
all the peripherals are not receiving the request message  from the central.But some times the  peripherals are  receiving the request message.

I want to know how can i find the root cause of the problem..?
where should i concentrate on ???

Please someone help me .....

Note : My modification is working fine with 2  peripheral connections

Parents
  • Hi,

    Which type of request are you referring to? Can you elaborate? Generally you should not loos any data regardless of how many peers are connected as long as you don't have any disconnects, since there will be retransmissions if needed. Also there is no fundamental difference between supporting two or more connections, provided you keep track of them.

    Which SDK examples are you using, and how are you testing? Can you show us which modifications you have done to the examples?

Reply
  • Hi,

    Which type of request are you referring to? Can you elaborate? Generally you should not loos any data regardless of how many peers are connected as long as you don't have any disconnects, since there will be retransmissions if needed. Also there is no fundamental difference between supporting two or more connections, provided you keep track of them.

    Which SDK examples are you using, and how are you testing? Can you show us which modifications you have done to the examples?

Children
  • Thank you for reply...

    For Central :

    nRF5_SDK_15.0.0_a53641a\examples\ble_central\ble_app_multilink_central

    For Peripheral :

    \nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\experimental\ble_app_multiperipheral\pca10040\s132\

    I will explain the Functional flow by 3 steps 

    Step 1:

    I have added the UART event in multilink_central as bellow (central side functionality )

    Functionality is, uart string are being received and being compared with mSelf_Test_cmd (variable) then if matches 

    i am sending the particular predefined data to all the peripheral ,which are connected with central, by using the API 

    ble_lbs_led_status_send().

    Step 2:

    Peripheral(All) side code that has been added as below

    Functionality is, led_write_handler event will be triggered  when the 

    API ble_lbs_led_status_send() sends the predefined data to the all peripherals from Central side.

    and  the received data (led_state) will be compared with mSelf_Test_cmd (variable ) then 

    i am sending the particular predefined data(which is called slaveID) to Central by using the API 

    led_status_send_to_all().

    Step 3:

    Again Central multilink_central will be receiving the data which were sent by all peripherals

    The behaviour code is as below 

    Functionality is ,the event handler "lbs_c_evt_handler" will be receiving the data which were sent by all peripherals and comparing with slaveID then I am just printing as Slave_n.. so that i come to know How many slaves that are connected with My Central.

    This is what i have implemented.

    • I will explain how i came know  that peripherals were not received from central.

    Peripheral side:

    I am printing the string "Test cmd" before sending the slaveIDs to Central and it did not happen (monitoring in terminal)

    Note : u8myslave_ID will be different to each one of the peripheral code so that we will come to know different Slaves (peripherals) in central side.

     

    My ultimate goal is to find How many peripherals are connected with central and I need to differentiate them by numbering   

    Kindly suggest is there is  any other simple way to identify the peripherals count and differentiate them by numbering or device ID ,MAC  Address of every device.

  • Hi,

    It is up to the application to know how many links are active and the connection ID's associated with each link, but it should use the Connection state library to keep track of them, which is used in the multilink examples in the SDK. For instance, you can use ble_conn_state_central_conn_count() to know how many links you have as a central (how may peripherals you are connected to). Similarly, you can use ble_conn_state_peripheral_conn_count() on the peripheral to know how many centrals are connected to it.

    However, this does not give you any method to identify the peer based on a ID, but this is where you can use your slave ID and make a mapping between the connection handle and slave ID (for instance). Another approach is to map the MAC address and the connection handle, since the MAC address is available when you get the BLE_GAP_EVT_CONNECTED event (p_ble_evt->evt.gap_evt.params.connected.peer_addr).

    None of this explains why you see problems with more than two links though, which should not happen. It might be that you are mixing something up, as the main challenge of multilink applications is to keep track of the connection ID's in a sensible way.

Related