-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add BLE GATT server support to espressif port #5926
Comments
Everything else should raise NotImplementedError. First step in #5926
Services and characteristics still won't work. Progress on #5926
This allows you to connect to GATT services on the other device. It also adds connection initiation (GAP central). More progress on #5926
This is about half done. The two remaining large pieces are adding GATT server support and bonding support. Unfortunately GATT server support probably needs NimBLE modifications to allow for adding servers, characteristics and descriptors after things are running. The SoftDevice can do this so we've assumed it in our APIs ability to just |
@tannewt - I'm a general programmer (not a BLE expert), but I might be interested in helping with this if it would be useful |
It sounds as though the current problems with BLE service support relate to dynamically adding services / characteristics / descriptors after things are running. IIRC, a similar limitation exists for USB HID devices. The solution for USB was to require things to be setup within Could a similar requirement to setup BLE in |
Unfortunately, BLE is implemented differently than USB. BLE is reset after every VM run and relies on BLE reconnection. USB starts and connects once. The best way forward is to enhance the IDF's BLE library to support changing services like the BLE spec allows. |
Bummer! Still, I appreciate your responding. I now have five ESP32-S3 devices, which I have really wanted to used with CircuitPython for BLE HID (mouse, keyboard, joystick, etc.). I did not realize until a few days ago that it wouldn't work for my needs. I'll be watching this issue, although sad because of the likely long timeline involved. Keep up the great work! I'm overall a very happy customer of Adafruit hardware! |
Yup, I was bummed too. I started bleio implementation thinking it'd be straight forward and it wasn't. Hopefully we can circle back to it after 9.0 is out. |
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/bluetooth/esp_gatts.html Just posting for reference. Maybe we can list down what is missing, so work on IDF's side can start. |
That doc is referring to the bluedroid BLE stack. It does look like it can do dynamic services. Unfortunately, we started the existing BLE impl based on Nimble with the hope of standardizing ports to it for BLE host. So, switching to bluedroid could make this work. It isn't a simple task though. |
Looks like dynamic service support has been added to ESP nimble and is in IDF 5.1.2: espressif/esp-idf@94ad8f1 |
@tannewt I saw you managed to get IDF 5.1.2 into CircuitPython 9.0.0-alpha.6 🙇 so I went to give it a try and spotted that for the Seeed Xiao ESP32C3, it's now missing the _bleio module that was previously in 8.2.9 and is needed for BLE . Is there anything I can do, I'm happy to raise a PR, but not sure if it's as simple as reverting this change, or there's more to it than that? |
I did but I haven't improved bleio on ESP to use it.
Yeah, there's more work to do than just enabling it. It will take code space so it may not be re-enabled on boards with limited flash space. |
Don't want to rush this, but I'm wondering if there's anything I can do as a workaround to get bluetooth working on my esp32-s3 in any capacity. I'm an esp32 and circuitpython noob, so if I'm missing something obvious or if it cannot currently be done with circuitpython please let me know. Ideally, I want to set up my esp32 to act as a BLE peripheral, but can't seem to get that working due to this missing bleio library. |
@nrgbistro There is no workaround. Now that ESP-IDF 5.1.2 has added dynamic service support to the nimble base, we are no longer blocked in terms of implementation. But we still have to write quite a bit of code. |
Understood, thanks for the quick update. |
Has anyone written the implementation? |
No but its near the top of my list. I'm updating CP to IDF 5.2.1 before getting back to BLE. |
Second, I've been watching this thread for a while. Would happily contribute the cost of a well-earned beverage or two once it's there. |
Wow, that's a huge change. Thank you for keeping this alive, and the (obviously huge) effort to make ESP32 boards have full BLE capability in CircuitPython! I know it's not ready yet, but it's not too early to say "THANK YOU!" |
:-) Feel free to test it out. It isn't perfect but testing would be helpful. Note, it doesn't have bonding and pairing support so HID may not fully work with another device. |
Ok ... Per your PR comments, seems only ESP32-S3 is likely to work yet? A couple of questions:
Looking forward to pointers to the early alpha build artifacts! |
I'll make this a top priority tomorrow when I have brain space to dive back into it. So, the PR artifacts will be the place.
PR comments are probably best. At some point I'll want to merge it even if it isn't perfect too.
PR is probably the best place too.
Thanks! Will hopefully get the CI going tomorrow. |
PR Artifacts are here: https://github.com/adafruit/circuitpython/actions/runs/9103419532 Check the PR for the latest CI run too. |
Ok ... dipping my toes into this uncharted space. Seems to at least boot on the ESP32-S3 Reverse TFT. No code loaded yet, and I have to re-acquaint myself with CircuitPython again. I hope to make steady (if slow) progress. Will update on the PR when I hit roadblocks or success milestones. |
ESP32, ESP32-S3 and ESP32-C3 can all do BLE.
Let's add
_bleio
support on top of NimBLE that the IDF uses for BLE.Once it's added, we can then support the BLE workflow on these ESP chips.
The text was updated successfully, but these errors were encountered: