Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to connect Multiperipherals to one Central?

Hi,

I want to connect Multi peripherals to one central and want to send the device name(peripheral which is connected) through the uart.

How do i get the device name which is connected?

Also i Want to know Can the central connect to more peripherals at the same time? 

Parents Reply Children
  • Not sure how you ideally want to identify peripherals, but there are many options you may consider:

    - You can have content in advertisement packet that the central can use to identify the peer device

    - You can have proprietary services and characteristics that uniquely identify the peer device, either during advertisement or after connection.

    - You may after connection bond to the peer device, and store additional application specific information about the peer device, such that you later may re-connect automatically based on previous bond.

  • I know but static char const m_target_periph_name[] = {"Nordic_Blinky"}; connect one device. I have 5 boards and i want to connect devices same time. How can i do it?

    static char const* m_target_periph_name[5] = {"Nordic_Blinky", Nordic_Blinky_1, ...};

  • I believe for most part \examples\ble_central\ble_app_multilink_central example in nRF5 SDK already do what you request.

  • I was looking for the same and my solution was (sdk_17, ble_app_multilink_central):

    #define NRF_BLE_SCAN_NAME_CNT = 2  //which overrides the def in sdk_config.h

    static char const *m_target_periph_name[NRF_BLE_SCAN_NAME_CNT] = {"Nordic Blinky 1", "Nordic Blinky 2"};

    Then in scan_init() replace 

    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, m_target_periph_name);
    APP_ERROR_CHECK(err_code);

    with

    for (int i=0; i< NRF_BLE_SCAN_NAME_CNT; i++){
         err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, m_target_periph_name[i]);
        APP_ERROR_CHECK(err_code);
    }

Related