h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
667 stars 138 forks source link

no advertising with ESP32-C6 #645

Closed lyusupov closed 2 weeks ago

lyusupov commented 3 months ago

This is a follow up for https://github.com/h2zero/NimBLE-Arduino/issues/642 ticket.

Branch: https://github.com/h2zero/NimBLE-Arduino/tree/esp32-c6-test most recent Arduino Core 3.0.0-alpha3 NimBLE Server sketch from examples folder

The boot sequence is fine:

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xc24
load:0x4086e610,len:0x2708
load:0x40875728,len:0x594
entry 0x4086c410
Starting NimBLE Server
controller lib commit: [77d09ce]
Advertising Started

However, the ESP32-C6 device is not seen in Nordic tool.



When I build and run the sketch with the same Core but for ESP32-C3 target - everything looks just fine:

h2zero commented 3 months ago

Confirmed, error code 0x0207, BLE_ERR_MEM_CAPACITY when setting the advertisement data.

Will advertise when commenting out the data setting and allow connection but crashes immediately. Looks to be caused by the memory system either not being initialized or missing a step somewhere. I haven't been able to get the debugging to work on the C6 as openocd can't find the config file.

My suspicion is a memory conflict with the controller which is frustratingly closed source so I cannot walk through it.

lyusupov commented 3 months ago

https://github.com/espressif/openocd-esp32/blob/master/tcl/board/esp32c6-builtin.cfg ?

https://github.com/espressif/openocd-esp32/releases

xelprep commented 3 months ago

I am having this same issue as well with the esp32-c6-test branch. I'm using this library with a SparkFun ESP32-C6 Qwiic Pocket Development Board which uses a ESP32-C6 Mini-1 SoC. I'm not much of a C dev and Bluetooth is magic to me but please let me know if there's anything I can do to help here. Happy to test or validate any fixes for this library in Arduino or Platformio if needed.

h2zero commented 2 months ago

This is a pretty major mod to the upstream code and will take time to sort out, I will post here when there are changes pushed for testing.

btsimonh commented 1 month ago

TAS moved to core 3.0.0 for TAS version 14+, and BLE seems broken. I am guessing this could be related?

Jason2866 commented 1 month ago

@btsimonh Not fully correct. Tasmota does use esp-nimble-cpp

h2zero commented 3 weeks ago

Pinned this issue to describe the difficulty in supporting future espressif mcu's. They have internally begun using NimBLE for the controller which causes many conflicts that I will try to describe.

With all of these factors considered, unless espressif or someone with more free time than me can help, I don't think the new devices using NimBLE controllers will ever be supported in a meaningful way.

The only reasonable way to move this forward that I can see is integration into the Arduino core, perhaps as an option, which I may propose. Otherwise, please use esp-nimble-cpp with Arduino as a component instead of this repo if you need support for the esp32c6, esp32c2, esp32h2, and likely all new BLE enabled espressif MCU's 😢

mhaberler commented 3 weeks ago

sorry to hear that.. you've done a phenomemal job!

Jason2866 commented 3 weeks ago

@h2zero One of the many reasons you have listed why we (Tasmota) forked Arduino and IDF and build our own Arduino framework and use your great working esp-nimble-cpp together with our forked Arduino with Tasmota. Works great! Big THX! In our fork only NimBLE is enabled in sdkconfig when compiling the Arduino libs this solves all compatibility issues. All BT and BLE librarys from Arduino are removed. Imho all the currently included BT BLE stuff in Arduino is crap.

I agree with you, as it is now NimBLE-Arduino is dead with Arduino Core > 2.0.x

The esp32-c6 is really a "monster" despite the fact it is only a single core MCU. Works fine with your BLE lib esp-nimble-cpp. Even the "small" esp32-c2 does work nice.

h2zero commented 3 weeks ago

Thanks for the support! I wouldn't say this repo is dead yet though, still works for the older chips 🙂.

Jason2866 commented 3 weeks ago

Sorry don't want to be negative. I wrote dead for core > 2.x Perfectly fine and great when using core 2.x! We used for years with Tasmota. Thx again for your great work done.

Jason2866 commented 3 weeks ago

There is a silver lightning. espressif Arduino guys are working on a way to make it easy possible to configure and compile the Arduino libs for personal needs. This will not be done or ready in near future. But this feature is a todo point on there roadmap.

h2zero commented 3 weeks ago

That would be great if they did that 🙂.

Just to clarify, this repo still works with core 3.x, just not with the newer chips.

The interesting thing is I did get it to work as a scanner but advertising seems impossible.

Jason2866 commented 3 weeks ago

@mhaberler If espressif and Platformio doesn't find an agreement so that Arduino core 3.0.0 is not supported with Platformio, I am considering to do a Platformio Arduino 3.0.0 espressif32 core compatible with esp-nimble-cpp. This build would be more compatible, not like the Tasmota framework which has some more breaking changes.

h2zero commented 3 weeks ago

I've opened an issue upstream here: https://github.com/espressif/arduino-esp32/issues/9835

Please add your thoughts if you would like.

h2zero commented 2 weeks ago

Closing this as C6/H2/C2 and all future BLE Espressif chip support will not be pursued here any further. See #685