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

nRF52 How to connect to paired devices?

Hello Nordic Experts,

I am developing the pairing in a central. I am working on nRF52840 DK with nRF5_SDK_15.2.0_9412b96 as the cnetral and I have an iOS app as the peripheral.

When I press a button, I start scanning and looking for a particular UUID. I then connect and discover that and upon BLE_CTAP_EVT_DISCOVERY_COMPLETE, I call pm_conn_secure(p_ctap_evt->conn_handle, false) to initiate pairing. I do receive the pairing message on iPhone. After that, I want to use the pairing information to automatically connect to this iPhone when it is in range. I have no idea how to start and appreciate any help.

I have found pm_address_resolve, but I don't know how to get the IRK of the previously paired devices. Note that my iPhone changes its address frequently. 

Thanks

Parents
  • Hi,

    The iPhone use privacy, where it derives the MAC address form the Identity Resolving Key (IRK) and changes it regularly. The IRK is exchanged during bonding so that the nRF can see that the iPhone is the same device even though it's MAC address changes. To connect to the specific peripheral, you can use whitelisting with the IRK. When using whitelisting in central mode you configure the white list and start scanning. In this case, the SoftDevice will only connect to the whitelisted device(s). You can refer to the BLE Heart Rate Collector Example to see how it can be done.

Reply
  • Hi,

    The iPhone use privacy, where it derives the MAC address form the Identity Resolving Key (IRK) and changes it regularly. The IRK is exchanged during bonding so that the nRF can see that the iPhone is the same device even though it's MAC address changes. To connect to the specific peripheral, you can use whitelisting with the IRK. When using whitelisting in central mode you configure the white list and start scanning. In this case, the SoftDevice will only connect to the whitelisted device(s). You can refer to the BLE Heart Rate Collector Example to see how it can be done.

Children
Related