Closed vabatta closed 1 year ago
Hi @vabatta , I tried to reproduce the issue on IDF master branch with the bleprph example running with blecent and nRF Connect, but I could not see the issue. I have attached success logs for your reference.
To debug your issue further, can you tell me these things:
I'm about to open a git repository with the code, so you can take a look, because I am having weird behaviors. I've been switching between the NimBLE peripheral example and the BlueDroid GATT security server, and now can't run any of those.
The NimBLE example, no more custom modification, runs but as soon as I connect, the peer device gets disconnected and the esp32 reports as a reason=531.
The Bluedroid BLE GATT security, no custom modification, I can't connect as above.
While if I use the custom code built from the Bluedroid BLE security example, I am able to connect and pair + bond but get disconnected after a few seconds.
Worth mentioning, I've paired and bonded with the device prior to run the clean examples.
I start to think my device has some issues (despite being new).
So from my side:
Any suggestions on anything else I could do, besides the aforementioned points?
This is the behaviour with native espidf for https://github.com/vabatta/espidf-example-nimble-prph.
The weird behaviour is that before I was able to connect with the devices (my laptop - BlueSee, my phone - nRF Connect) but couldn't get the encryption to work. Now as soon as I connect, I just get disconnected with reason 531 as you see in the logs. What happens in between, is that I switched to the GATT Security Server example with BLE BlueDroid and connected with both my devices (and made a bond, accepting pairing popup). Then switched to this example, and this issue happened making me unable to connect with NimBLE anymore.
The only change in SDK is to enable the debug logs for both NimBLE and the app (Log Option), attached below.
This is the behaviour with the native espidf for https://github.com/vabatta/espidf-example-ble50-security.
Same as for NimBLE, as soon as I connect it gets disconnected.
The only change in SDK is to enable the debug logs for each BlueDroid component and the app.
I resolved the issue. The problem was that on my two clients (phone, laptop) a paired device appeared in Bluetooth devices, rejecting all connection when running a different program (the two examples). This device only appeared in the list after I did a reboot on MacOS, it was present on iPhone right away.
@SumeetSingh19 Increasing the stack size of NimBLE Host task stack size, I was able to successfully run the example with encryption.
Thanks!
Answers checklist.
IDF version.
v3.50002.230601
Operating System used.
macOS
How did you build your project?
Other (please specify in More Information)
If you are using Windows, please specify command line type.
None
Development Kit.
T-SIM7080G-S3
Power Supply used.
USB
What is the expected behavior?
When running the default example from https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/nimble/bleprph with encryption enabled on the GATT service (
BLE_GATT_CHR_F_READ_ENC
) I would expect to work and ask me for a passkey as setup in the example.What is the actual behavior?
When requesting access to the characteristic encrypted, the device panics and reboot.
Steps to reproduce.
Debug Logs.
More Information.
I use PlatformIO with esp-idf framework 3.50002.230601 (5.0.2).