Skip to content
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

ESP32 Arduino BLE Refactoring #9878

Open
1 task done
SuGlider opened this issue Jun 17, 2024 · 13 comments
Open
1 task done

ESP32 Arduino BLE Refactoring #9878

SuGlider opened this issue Jun 17, 2024 · 13 comments
Assignees
Labels
Area: BLE Issues related to BLE Type: Feature request Feature request for Arduino ESP32
Milestone

Comments

@SuGlider
Copy link
Collaborator

Related area

BLE refactoring using NimBLE

Hardware specification

Any

Is your feature request related to a problem?

This is part of an effort to improve ESP32 Arduino.

Describe the solution you'd like

Starting point for a BLE refactoring Plan.
Targets:

  • Move from Blueroid to NimBLE library.
  • Redesign the Arduino BLE interface to make it more Arduino API alike.

Suggestion:

Examples:

Describe alternatives you've considered

None.

Additional context

None.

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@SuGlider SuGlider added the Type: Feature request Feature request for Arduino ESP32 label Jun 17, 2024
@h2zero
Copy link
Contributor

h2zero commented Jun 17, 2024

ArduinoBLE already supports esp32. Only change to do here would be to configure BLE to be controller only and import the ArduinoBLE library, no Bluedroid or NimBLE required.

@SuGlider
Copy link
Collaborator Author

ArduinoBLE already supports esp32. Only change to do here would be to configure BLE to be controller only and import the ArduinoBLE library, no Bluedroid or NimBLE required.

Yes, it supports the ESP32-S3 module from the UNO R4 board and the boards that use Nina-W102 that has an ESP32 module.
But those are used as WiFi/Bluetooth modem using AT commands.

The idea here is to implement the ArduinoBLE API as part of ESP32 Arduino BLE Library as direct ESP-IDF calls, instead of using a UART to send and receive AT commands.

@h2zero
Copy link
Contributor

h2zero commented Jun 17, 2024

It also has the VHCI driver here: https://github.com/arduino-libraries/ArduinoBLE/blob/98ff550988912ffbaeb1d877970e9e05f1de0599/src/utility/HCIVirtualTransport.cpp#L138

Added in arduino-libraries/ArduinoBLE#252

@SuGlider
Copy link
Collaborator Author

@h2zero - Thanks for the information!

It also has the VHCI driver here: https://github.com/arduino-libraries/ArduinoBLE/blob/98ff550988912ffbaeb1d877970e9e05f1de0599/src/utility/HCIVirtualTransport.cpp#L138

I see, this is way to implement it with internal channel AT commands.
I'll try it.

Added in [arduino-libraries/ArduinoBLE#252](arduino-libraries/ArduinoBLE#25

I like the table showing resource utilization after compiling the different libraries' respective scan example!

@VojtechBartoska VojtechBartoska added this to the 3.1.0 milestone Jun 24, 2024
@VojtechBartoska VojtechBartoska added the Area: BLE Issues related to BLE label Jun 24, 2024
@VojtechBartoska
Copy link
Contributor

related discussion: #9836

@VojtechBartoska
Copy link
Contributor

Hello @h2zero,

I am contacting you as a Project Manager of Arduino ESP32 project. Our Team have been recently investigating the refactoring of BLE in our core and we also investigated your NimBle-Arduino library.

As you know, we need to keep working solution also for Classic BT on ESP32 platform, but in general in case of implementing e.g. Matter, moving to NimBLE based implementation makes sense.

As you proposed before, we would like to open this approach of reusing parts of your library in the core and we would like to ask if it is okay for you and also if you would like to help us with your contribution?

We can share more details about our ideas of implementation and we will be more than happy to hear your thoughts regarding it. Rodrigo (@SuGlider) has his hands on this and has some suggestions already for BLE refactoting.

Thanks in advance

@h2zero
Copy link
Contributor

h2zero commented Sep 24, 2024

@VojtechBartoska sure, let's chat about it.

@SuGlider
Copy link
Collaborator Author

@h2zero - I have to finish the Arduino Matter Library first and then we will talk here about the nimBLE refactoring. Thank you!

@h2zero
Copy link
Contributor

h2zero commented Feb 6, 2025

So much for talking about this I guess lol.

@lucasssvaz
Copy link
Collaborator

Hi @h2zero. It was an communication issue. In the future we will be more careful and improve in situations like this. Before moving forward with the PR is there anywhere we can chat (like Discord or something similar) to discuss it and align our views ? If there is anything we can do to help you, let us know!

@SuGlider
Copy link
Collaborator Author

SuGlider commented Feb 6, 2025

So much for talking about this I guess lol.

@h2zero, Thanks for the support!

@lucasssvaz is now in charge of this migration project. The general idea is to keep both, Bluedroid and NimBLE codes, guarded by #ifdef NIMBLE | BLUEDROID, within the Arduino Layers in the ESP32 Arduino Core for the 3.2 version.

NimBLE would be the default option to be compiled within the Core static libraries and Bluedroid could be activated by sdkconfig setting when the Arduino project is built as an IDF Component.

At this point, we are analyzing the back compatibility and how it is compiled, and also running, based on all the Bluedroid current examples from ESP32 Arduino Library. Therefore, we are in early stages.

Please feel free to participate directly here or with the open PR.
Your feedback is very welcome! Let us know what you think about it.

@h2zero
Copy link
Contributor

h2zero commented Feb 7, 2025

Thanks @lucasssvaz and @SuGlider, I have some thoughts on this and we should definitely discuss it. You can reach me via the email in my profile and I am also on discord with the same username as here.

@lucasssvaz
Copy link
Collaborator

lucasssvaz commented Feb 7, 2025

@h2zero Sent you an email. Thanks!

@lucasssvaz lucasssvaz moved this from In Progress to Todo in Arduino ESP32 Core Project Roadmap Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BLE Issues related to BLE Type: Feature request Feature request for Arduino ESP32
Projects
Development

No branches or pull requests

6 participants