pairing bonding fail

Hi,

Hello everyone, I have encountered a problem in the pairing and bonding process of BLE.I use two NRF52832 development boards, one acts as a slave and the other acts as a master.Before the two peers have never been paired, the pairing and bonding can be performed normally.But after I use the function "pm_peer_delete()" to delete the bonding information on the master side,the connection will be disconnected immediately after the two peers establish a connection.

Here is the log:

SLAVE:

[2022-04-07 11:04:05.801 R]<info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update, no change

<info> app: Connected


[2022-04-07 11:04:05.951 R]<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 133

<info> app: Authorization failed with code: 133!

<info> app: Disconnected

<info> app: Disconnected reason is : 19

MASTER:

[2022-04-07 11:04:05.801 R]<info> BLE_M: Connection 0x0 established, starting DB discovery.


[2022-04-07 11:04:05.921 R]<info> BLE_M: BLE_GAP_EVT_AUTH_STATUS

<info> BLE_M: Authorization failed with code: 133!

<error> nrf_ble_gq: SD GATT procedure (4) failed on connection handle 0 with error: 0x00000008.

<info> BLE_M: Disconnected. conn_handle: 0x0, reason: 0x16

I would like to know what is the reason for the above problem?

According to the following technical Q&A:

https://devzone.nordicsemi.com/f/nordic-q-a/43907/nfc-ble-pairing-connection-issue

The cause of the above problem seems to be that I did not delete the bonding information on the slave side, so I deleted the bonding information on the slave side, and both peers can indeed re-pair and bond.

But I think there is a phenomenon that one of the two peers deletes the existing bonding information. If the other peer does not delete the bonding information, the two devices cannot be reconnected.Is there a better way that the paired peers can delete the bonding information at will, and then both can reconnect without relying on whether the other peer also deletes it?

Parents
  • Hi

    Indeed, if only one of the devices delete the bonding information, the two devices won't be able to connect again until both delete the peer data. I think the easiest way around this would be to make the peripherals run a pm_peer_delete(); function if it fails to connect to the central X amount of times, or just delete bonding upon disconnections.

    Best regards,

    Simon

Reply
  • Hi

    Indeed, if only one of the devices delete the bonding information, the two devices won't be able to connect again until both delete the peer data. I think the easiest way around this would be to make the peripherals run a pm_peer_delete(); function if it fails to connect to the central X amount of times, or just delete bonding upon disconnections.

    Best regards,

    Simon

Children
  • Hi,

    Thanks, I got it.I have added the function pm_peer_delete();on both the maser side and the slave side to prevent either side from deleting the bonding information and causing the connection to fail.

    In the current project, I have another function that needs to be implemented.The master needs to record the bonding information of two types of devices.The bonding information of each type of device can be recorded up to 4.When the bonding information of a certain type of device exceeds 4,according to the principle of first-in, first-out, delete the earliest record of this type of device.

    Currently I'm reading the code of the peer_manager module, which does a lot of the pairing bonding and information storage work.I am not sure whether I should intervene in the record key before the peer_manager module writes the bonding information to the flash, or use FDS to record the bonding information to facilitate operations such as later deletion.

    If you have better suggestions or comments, please let me know, thank you.

Related