-
-
Notifications
You must be signed in to change notification settings - Fork 172
[Feature request] Support for ESP32-C6 #642
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
Comments
I wish this were possible but it is sadly not. Support for C6 and H2 is hindered by the way the Arduino core is configured when the bluetooth libs are built as bluedroid is enabled there and the new IDF version uses the same symbols now for the controller interface and conflicts when linked. The only way to support these 2 chips is either by using esp-idf and Arduino as a component (recommended) or using the Arduino lib builder to disable bluedroid and nimble, controller only config. |
Hmm, i lied... kinda. Here is a branch that compiles, no idea if it will work, probably not due to mixing of functions but give it a go and let me know. |
Thank you for development of the C6 branch !
Compilation of
Duplicate of |
That's odd, it seemed to link fine with the latest Arduino commit in platformio. |
To reproduce, please, use official Arduino CLI as follows
|
Actually I modified platformio to be able to build from the latest commit on master branch. Thanks though, I'll try that and see if I can reproduce. |
Reproduced and fixed, please do a reset --hard on the branch and try again. I'm not expecting it to work but worth a shot. Sadly I do not have one of these devices to test on. |
Thank you so much !
Sure! It enters into boot loop soon after
Will try to decode the backtrace later.... |
lol, not surprised at all. Mixing code is what's happening here. The real fix for this will be to rename A LOT of functions and hope that's enough. |
I've just pushed an update that renames all the conflicting symbols. Please do a |
A little bit different PC and SP, but the fault is of the same type
|
Thanks,that's too bad. Definitely need a backtrace to progress. I'll try to get my hands on a board to test with soon. |
My ESP32-C6 board does not have USB/JTAG (GPIO12/13) pins exposed, so capturing a backtrace with assistance of OpenOCD will be problematic for a while... I found out that ESP32-C3 build of the same sketch ( NimBLE_Client.ino ) with Arduino Core 3.0.0-alpha3 does also produce a binary that fails to boot properly.
So if you have ESP32-C3 readily available - you can try it first Use the following CLI instruction to build for C3:
|
Interesting, thanks! Looks like the queue is not initialized for these boards... I'll look into that |
@lyusupov,I just pushed a few commits to this, seems to work for me 😄 |
Thank you! Yes, it looks good to me as well, both with ESP32-C3 and ESP32-C6:
I suppose that your recent development efforts are sufficient to consider this GitHub ticket as 'complete'. If me or someone else will face up with another ESP32-C6 NimBLE issue - we should open a new ticket. |
Sounds good, thanks! Going to need to test this for some time before merging into master. |
Hello @h2zero , please accept my apology in advance for asking this in this thread, but I need some guidance/direction. I have a DFRobot ESP32-C6 board, which I would like to use to send sensor data over BLE to a mobile application. Let me give you a short background.. I do my hardest to learn and figure out things myself, (where possible), but Im certainly still a novice when it comes to coding. As you can see, I might have complete gone off in the wrong direction. If this is something that you could help me with, I would be grateful and if there is another way we could communicate, other than me spamming this thread, please let me know. Thank you!! |
Hello @NeilvdM, good for you for trying to sort this out and learn. You've gone in the right direction, it's just a little steeper of a learning curve 😄 The C6 is not able to be supported with this repo, but instead esp-nimble-cpp needs to be used, which means you will need to use esp-idf and Arduino as a component of that to get the Arduino interfaces. Or alternatively we can use a for of the Arduino core that @Jason2866 has created for use in platformio. I would suggest starting with the core that tasmota uses: https://github.com/Jason2866/platform-espressif32 follow the readme to setup the environment. Let me know how you get on with that and I'll try to help further. |
That was where I ended up before contacting you. Working in Platform.io is all greek to me, (at least it feels that way at the moment), with Arduino IDE Im at least familiar with, but Im sure the 2 basically works the same. So I followed the instructions, created a new project and added
Then I got an error about not having an environment, so looking at other sketches, I tried by changing it to:
this ran with no errors, except "UserSideException: Please install Git client from https://git-scm.com/downloads" I tried coping some sketch examples from Arduino and compile them in Platform.io, but got parsing errors I'll be completely honest, from here Im in the dark, I have no idea which direction to go, at least in Arduino I feel like I have a candlelight and can guide myself, bumping my head ever so often. I have a question (one of 100's :) ) ... Could I not just use the iBeacon sketch as my base, then after many searches figure out to replace the number sequence it is broadcasting, with the readings from the sensors? if you have another way that I can contact you, that would be great. |
You're getting close 🙂! As for your question, yes you could use that ibeacon example and work from there, that will use the default BLE library in the official arduino core. This library is designed to be a lighter weight and more capable/stable replacement for that. What you should do depends on your needs. |
obviously, the lighter weight and stability will be important for me .. so then what you are telling me is that I need to learn VSCode. Then that brings me to these points:
is this correct? Then start playing with the example sketches? Would you be willing to share an email address that I can contact you on? (thats if you dont mind) THANK YOU FOR THE INFO YOU HAVE SHARED SO FAR |
You'll certainly need to learn to use VScode and platformio for this, you'll be glad you did later 😄 This is what you need:
Then you can use the examples from here, you might have to add I prefer to keep the communication here so others can benefit. |
ok, so to see if I can get the basics working, I configured my ini file as such:
Then in the main.ccp I followed your beginner example to create a BLE server
But this is the error that Im getting now:
At this rate, it feels like Im never gonna get any where |
@NeilvdM I suggest you consider the pioarduino fork which I have nicely working with NImble-Arduino master here start here: espressif/arduino-esp32#10039 - maybe check the discord channel |
@avaksru Fully working is using h2zero IDF NimBLE and compile it with Arduino as a component of IDF. See this example https://github.com/pioarduino/platform-espressif32/tree/Arduino/IDF53/examples/espidf-arduino-h2zero-BLE_scan |
Same as @avaksru with arduino-esp32 v3.1.0 @Jason2866 the link https://github.com/pioarduino/platform-espressif32/tree/Arduino/IDF53/examples/espidf-arduino-h2zero-BLE_scan is dead |
@pierreyves258 Yes, it is merged in branch master https://github.com/pioarduino/platform-espressif32/tree/main/examples/espidf-arduino-h2zero-BLE_scan |
Nice to see they're making changes to benefit more people. I was starting to work on re-writing the driver to make this repo work with the c6, I guess that won't be needed now. |
Hello, I would like to implement NimBLE-Arduino in my project, but I am using the ESP32-C6 and would like to know if it is already compatible with this chip or what alternatives I have. Thank you in advance. |
@DennisMart It is in the works espressif/arduino-esp32#10937 Alternatively you can build Arduino as an component of IDF and use the h2zero IDF lib. |
@mhaberler @pierreyves258 @lyusupov @troglodisme @NeilvdM |
build
gives a failure:
|
Weird, it builds perfectly in the CI, wonder what could be different? |
Really strange, did a implementation test with pioarduino and it compiles without issues. |
@Jason2866 I am also using pioarduino in the CI builds without issue, not sure what is happening in this case, but the fix is easy enough. |
Ok. Looks like it was my local issue.
in my sketch. When I got rid of |
Cool, thanks! I actually decided to rename that struct to ensure the correct functions are used and prevent this sort of thing in the future. |
tried s3, c3, c6 BLE5-extended ad examples - no issues so far btw debugging c6 now works great with this openocd and pioarduino 3.2 |
The branch has 1.6 index while mainline NimBLE is 2.x.x what does 1.6 index mean ? |
It's a reference to the underlying NimBLE version: https://github.com/espressif/esp-nimble |
@h2zero An Arduino (Core 3.2.0) sketch that I build with NimBLE and ArduinoBLE for ESP32-C6 gives
How much of debug stuff is still enabled in the |
Unfortunately that is the punishment we take for using the stl here more than anything to do with NimBLE. In fact I'd bet that if you just used the C lib without the C++ wrapper it would be smaller than any other library. Some things to do are make sure all logs are disabled and make sure you are disabling any BLE roles that you don't use, sever or client etc. |
I've re-built and checked the ESP32-C6 binary sizes again today and got
Quite good result for NimBLE, I guess. Since the ESP32-C6 feature is no longer an issue - I am closing this ticket now. |
Glad it's only about 30k difference, if you use mbedtls for anything in your code (AWS, HTTPS?) then you can get it a little smaller by enabling the mbedtls override for tinycrypt. |
@h2zero mbedtls is always used in Arduino Core when wifi is used. The needed ciphers for WPA2 / WPA3 handshake are "powered" by mbedtls. So using mbedtls should be a default when wifi is used. |
Yeah I suppose that is true, though wifi isn't always used either so it's a user option. NimBLE-Arduino/src/nimconfig.h Line 177 in bdeb084
|
ESP32-C6 support is available in Arduino Core ESP32 since version 3.x-alpha
An attempt to build the
NimBLE_Client.ino
sketch from NimBLE-1.4.1 'examples' area witharduino-cli
for a ESP32-C6 devkit target gives a failure:The text was updated successfully, but these errors were encountered: