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

Multilink central with UART

Hello,

I am trying to develop a sensor which can connect to multiple sensors and send the data which is received by its UART through bluetooth, at the peripheral. Central device reveives the data through the bluetooth and then sends it out through UART. I have tried the example given in the SDK and it is working fine. Now i want to add multilink features to the central device. I tried adding, but it did not work out. Can someone please help me out with the same? Is there any example program available for this?

SDK Used: NRF52 SDK 16.0

Chipset : NRF52832

IDE : Segger Embedded Studio

Regards,

Subbu

Parents Reply Children
  • Hi Torbjørn,

    Thanks for this. I just downloaded. Will test it and let you know shortly. But a small doubt before that. I was looking into the code. But it did not have any target device name. How will the central know that to which peripheral it has to connect?

    Regards,

    Subbu

  • Also i tested this example with two peripherals along with a central. Below are my observations.

    1. Sending the data from the central is received at both the peripherals.

    2. Sending the data from peripheral 1 is received at the central and peripheral 2.

    3. Sending the data from peripheral 2 is received at the central and peripheral 1.

    Can we modify a little bit? So peripheral sends the data only to the central, and the other peripheral should not get the information.

    Also, the message sent from the central, should not come back to the central. I guess this can be done by modifying echoback.

    Regards,

    Subbu

  • Hi Subbu

    I tried to keep the example as similar as possible to the original example, and modified it to send the data to all links rather than just a single one. 

    You can obviously change this as you see fit depending on your application requirements. 

    To find the points in the code where I send data to all the links just look for a loop similar to this:

    for(int c = 0; c < NRF_SDH_BLE_CENTRAL_LINK_COUNT; c++)
    ...

    And yes, to disable the echo just set the ECHOBACK_BLE_UART_DATA define on line 75 of main.c to 0.

    Best regards
    Torbjørn

  • Hi Torbjørn,

    Thank you. But does peripheral has something to do with sending the information to all links? Because the peripheral is the one who is sending the data to the central. Does the central resend the data to all the links?

    Also i did not get the answer for this. There is no target device name specified anywhere. Then how does the central know, which peripheral to connect to?

    Regards,

    Subbu

  • Hi Subbu

    In any BLE connection you will have one central and one peripheral, but you can send data any way you like, it doesn't matter if you are on the central or peripheral side. 

    The code I sent supports up to 4 central links, which means you can connect to 4 different peripheral devices at the same time. 

    When data is received from either of the peripheral devices it will be sent back to all of the connected peripheral devices. 

    The different connected peripherals can be identified by their unique connection handle, which is a 16-bit number that starts at 0 and is incremented by 1 for each additional connection. 

    Whenever you need to send some data to one of the peripherals you use the connection handle to identify them. 

    Best regards
    Torbjørn

Related