NimBLE peer_addr_type=1 rejects connection and device needs to recouple

MGeiglP
Posts: 2
Joined: Tue Oct 22, 2024 11:52 am

NimBLE peer_addr_type=1 rejects connection and device needs to recouple

Postby MGeiglP » Tue Oct 22, 2024 12:08 pm

Hello community

I am using a ESP32 with IDF version 5.1.2 and NimBLE. On the other side i use a Samsung Galaxy S21 with Android 14 and an Iphone 13 with iOS 17.6.

I setup NimBLE do be able to store two devices and have one connection at a time. It seems to work quit good for several times. Connecting once with the iphone and sometime later with the android and later again with the iphone.

And then suddenly the iphone and also the android tells me that it can not connect anymore because the esp dropped the keys.

The only possible way to get them connected again is to remove them from the bonded devices and pair them again.

I atteched two log files. One where the connections always where ok and fine. The second one where the connection did not work. The first difference what i have found out was that always when the connection was ok the peer_addr_type was 0 and when the connection was not possible it was 1.

How can that change at the same device? Is there maybe a hint what could be the problem?

thx
Attachments
connecting ok.txt
(189.05 KiB) Downloaded 17 times
connecting not ok.txt
(2.83 KiB) Downloaded 17 times

MGeiglP
Posts: 2
Joined: Tue Oct 22, 2024 11:52 am

Re: NimBLE peer_addr_type=1 rejects connection and device needs to recouple

Postby MGeiglP » Wed Oct 23, 2024 5:21 pm

Ok i have further dug into the problem and it seems that if the bonding information is not available the nimble lib plots the random address of the smartphone and type 1 and if the pairing was completed and the bonding informations are stored in the esp32 it shows the static address of the device with type 0.

So the problem occured already early and i found out that the bonding information got deleted. And that happend because there where too many subscription and cccds stored. And if a cccd store overflow happens it deletes the oldest bonding information :o

That is really bad. For my application i do not need to store cccds because the Smartphone Apps always newly subscripe when they connect to the device. Is it possible to tell the library not to store cccd's?

if not is it possible to just delete the oldest cccd's instead of the oldest bonding info?

Who is online

Users browsing this forum: No registered users and 197 guests