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

BLE Peripheral NUS connected to multiple Central devices on nrf52840 S140 and SDK V16.0.0

Hello,

Is it possible to configure the board as a peripheral device that provides the Nordic UART Service and allows multiple central devices to connect and exchange data.

Sort of like the "usbd_ble_uart_freertos" example but allows more than one Central device to connect at the same time.

Thanks

Omid

Parents
  • Hello,

    I would suggest you take a look at the example that you find in:

    SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral (Not really any need for an FreeRTOS).

    This example shows how to allow multiple peripheral connections (connecting to multiple central devices). As you can see it is quite similar to the ble_app_multilink_central, which allows for multiple central connections (multiple peripherals connecting to it). There are some defines that need to be set, such as the NRF_SDH_BLE_PERIPHERAL_LINK_COUNT and NRF_SDH_BLE_TOTAL_LINK_COUNT in sdk_config.h and then start advertising on the BLE_GAP_EVT_CONNECTED event, as long as the number of current connections is smaller than NRF_SDH_BLE_PERIPHERAL_LINK_COUNT.

    Remember that when you are dealing with multiple connections, you must keep track of your connection handles, in order to know who you received a message from, and who you are transmitting to.

    Best regards,

    Edvin

Reply
  • Hello,

    I would suggest you take a look at the example that you find in:

    SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral (Not really any need for an FreeRTOS).

    This example shows how to allow multiple peripheral connections (connecting to multiple central devices). As you can see it is quite similar to the ble_app_multilink_central, which allows for multiple central connections (multiple peripherals connecting to it). There are some defines that need to be set, such as the NRF_SDH_BLE_PERIPHERAL_LINK_COUNT and NRF_SDH_BLE_TOTAL_LINK_COUNT in sdk_config.h and then start advertising on the BLE_GAP_EVT_CONNECTED event, as long as the number of current connections is smaller than NRF_SDH_BLE_PERIPHERAL_LINK_COUNT.

    Remember that when you are dealing with multiple connections, you must keep track of your connection handles, in order to know who you received a message from, and who you are transmitting to.

    Best regards,

    Edvin

Children
No Data
Related