Pairing specific pairs among many

Hello, we're trying to make products using BLE with nRF52840(central) and nRF52833(peripheral).

We did make custom boards and also made a program that once paired(bonded), it won't connect with others.

(eg, once nRF52840 and nRF52833 is paired, it will not connect with others)

We were wondering is there a way to make specific central connect with specific peripheral?

Is there a way to make each central/peripheral unique so that pairing process can be done without interference?

We got concerned that wrongly paired(or bonded) devices might ship out.

At our current stage, pairing wrong central/peripheral is possible.

Other infos.

nRF52840-central has 2 buttons, while nRF52833-peripheral has none

We're using SDK 17.1.0 S140 Segger Studio

has NUS(communication) and BAS(battery check) BLE services

thanks

edit:

extra question: is there a way to write certain unique number/MAC address on flash during flash write and then read it during application?

How do I know which address of flash is used or not?(want to avoid  collision with bonded info)

Is there a download tool beside nRF Connect Programmer?

Parents
  • Einar Thorsrud said:
    Remove the pm_* calls, and add code handling the whitelis manually, just like in the peripheral example I showed yesterday.

    I was asking for help on this part because central/scanner's API seems very different. Is sd_ble_gap_whitelist_set() enough for adding whitelist? A bit confusing because you added whitelist before advertising start and added again(?) during BLE_ADV_EVT_WHITELIST_REQUEST (which can be handled with ble_advertising_whitelist_reply)

    Will adding whitelist with sd_ble_gap_whitelist_set() be enough before scanning? In whitelist_req and whitelist_load, there seems nothing but nrf_ble_scan_params_set() if I remove all pm_* and peer_*.

    About the filter part, assuming peripheral is using whitelist with specific address (though BLE_GAP_ADDR_TYPE_RANDOM_STATIC), will there be any trouble connecting each other?

    I know this one is bizarre, can gap address change or different when it is connected? I read ble address then added it UICR to connect it immediately but central's NRF_BLE_SCAN_EVT_CONNECTED is displaying totally different address when attempting to connect(then get disconnected).

    EDIT: I did try filter on the central's side (disabled whitelist) while peripheral whitelist enabled. The problem still persisting is NRF_BLE_SCAN_EVT_CONNECTED - it is displaying different address then what I set on address filter. Funny thing is I'm getting NRF_BLE_SCAN_EVT_FILTER_MATCH.

    I tried disabling whitelist on peripheral's side and it got connected this time. The problem is that the connected address is displaying totally different address ( I added nrf_log_info of p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr on BLE_GAP_EVT_CONNECTED. Like central's case, it is displaying totally different address). 

    address difference eg:

    Central's device address (NRF_FICR->DEVICEADDR[0,1]):

    (hex) B331 9540 C817
    (bin) 1011 0011 0011 0001 1001 0101 0100 0000 1100 1000 0001 0111

    What peripheral is connected to (p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[0~5]):

    (hex) 4095 31B3 17C8
    (bin) 0100 0000 1001 0101 0011 0001 1011 0011 0001 0111 1100 1000

    EDIT2: I found interesting pattern looking at both device: address array 123456 turns into 432165. Is it intended? does it affect filter and whitelist?

    EDIT3: Holy Christ! I've been doing it wrong! after arranging peripheral's whitelist address in order/pattern I found, it worked! Scanner's filter address order is the same but peripheral's whitelist address has to be rearranged.

    My Question changes: with whitelist and filter added, is bonding/pairing necessary? Can I get rid of both? I want to reduce connection time .

Reply
  • Einar Thorsrud said:
    Remove the pm_* calls, and add code handling the whitelis manually, just like in the peripheral example I showed yesterday.

    I was asking for help on this part because central/scanner's API seems very different. Is sd_ble_gap_whitelist_set() enough for adding whitelist? A bit confusing because you added whitelist before advertising start and added again(?) during BLE_ADV_EVT_WHITELIST_REQUEST (which can be handled with ble_advertising_whitelist_reply)

    Will adding whitelist with sd_ble_gap_whitelist_set() be enough before scanning? In whitelist_req and whitelist_load, there seems nothing but nrf_ble_scan_params_set() if I remove all pm_* and peer_*.

    About the filter part, assuming peripheral is using whitelist with specific address (though BLE_GAP_ADDR_TYPE_RANDOM_STATIC), will there be any trouble connecting each other?

    I know this one is bizarre, can gap address change or different when it is connected? I read ble address then added it UICR to connect it immediately but central's NRF_BLE_SCAN_EVT_CONNECTED is displaying totally different address when attempting to connect(then get disconnected).

    EDIT: I did try filter on the central's side (disabled whitelist) while peripheral whitelist enabled. The problem still persisting is NRF_BLE_SCAN_EVT_CONNECTED - it is displaying different address then what I set on address filter. Funny thing is I'm getting NRF_BLE_SCAN_EVT_FILTER_MATCH.

    I tried disabling whitelist on peripheral's side and it got connected this time. The problem is that the connected address is displaying totally different address ( I added nrf_log_info of p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr on BLE_GAP_EVT_CONNECTED. Like central's case, it is displaying totally different address). 

    address difference eg:

    Central's device address (NRF_FICR->DEVICEADDR[0,1]):

    (hex) B331 9540 C817
    (bin) 1011 0011 0011 0001 1001 0101 0100 0000 1100 1000 0001 0111

    What peripheral is connected to (p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[0~5]):

    (hex) 4095 31B3 17C8
    (bin) 0100 0000 1001 0101 0011 0001 1011 0011 0001 0111 1100 1000

    EDIT2: I found interesting pattern looking at both device: address array 123456 turns into 432165. Is it intended? does it affect filter and whitelist?

    EDIT3: Holy Christ! I've been doing it wrong! after arranging peripheral's whitelist address in order/pattern I found, it worked! Scanner's filter address order is the same but peripheral's whitelist address has to be rearranged.

    My Question changes: with whitelist and filter added, is bonding/pairing necessary? Can I get rid of both? I want to reduce connection time .

Children
No Data
Related