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

ble_app_uart: Unique connection between a specific central and a specific peripheral

Hi All,

I have more boards on which I have loaded the code ble_app_uart_c (nRF5_SDK_15.2.0_9412b96) which I use as central devices and I have other boards on which I have loaded the ble_app_uart code which I use as peripherals.

The boards taken in pairs (one with the code ble_app_uart_c and the other with ble_app_uart) work perfectly. The problem arises when I want to have more pairs of boards working at the same time, because I risk a central connection with the wrong peripheral and so on.

Is there a way, modifying the code, that allows the unique connection between a specific central and a specific peripheral?

Thanks in advance for your time.

Parents
  • Hi, 

    you can use the device name as the scanning filter for the connection.

    for example, I did the example on the peripheral and central role (both device) 

    github.com/.../main.c

    static char const m_target_periph_name[] = "Peripheral_PER";

    for the SDK 15.3, it has the scan module to easy configure.

    // <e> NRF_BLE_SCAN_FILTER_ENABLE - Enabling filters for the Scanning Module.
    //==========================================================
    #ifndef NRF_BLE_SCAN_FILTER_ENABLE
    #define NRF_BLE_SCAN_FILTER_ENABLE 1
    #endif
    // <o> NRF_BLE_SCAN_UUID_CNT - Number of filters for UUIDs.
    #ifndef NRF_BLE_SCAN_UUID_CNT
    #define NRF_BLE_SCAN_UUID_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_NAME_CNT - Number of name filters.
    #ifndef NRF_BLE_SCAN_NAME_CNT
    #define NRF_BLE_SCAN_NAME_CNT 1
    #endif
    
    // <o> NRF_BLE_SCAN_SHORT_NAME_CNT - Number of short name filters.
    #ifndef NRF_BLE_SCAN_SHORT_NAME_CNT
    #define NRF_BLE_SCAN_SHORT_NAME_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_ADDRESS_CNT - Number of address filters.
    #ifndef NRF_BLE_SCAN_ADDRESS_CNT
    #define NRF_BLE_SCAN_ADDRESS_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_APPEARANCE_CNT - Number of appearance filters.
    #ifndef NRF_BLE_SCAN_APPEARANCE_CNT
    #define NRF_BLE_SCAN_APPEARANCE_CNT 0
    #endif
    
    // </e>

Reply
  • Hi, 

    you can use the device name as the scanning filter for the connection.

    for example, I did the example on the peripheral and central role (both device) 

    github.com/.../main.c

    static char const m_target_periph_name[] = "Peripheral_PER";

    for the SDK 15.3, it has the scan module to easy configure.

    // <e> NRF_BLE_SCAN_FILTER_ENABLE - Enabling filters for the Scanning Module.
    //==========================================================
    #ifndef NRF_BLE_SCAN_FILTER_ENABLE
    #define NRF_BLE_SCAN_FILTER_ENABLE 1
    #endif
    // <o> NRF_BLE_SCAN_UUID_CNT - Number of filters for UUIDs.
    #ifndef NRF_BLE_SCAN_UUID_CNT
    #define NRF_BLE_SCAN_UUID_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_NAME_CNT - Number of name filters.
    #ifndef NRF_BLE_SCAN_NAME_CNT
    #define NRF_BLE_SCAN_NAME_CNT 1
    #endif
    
    // <o> NRF_BLE_SCAN_SHORT_NAME_CNT - Number of short name filters.
    #ifndef NRF_BLE_SCAN_SHORT_NAME_CNT
    #define NRF_BLE_SCAN_SHORT_NAME_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_ADDRESS_CNT - Number of address filters.
    #ifndef NRF_BLE_SCAN_ADDRESS_CNT
    #define NRF_BLE_SCAN_ADDRESS_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_APPEARANCE_CNT - Number of appearance filters.
    #ifndef NRF_BLE_SCAN_APPEARANCE_CNT
    #define NRF_BLE_SCAN_APPEARANCE_CNT 0
    #endif
    
    // </e>

Children
Related