This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multile centrals to one peripheral (ble_app_multiperipheral)

ncs tag 1.6.1

Ubuntu 20.04

Hi

I am evaluating the Nordic nRF52840 using the Connect SDK. The nRF5 SDK has an example, ble_app_multiperipheral, showcasing a single peripheral that can allow multiple simultaneous connections.

I used the peripheral_uart example from the Connect SDK, in hopes that I can achieve a similar result, and added the following into the connect handler:

bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

I hoped this would cause the advertisement to start again and allow an additional connection, alas it did not. I did use the configuration tool to boost the maximum number of simultaneous connections.

I've done an exhaustive search to try and find a similar example to ble_app_multiperipheral as in the other SDK but for the Connect SDK.

Is this possible and how can it be done?

Parents
  • Hi,

    You can have multiple connections in nRF Connect SDK as well. For that you must specify CONFIG_BT_MAX_CONN=<number of connections> in prj.conf. While not a simple example you can refer to the dongle in nRF Destkop to see an example of multiple links.

  • Hi Einar.

    Thanks for the reply. I still cannot get the simple pripheral_uart example to allow multiple connections. I have set CONFIG_BT_MAX_CONN to 4 with the config utility in Embedded Studio and also the prj.conf itself. 

    I also added 

    bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

    In the connected handler in order to advertise again, but it does not advertise again.

    What am I doing wrong?

Reply
  • Hi Einar.

    Thanks for the reply. I still cannot get the simple pripheral_uart example to allow multiple connections. I have set CONFIG_BT_MAX_CONN to 4 with the config utility in Embedded Studio and also the prj.conf itself. 

    I also added 

    bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

    In the connected handler in order to advertise again, but it does not advertise again.

    What am I doing wrong?

Children
  • Hi,

    PieterJericho said:
    Thanks for the reply. I still cannot get the simple pripheral_uart example to allow multiple connections. I have set CONFIG_BT_MAX_CONN to 4 with the config utility in Embedded Studio and also the prj.conf itself. 

    That should be all that is needed. Just make sure you configure again after writing to prj.conf, for instance by opening the project again in Segger Embedded Studio.

    PieterJericho said:

    I also added 

    bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

    In the connected handler in order to advertise again, but it does not advertise again.

    You need not do that. Advertising will continue automatically if configured to support multiple advertisements. 

    You can experiment with this with the Bluetooth UART peripheral sample. There simply set CONFIG_BT_MAX_CONN=2, configure and build, and then you can connect with two devices. No changes needed to the source code itself. When the second device connects, advertising will stop. When one of the devices disconnect, advertising will automatically be started again.

Related