-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32: enable BLE synchronous events and BLE pairing/boindng #7046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
68238de
to
7503dce
Compare
I just gave a try to your branch, I successfully paired the ble_bonding_peripheral.py example with my iPhone. |
Sorry to add on your plate, I just noticed that if an unhandeled exception occurs in the irq there is a crash and the ESP reboots. |
5b69fa2
to
b459964
Compare
Should be fixed by the latest code in this PR (I force pushed to rebase on the lastest master). |
Nice! If this is ready to be merged, could you remove the "WIP:" prefix and rebase to master? |
It's not ready yet, it needs more testing and will not make it in before the next v1.15 release (which should be in the next few days). |
b459964
to
027d780
Compare
027d780
to
e299e7a
Compare
This is still not 100% reliable, it can lock up the ESP32 (tested with IDF v4.2.2). |
Are those lock-ups random? Specifically I just want to do a scan, to tell my home whether it's me at the front door. |
Yes. Running the BLE multitests in a loop, it will eventually lock the ESP32 so it does not respond to anything but a hard reset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am running into this error on the esp32-c3 board when it tries to write to a notify characteristic and its rebooting.
Error:
GATT
procedure initiated: notify; att_handle=21
assertion "pxQueue->uxItemSize == 0" failed: file "IDF/components/freertos/queue.c", line 1451, function: xQueueSemaphoreTake`
I do not get this error on the esp32 board but that one is having some trouble later in my code trying to connect to the wifi network.
is this still being actively looked into? |
e299e7a
to
8602675
Compare
If the Bluetooth stack runs on another OS thread then synchronous BLE irq callbacks, which block the Bluetooth stack until the callback to Python is complete, must coordinate with the main thread and configure the MicroPython thread-local-state. This commit adds MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK which can be enabled if the system has these requirements. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
8602675
to
5dbb822
Compare
I've run extensive tests with this PR using ESP IDF v4.4.1and it works well. |
@dpgeorge can you share an example code to test ble pairing/bonding? I tried the example code, but it seems like the bonding information is not getting saved in nvs. I created a _FLAG_READ_ENCRYPTED characteristic and I have to repair using passkey after every reboot of esp32. |
…ments Traceback module improvements
I suspect this pull request removes the need for the following note in the Pairing and bonding section of the bluetooth docs:
@dpgeorge if it does I'm happy to open a PR to amend the docs, I'm just awaiting hardware to test for myself and don't want to jump the gun. |
This is currently WIP, but all multitests pass (including GAP pairing/bonding) on esp32 with IDF v4.2.