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

nrf52832 S132 bonding

SDK: nRF5_SDK_11.0.0
Softdevice: s132_nrf52_2.0.0_softdevice

I read an article about the connection, pairing, bonding and whitelist, there are some doubts:

Bonding: Paired devices can be bonded. This means that they store the keys that have already been exchanged when they paired and use those again the next time they connect.

So can I understand that the device needs to use the password pairing and then bonding ?If I do not use a password for pairing, I can not bond ?

I want to achieve the function is the phone and the slave Pairing and bonding at the first time,then The master and slave can automatically connected after power-on,before Unbonding the slave can not be connected by other devices, also can not be scanned。

Because Android and ios phone BLE address is random private resolvable address, So I can not add the address to the whitelist,I see that the original address can be resolved by IRK,so I want to know how to achieve?Is there a better way to achieve my Above functions。thanks~

Parents
  • Hi HDU,

    You don't have to use passkey to be able to bond.

    Bonding mean there will be a LTK (long term key) exchanged after the link is encrypted by STK (short term key). The LTK will be used on the next time they connect.

    Pairing is when the link is encrypted with STK.

    You are correct about the IRK. You need to add the IRK to the whitelist. Please have a look at the ble_app_hid_keyboad or mouse to see how it's implemented in SDK v11.

Reply
  • Hi HDU,

    You don't have to use passkey to be able to bond.

    Bonding mean there will be a LTK (long term key) exchanged after the link is encrypted by STK (short term key). The LTK will be used on the next time they connect.

    Pairing is when the link is encrypted with STK.

    You are correct about the IRK. You need to add the IRK to the whitelist. Please have a look at the ble_app_hid_keyboad or mouse to see how it's implemented in SDK v11.

Children
  • Such as the code, how can I get the phone address and IRK?

     case BLE_ADV_EVT_WHITELIST_REQUEST:
        {
            ble_gap_whitelist_t whitelist;
            ble_gap_addr_t    * p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
            ble_gap_irk_t     * p_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
    				
            whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
            whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
            whitelist.pp_addrs   = p_whitelist_addr;
            whitelist.pp_irks    = p_whitelist_irk;
    
            err_code = dm_whitelist_create(&m_app_handle, &whitelist);  //´´½¨°×Ãûµ¥¹¦ÄÜ
            APP_ERROR_CHECK(err_code);
    
            err_code = ble_advertising_whitelist_reply(&whitelist);
            APP_ERROR_CHECK(err_code);
            break;
        }
    
  • Have you had a look and test the ble_app_hid_keyboard example ? The whitelist is created and handled by device manager, you don't have to do anything.

Related