NFC BLE Pairing/Bonding between Nordic Peripheral and Android Central

Hi All,

I am working on "ble_app_hids_keyboard_pairing_nfc" from nrf5 SDK v17.1.0 on a nRF52840 DK with an Android phone. Please note that I am using the Android BLE itself, not the nRF Connect App.

When I try it the first time, after a clean restart with no bonded devices in the flash, a notice is shown on the phone and I am asked whether I want to pair with this the device. I select YES and it seems to work fine. I can see the bonding events taking place on the RTT Viewer. Also, the corresponding LED indicates the established connection. Then I break the BLE connection, (again the LED behaves accordingly and goes OFF), and try to read the NFC tag again to wake it up. Unexpectedly (correct me if I am wrong), the phone asks me, again, whether I want to pair with the device. 

However, I was expecting the DK to start advertising and the phone to reconnect without any pairing process. Is this not how it should be?

I tried to modify the NFC_T2T_EVENT_FIELD_ON in the nrf_callback, so that it advertises if and only if the peer_count is not 0. However it did not work. 

My questions are;

1) Is this fw supposed to be restarted on each wake up (when the NFC field is detected)

2) Does it have to whitelist IRKs only (instead of both IRK and address) to work with an Android phone, whose address is regularly changed, in a stable way. If so how can I do it?

3) I want it to pair and bond with only one peer when the whitelist is empty. If there is a peer in the whitelist then it should connect to that peer when it is waken up, via NFC, and should not start a new pairing process. How can I do this?

I will be happy if you can please help me with these.

Best, 

Den

Parents
  • Hi Den

    1. Yes, this is how it's supposed to work, as there is a subtle difference between pairing and bonding. Pairing is done for every connection and encrypts a specific connection and only for that connection, and thus pairing will reoccur if you disconnect and reconnect. Bonding however, bonds two devices together and will store bonding info in the flash of the respective devices so that they keep this info through disconnects and won't have to do bonding again upon a reconnection.

    2. I'm not sure what you're asking here to be honest, but I assume what you want to do is bonding rather than pairing, is that right? You can see how bonding is done in the Glucose application in the SDK 17.1.0 BLE examples

    3. I think you need to implement bonding instead of pairing and have the whitelist size on the central set to 1 so that it only connects to the one peer and don't try to connect to others.

    Best regards,

    Simon

  • Hi Simonr,

    Thanks for your reply. 

    My question was a little vague I think. I will try to elaborate it. However, is it possible to take this ticket private before I do?

    Best,

    Den

Reply Children
Related