Bonding with NimBLE

zabrickler
Posts: 1
Joined: Wed Oct 23, 2024 5:10 pm

Bonding with NimBLE

Postby zabrickler » Wed Oct 23, 2024 7:14 pm

I am trying to reestablish a connection to a peripheral device that was bonded to a central device. I am using the examples blecent and bleprph from the NimBLE files. I modified the peripheral code so that it advertises with a resolvable private address and I have enabled host based privacy. For the initial connection the central and peripheral are able to connect, pair, and bond just fine. I am able to see that the LTK and IRK are exchanged and stored in NVS and the central seems to be able to resolve the RPA.

The problem arises when I disconnect the two devices. After they are disconnected and the central is scanning again it is able to find the peripheral just fine and attempts to connect. This is about as far as it gets. The functions that initiate the connection all return 0 or ok and the central is waiting on the connection established GAP event that never comes. Eventually the central returns a Connection failed status = 13 (timeout).

One of the ways I have tried to solve this issue is by enabling host based privacy for the central device which changes the centrals address from public to RPA. This allows for a connection to be established but when the central initiates security it is unable to recognized that it has paired with the peer even though the peer has the same MAC address as the one stored in the devices that it is currently bonded with.

Am I missing something with the way I configured the addresses initially? Or am I missing something with the RPA actually isn't being resolved properly?

I have attached the main files for the peripheral and central code.
Attachments
blecentmain.c
(33.81 KiB) Downloaded 34 times
bleprphmain.c
(19.36 KiB) Downloaded 33 times

Who is online

Users browsing this forum: No registered users and 207 guests