Closed jrahlf closed 4 months ago
Hi @jrahlf ,
Which smartphone is used ? The procedure here to be followed is that if peripheral has initiated security, the central has to send pairing request. Some phones ( iphones ) do not perform this and simply do not proceed. Can you try switching with Android phone and check ? Have confirmed this behavoiur previously too, where remote device doesn't initiate pairing in case bonding information is deleted on its end.
I am using a samsung A52 android phone (with NRF connect app) and the behaviour is the same if I use the NRF connect application on a desktop PC with a NRF52 dongle.
It seems the problem comes from the esp32 "thinking" that no re-pairing is necessary, because it still has the bonding information for the peer device.
So could be that ble_gap_security_initiate
does not work correctly in this case or some other error is not correctly propagated up.
Edit: There is the GAP event BLE_GAP_EVENT_REPEAT_PAIRING
which sounds like it should fix our problem. We did not catch this event before. Unfortunately the Nimble documentation is partially poor compared to the esp-idf documentation.
I can confirm that reacting to BLE_GAP_EVENT_REPEAT_PAIRING
resolves the problem.
So this was an implementation error on my side and is not a bug in Nimble/esp-idf.
Answers checklist.
IDF version.
v5.1.1
Espressif SoC revision.
ESP32-S3
Operating System used.
Windows
How did you build your project?
Command line with Make
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
ESP32-S3-MINI-1
Power Supply used.
USB
What is the expected behavior?
I expect pairing process to always succeed, if at least one of the two sides have no relevant bond information. When the other side deletes bonding information, a new pairing process should be initiated and GAP event
BLE_GAP_EVENT_PASSKEY_ACTION
should be raised.What is the actual behavior?
Pairing (and all subsequent connections, even after reboots) works as expected. However, if the other side deletes its bond information, re-connecting and re-pairing fails. It works again, when the bond information is also deleted on esp32 side.
ESP32-S3 side: GAP event
BLE_GAP_EVENT_PASSKEY_ACTION
is never raised. This prevents us from generating a passkey and sending it to the other side.Smartphone side: Pairing request comes up. However, the second request to enter the passkey never appears.
Steps to reproduce.
Debug Logs.
More Information.
ble_gap_security_initiate
inside theBLE_GAP_EVENT_CONNECT
event.Our bluetooth SM config:
Nimble and BLE SDK config: