Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.05k stars 3.26k forks source link

ESP32-C6, -C2, -C5, -H2, -P4 are not supported #3078

Open Enelar opened 1 year ago

Enelar commented 1 year ago

What happened?

Unable to flash WLED firmware to ESP32-C6-DevKitC-1 v1.1

To Reproduce Bug

Just try to flash wled firmware to any ESP32-C6 chip

Expected Behavior

I guess we need two versions of firmware

Install Method

Binary from WLED.me

What version of WLED?

WLED_0.14.0-b1

Which microcontroller/board are you seeing the problem on?

Other

Relevant log/trace output

[user@user-nvme esp32]$ sudo esptool.py --no-stub write_flash 0x1000 ./esp32_bootloader_v4.bin 
esptool.py v4.4
Found 2 serial ports
Serial port /dev/ttyS4
Connecting......................................
/dev/ttyS4 failed to connect: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (revision v0.0)
Features: WiFi 6, BT 5
Crystal is 40MHz
MAC: 60:55:f9:f6:a2:bc
Enabling default SPI flash mode...
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00010fff...
Erasing flash...
Took 0.29s to erase flash block
Wrote 65536 bytes at 0x00001000 in 0.6 seconds (900.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
[user@user-nvme esp32]$ sudo esptool.py --no-stub write_flash 0x10000 ./WLED_0.14.0-b1_ESP32.bin 
esptool.py v4.4
Found 2 serial ports
Serial port /dev/ttyS4
Connecting......................................
/dev/ttyS4 failed to connect: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (revision v0.0)
Features: WiFi 6, BT 5
Crystal is 40MHz
MAC: 60:55:f9:f6:a2:bc
Enabling default SPI flash mode...
Configuring flash size...
Unexpected chip id in image. Expected 13 but value was 0. Is this image for a different chip model?

A fatal error occurred: ./WLED_0.14.0-b1_ESP32.bin is not an ESP32-C6 image. Use --force to flash anyway

Anything else?

No response

Code of Conduct

blazoncek commented 1 year ago

Correct observation. There are no plans to support C6 at the time as C3, S2 and S3 are still in early experimental phase, not yet ready for production use. And those are older, more mature chips.

softhack007 commented 1 year ago

Similar for other very brandnew chips: -C2, -C6 , -C61, ESP32-H2, -H4, or ESP32-P4, or -C5.

To put it into some context - market availeability of ESP32-C6 was announced just 3 weeks ago on Jan 6, 2023. Knowing espressif, I bet it will take at least 2 years until stable development environments and open source libraries are ready for any "serious use" on -C6.

We should put it on the backburner, until stable support is availeable from the core libraries we need, for example:

For now, we have enough troubles to make -S3/-S2/-C3 work. So don't expect support for other new models this year.

cherrydev commented 1 year ago

Supporting those newer chips requires updating to the esp-idf v5.1. From what I've seen, the migration documentation is pretty good. A potentially valuable bonus is that some of the newer chips, like the S3, now support DMA over the RMT interface. From my experiments, enabling DMA reduces the CPU usage during a transmission to 0.01% compared to about 18% using PIO. I believe this would also reduce the chances of a rogue interrupt causing a glitch proportionally. I'm not sure if this project bumps up into those limits or has a problem with interrupt-caused glitches, but if so, that might be another reason to consider it.

blazoncek commented 1 year ago

A project as big as WLED needs manpower to support various chips, not just development environment. Any help would be appreciated.

softhack007 commented 1 year ago

Supporting those newer chips requires updating to the esp-idf v5.1

Sorry, but what you propose is not enough for WLED. We have a long list of dependencies, including (but not limited to) arduino-esp32, and NeoPixelBus.

All dependencies (libraries / frameworks that we use with WLED) need to be upgraded to support new chips. For some (like NPB) explicit support must be added by developing new code. it's not just about dropping in a new framework, then be happy.

I fully concur with @blazoncek - any real help (personal commitment for coding & testing) would be much appreciated.


From what I've seen, the migration documentation is pretty good

Edit: Not sure about quality of the migration document, it is definitely "pretty big" . Espressif announces a huge number of "breaking changes", some important APIs were either deprecated, or already replaced with something completely other. It means a lot of work to go from esp-idf 4.4.x to esp-idf 5.1.

cherrydev commented 1 year ago

I'm not a user of WLED but also write LED drivers for ESP32, and I'm not making requests, demands or suggestions that you do anything at all. I was sharing information I'd learned about the new features in ESP-IDFv5 that might be relevant to someone else writing LED driver code on ESP chips, since it offers a significant performance improvement. I was excited by my discovery and thought the people working on this project would be too. Your project is impressive and I hope you find the help you're looking for.

blazoncek commented 1 year ago

Thanks for your willingness to share. Unfortunately we do not write LED (or any other) drivers ourselves but reuse existing @Makuna 's excellent NeoPixelBus.

As such there is (almost) nothing (apart GPIO numbers related stuff) in WLED core code that is chip specific. Libraries as NeoPixelBus or LittleFS and AsyncWebServer are the ones that would need to add support for the above mentioned chips before WLED can support them as well

Though some usermods may use particular HW but those are optional and not all support every chip.

cherrydev commented 1 year ago

I've been over to the NeoPixelBus repo and looking at Makuna/NeoPixelBus#598 it seems they're already looking into it.

aaalek commented 1 month ago

It's been some time since this issue has been created, have there been any advancements with the libraries and such to make the new chips work?

softhack007 commented 1 month ago

It's been some time since this issue has been created, have there been any advancements with the libraries and such to make the new chips work?

Not enough advances, unfortunately - it looks like my old "at least 2 years" estimate was quite accurate..

If NeoPixelBus would be able to utilize the new RMT driver in esp-IDF 5.1.x, we could make an attempt to get WLED running on the -C6. Maybe this will happen during the next year. For other new chips - nothing in sight.

Makuna commented 1 month ago

The new RMT support is in the NeoPixelBus/Core3 branch. Still not configured to use the new boards yet. Still waiting on an updated IDF to fix issues others have seen with it.

oerix commented 1 month ago

The new RMT support is in the NeoPixelBus/Core3 branch. Still not configured to use the new boards yet. Still waiting on an updated IDF to fix issues others have seen with it.

Sorry to be that guy, but is there an rough estimate on how long it will take? I'm looking to invest in to these boards, once support is added. Thanks

softhack007 commented 1 month ago

Sorry to be that guy, but is there an rough estimate on how long it will take? I'm looking to invest in to these boards, once support is added. Thanks

As you are "that guy" you probably guessed the answer 😉 "it's ready when its done".

A bit more seriously - there is no schedule for supporting the -C6 in WLED. Personally I have a fork that compiles for -C6, but there is still a looooong way to go. C6 support might come as "experimental" in 0.16 (may be released in one year), and it will be comparable to the -C3 performance wise.

From experience with other "new boards" like the -S3, I would expect that we'll need around two years from "experimental" to "WLED runs stable on this MCU". The same was true for -S3, where we started "experimental support" in mid 2022.

Same for possible support of the "C61" and P4". OK P4 might even take longer because there is no support from arduino-esp32 or other libraries yet.

So if you're looking at a project or other business case, I'd say don't bet your money on the -C6.

If you need ZigBee, you could be faster by taking a ZigBee "daughter board" (e.g. XBee module) and then you'd program a usermod that communicates with the daughter board.

pafftis commented 1 month ago

I'm a bit confused. You write that the esp32-c3 and esp32-s3 boards, the mini ones, are not supported normally yet. But still, do you have some firmware posted, are these boards supported or not? If yes, do they work well?

DedeHai commented 1 month ago

C3 and S3 are mostly supported now but still not as stable as classic ESP32 and there may still be undiscovered bugs. Not all variations of C3 and S3 boards are supported by the installer or WLED, you may need to edit code or manually install.

amcewen commented 1 month ago

A bit more seriously - there is no schedule for supporting the -C6 in WLED. Personally I have a fork that compiles for -C6, but there is still a looooong way to go. C6 support might come as "experimental" in 0.16 (may be released in one year), and it will be comparable to the -C3 performance wise.

What would be the best way to help out with -C6 support? I should have a few -C6 boards to try out in a couple of weeks, and should be able to contribute some development effort.

blazoncek commented 1 month ago

You write that the esp32-c3 and esp32-s3 boards, the mini ones, are not supported normally yet

Nobody said that. MCUs, C3 and S3 (and S2) are well supported in WLED. The issue is development board implementation by different hardware manufacturers. There are variants that will not play well with officially distributed versions of WLED binaries. In such case you'll need to compile (and figure out compilation parameters) yourself. There are also poorly designed boards out there. No software can help with that.

do you have some firmware posted, are these boards supported or not

Yes we have. Yes and no. Depends on particular development board. See above.

If yes, do they work well?

Depends on what you consider "well". There may be connectivity issues if your WiFi is not perfect, you may see performance lag compared to ESP32, etc. As there are numerous development boards available and not all are made equal we cannot support all of them. Currently working "well" are the following (the ones I tested, @softhack007 and @DedeHai may add theirs):

blazoncek commented 1 month ago

What would be the best way to help out with -C6 support?

Compile until it works. When compile works, figure out GPIO restrictions, RAM restrictions, library restrictions.

DedeHai commented 1 month ago

I can add this to the list

Personally I do not see any benefit in the C6 over C3 for WLED, it just has more GPIOs but so does the S3.

pafftis commented 1 month ago

I'm looking for the smallest board possible to put a levelshifter on and connect it to the strip. My maximum profile width is 3 cm and the depth is 2 cm. Esp32-c3 is ideal - it just fits, all other boards are bigger unfortunately.

blazoncek commented 1 month ago

C3 is far from ideal. But it is a good start. The smallest development board I've seen is Seed Studio XIAO S3.

Depending on what you need, @srg74 may have LilyGo TTGO T-01 C3 compatible board which is 30x20x17 mm including LilyGo board.

softhack007 commented 1 month ago

I'm looking for the smallest board possible to put a levelshifter on and connect it to the strip. My maximum profile width is 3 cm and the depth is 2 cm. Esp32-c3 is ideal - it just fits, all other boards are bigger unfortunately.

The smallest one I know about is the waveshare S3 Zero - 1.8cm x 2.5cm. It needs the esp32s3_4M_qspi buildenv.

softhack007 commented 1 month ago

So here ist my list of boards I have.

plus a "nanoESP32-C6" for experimenting with C6 builds. But that's absolutely experimental.

Please note that some of the boards need a modified platformio.ini buildenv - usually to adjust for flash size, or add -DLOLIN_WIFI_FIX for the small ones that only have a crystal "radio". Also I prefer to have boards with a "real" Serial-to-USB chip, because the "USB-CTC" port is too unreliable for me.

softhack007 commented 1 month ago

Personally I do not see any benefit in the C6 over C3 for WLED, it just has more GPIOs but so does the S3.

@DedeHai @blazoncek I fully agree - running WLED on -C6 is useless at the moment - see below

@amcewen @aaalek some facts as to where we are, and what can be expected from -C6

For the curious, this my own experimental branch for -C6: https://github.com/MoonModules/WLED/pull/138 it compiles, WLED boots up - that's all I can say. And I fully agree with @DedeHai -i see no benefit for WLED over using C3 or S3. So I've put this activity onto the backburner.

Maybe a usermod for ZigBee would be a game-changer - but this usermod is "yet to be created" by the WLED community.

netmindz commented 1 month ago

Yeah I wanted to try the C6 for ZigBee, but it's looking like I might end up writing a usermod to communicate with a C6 from a supported ESP32 before having a WLED build running on the C6 alone

sapkra commented 1 month ago

@netmindz Actually having a similar idea but instead of writing a usermod I will just remote control WLED by simulating a ESP-NOW remote on my C6. I need the C6 because it has 2 TWAI controllers, that I need for my project.

pafftis commented 1 month ago

I'm looking for the smallest board possible to put a levelshifter on and connect it to the strip. My maximum profile width is 3 cm and the depth is 2 cm. Esp32-c3 is ideal - it just fits, all other boards are bigger unfortunately.

The smallest one I know about is the waveshare S3 Zero - 1.8cm x 2.5cm. It needs the esp32s3_4M_qspi buildenv.

Is this particular board currently supported or not?

Контроллер WLED ESP32C3 5-24 В, https://sl.aliexpress.ru/p?key=EAM5rXK

Here on Ali they sell some ready-made boards. Are they bad?

softhack007 commented 1 month ago

The smallest one I know about is the waveshare S3 Zero - 1.8cm x 2.5cm. It needs the esp32s3_4M_qspi buildenv.

Is this particular board currently supported or not?

Please define "supported". I have one on my desk and I can upload WLED 0.15 to it - from the developer environment (VSCode+platformIO). I'm not sure if the web installer has all the necessary files. But you may be lucky. Please remember it is just the ESP32-S3, so you'll need to add level shift and other components for driving your LED strip.

This is an open source community project - you can't get a definite guarantee from us. My suggestion would be to order one, and try it out.

Контроллер WLED ESP32C3 5-24 В, https://sl.aliexpress.ru/p?key=EAM5rXK Here on Ali they sell some ready-made boards. Are they bad?

I have no idea. It's a C3 so its very minimal, and no audio support. Maybe ask the seller how to upload WLED updates (USB preferred).

we are drifting off-topic.

If you have further questions about what kind of board to chose, there is a very friendly WLED community in discord. Please ask for help on discord

pafftis commented 1 month ago

Do I understand correctly that the main problem is the lack of libraries during the firmware of the board? If the firmware is loaded somehow into the esp32-c3, then most likely it will work fine?

blazoncek commented 1 month ago

If the firmware is loaded somehow into the esp32-c3, then most likely it will work fine?

"Somehow" is by using web installer or PIO upload or manually uploading using esptool. As mentioned several times C3, S2 and S3 are fully supported in firmware. Getting correct binary is somehow tricky for S3.

amcewen commented 1 month ago

@softhack007 thanks for sharing your experiences with -C6 and take on where things are build-wise.

I hadn't seen the platformio / espressif politics until now - my other big ESP32 project at the moment is using esp-idf directly (with Arduino as a component). It does seem like -C6 support would only make sense once it's clearer how WLED is going to address things w.r.t. platformio and arduino-esp32 v3.0.x

I'll probably go with a -C3 for now then (the Bluetooth 5.3 support on the -C6 was what was tempting me that way, but was always a longer-term thing-to-play-with :grin:)

As I say, I'm not tracking platformio closely and so might be looking in the wrong place, but it looks like they're still supporting later versions of esp-idf? Would moving to Arduino as a component be a path to migrate to newer versions, and arduino-esp32 v3, while continuing to use platformio?

I've got the move from esp-idf v4 and arduino-esp32 v2 to v5.3 and v3 looming on another project, so will have a bit of experience with that move (with arduino as a component) in a month or so. On a personal note it's a shame to see WiFiClient, etc. deprecated, given that I introduced them when I was in charge of the original Arduino Ethernet library :cry:

damnms commented 2 weeks ago

The c6 would be very nice for me because of those 2 reasons: 1) here is hell with 2.4ghz networks 2) my router can only do 2.4 or 5ghz, with 5ghz i get more speed on the devices but i am forced to use 2.4 because of my esp32

would love to see support, even if its only experimental, for the c6.

softhack007 commented 2 weeks ago

2. with 5ghz i get more speed on the devices but i am forced to use 2.4 because of my esp32

Sorry but -C6 is still 2.4Ghz only. So it would not help in your situation.

damnms commented 2 weeks ago

Thanks, i got tricked by this "Wifi6" and did not see the "2.4ghz". Should be -C5