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
14.54k stars 3.11k forks source link

Support for the ESP32-S3 #2735

Closed kylehovey closed 1 year ago

kylehovey commented 2 years ago

Is your feature request related to a problem? Please describe. No problem. :)

Describe the solution you'd like I have multiple ESP32 S3 boards and would like to install WLED onto them. How hard would it be to configure the build for the S3?

Describe alternatives you've considered I cloned the codebase and read through the existing configuration. I saw the config for the C3, but saw no config for the S3. I considered trying to add a config for the S3, but my knowledge in configuring the build parameters for this project is meager.

Additional context I'm using the Adafruit QT Py ESP32 S3 board.

I'm happy to provide more context, just let me know. Thank you to all of the contributors for this amazing project!

blazoncek commented 2 years ago

S2, S3 an C3 are not officially supported. There were attempts by creating working environments but since not all libraries WLED uses are compatible with them we cannot guarantee it works.

softhack007 commented 2 years ago

Just for sake of completemess, the same applies for other new ESP32 variants like ESP32-C2, ESP32-C6, ESP32-H2. Not officially supported by WLED.

https://www.espressif.com/en/products/socs

You may find some helpful information in other issue reports related to new SoC hardware: https://github.com/Aircoookie/WLED/issues/966, https://github.com/Aircoookie/WLED/issues/1940, https://github.com/Aircoookie/WLED/issues/2299, https://github.com/Aircoookie/WLED/issues/2596

Some differences compared to ESP32:

Espressif has a technical comparison availeable here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/chip-series-comparison.html#related-documents

kylehovey commented 2 years ago

@blazoncek @softhack007 thank you, I'll go ahead and order some ESP32 boards in the mean time to stay in the supported board set. Out of curiosity, is there documentation on what libraries are not supported or a rough estimate of how much work it would take to support these new boards?

blazoncek commented 2 years ago

No, but you can make one. LittleFS was one of them but latest updates seemed to fix that. Best is to to create an environment in PIO and start testing & debugging. Send your findings to library developers.

softhack007 commented 2 years ago

Update: Actually I just ordered an ESP32-S3, because it seems to be the only one of the new models with a realistic chance to run SoundReactive with many LEDs. And it's a cool device, with new (vector) instructions that might speed up signal processing a lot.

However compiling a working binary for ESP32-S3 will probably become a "long march"... will post updates in case there are news.

Jason2866 commented 2 years ago

Imho the most important part is to do the changed Gpios first. After we had done this in Tasmota all other changes where not that complicated. RMT channels are less for the new MCUs! LittleFS is running stable in Tasmota on all variants. We use heavily. Many libs are updated and do support the C3, S2 and S3 already. Latest Tasmota core is now v2.4.0.1. Can be used with

platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.4.1/platform-espressif32-2.0.4.1.zip
blazoncek commented 1 year ago

Anyone interested may try https://github.com/blazoncek/WLED/tree/esp32-s2 Support includes S2, S3 and C3

EDIT: use PIO ESP32 core 5.1.1

softhack007 commented 1 year ago

I use this in my platformio_override.ini. Select environment esp32s3dev_8MB, compile & upload via USB port.

[esp32s3]
;; generic definitions for all ESP32-S3 boards
build_flags = -g
  -DESP32
  -DARDUINO_ARCH_ESP32
  -DARDUINO_ARCH_ESP32S3
  -DCONFIG_IDF_TARGET_ESP32S3
  -D CONFIG_ASYNC_TCP_USE_WDT=0
  -D CONFIG_LITTLEFS_FOR_IDF_3_2
  -D WLED_WATCHDOG_TIMEOUT=0
  -DCO
lib_deps =
  ${env.lib_deps}
  ;; currently we need the latest NeoPixelBus dev version, because it contains important bugfixes for -S3
  https://github.com/Makuna/NeoPixelBus.git#master @ 2.7.0
  https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
[env:esp32s3dev_8MB]
;; "standard" ESP32-S3 development board, with 8MB FLASH, no PSRAM
board = esp32-s3-devkitc-1
framework = arduino
platform = espressif32@5.1.1
platform_packages = platformio/framework-arduinoespressif32@3.20004.220825

upload_speed = 921600
build_unflags = ${common.build_unflags}
build_flags =  ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=ESP32S3 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
  -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0
  -D LEDPIN=4
  -D STATUSLED=39
  -D BTNPIN=-1
  -D RLYPIN=-1
  -D IRPIN=-1
  -D HW_PIN_SDA=40
  -D HW_PIN_SCL=41
  ;; for audioreactive usermod
  -D USERMOD_AUDIOREACTIVE
  -D UM_AUDIOREACTIVE_USE_NEW_FFT
  -D AUDIOPIN=-1
  -D I2S_SDPIN=16
  -D I2S_CKPIN=17  
  -D I2S_WSPIN=47
  -D ES7243_SDAPIN=8
  -D ES7243_SCLPIN=18

lib_deps = ${esp32s3.lib_deps}
  ;; for audioreactive usermod  
  https://github.com/kosme/arduinoFFT#develop @ 1.9.2

board_build.partitions = tools/WLED_ESP32_8MB.csv
; board_build.flash_mode = dio
board_build.flash_mode = qio
board_build.f_flash = 80000000L
; board_build.f_flash = 120000000L
monitor_filters = esp32_exception_decoder

Edit: added pin definitions that don't conflict with other GPIO, at least on my board.

softhack007 commented 1 year ago

If you want something to play with, this is an experimental build of https://github.com/blazoncek/WLED/tree/esp32-s2 for ESP32-S3 with 8MB FLASH:

  1. esptool erase_flash
  2. (optional) esptool write_flash 0x8000 ESP32S3_WLED_partitions_8M.bin
  3. esptool write_flash 0x0 esp32S3_bootloader_qio_80m_arduino204.bin
  4. esptool write_flash 0x00010000 WLED_esp32s3dev_8MB_experimental_debug_firmware_2209172.bin

Files:

Edit1: included fix for editing files using '/edit' URL. Build 2209172 Edit2: added partitions table bin (optional - see comment below). In many cases, it seems to work without uploading the table.

blazoncek commented 1 year ago

Sometimes it may be necessary to update boot partition table as well. (At offset 0x8000)

softhack007 commented 1 year ago

@blazoncek good point, did not think of that 👍 Is it the "partitions.bin" that I find in the .pio build folder?

btw, my boot log starts like this. Not sure what these extra "load" messages and "SHA-256 comparison failed" means ...

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x9 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x43c
load:0x403c9700,len:0xbec
load:0x403cc700,len:0x2a3c
SHA-256 comparison failed:
Calculated: dcde8d8a4817d9bf5d5d69a7247667264e4e10ac7493514868b61f5aa6146539
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98d8

---WLED 0.14.0-bl0 2209172 INIT---
esp32 v4.4.1-472-gc9140caf8c
arduino-esp32 v2.0.4
CPU:   ESP32-S3 rev.0, 2 core(s), 240MHz.
FLASH: 8MB, Mode 2 (DIO), speed 80MHz.
softhack007 commented 1 year ago

PS: the "file editing bug" is also described here: https://github.com/me-no-dev/ESPAsyncWebServer/issues/1210

blazoncek commented 1 year ago

@blazoncek good point, did not think of that 👍 Is it the "partitions.bin" that I find in the .pio build folder?

Yes.

softhack007 commented 1 year ago

As of today, the best approach for -S3 is still to build & upload your own firmware yourself in platformio. Pre-build .bin files are not working everywhere.

Make sure you don't flash the standard "ESP32 V4 bootloader" from the WLED release page. It will not run, as the -S3 has a different instruction set. You need a special bootloader for -S3. Build & Upload in platformio will take care of that.

Schmarrele commented 1 year ago

To all users of the S3: Are there any major issues with the S3? I would like to use it for a sound reactive project and create a custom board for it.

softhack007 commented 1 year ago

To all users of the S3: Are there any major issues with the S3?

Well, it depends. All new MCUs (-S3/-S2/-C3) are still bleeding edge experimental with WLED.

From technical perspective, the -S3 might be a good choice (compared to -S2 or -C3) as its performance (speed) is similar to "classic ESP32". Also it does support PDM and I2S microphones, while -C3 and -S2 lack PDM support.

Personally I have one -S3 board without PSRAM, and it works ok for me. But I know others have -S3 boards where WLED would not even boot up. Similar stories exist for -S2/-C3.

I can recall a few "limitations" with the new MCUs (not only for -S3), maybe there are more:

I would like to use it for a sound reactive project and create a custom board for it.

As always, it's your call to see if that can be done. Maybe build a prototype, then test it to death. Then decide if what you have is good enough or not. Start small (one unit, do not order hundreds of PCBs at once, unless you don't care about the money), and be prepared that you might find that -S3 will not be good enough for what you want to achieve. The backup plan could be some "classic ESP32" like the pico-D4 (dual core).

blazoncek commented 1 year ago

To all users of the S3: Are there any major issues with the S3?

Next time, please, use WLED forum or Discord for help and support questions.

githubmoose commented 1 year ago

WEMOS - LOLIN S3 PRO: >>>>> NO I2S <<<<<<

NEVER BUY WEMOS!

softhack007 commented 1 year ago

Talking about this one: https://www.wemos.cc/en/latest/s3/s3_pro.html ?

WEMOS - LOLIN S3 PRO: >>>>> NO I2S <<<<<<

Strange ... the -S3 has two I2S units, the only thing that's not possible is I2S-ADC for analog mics or analog line-in. Could be that you'd need to make your own custom build for this unit, to get a firmware with the right memory modes.

Memory modes are a nightmare on -S3, and firmware for one specific mode will not run on other boards that require a different mode.

githubmoose commented 1 year ago

@Softhack007: that is the most frustrating part, I know they áre in but not routed to the outside. One can indeed create some ‘pseudo-I2S out’ in fw but I have enough other challenges to spend my time on. Having said that, there are currently things going on to the east of where I live that make things like this again quite insignificant…..

Fuxy22 commented 2 months ago

Dammit! Just got a "Arduino Nano ESP32" with a ESP32-S3 thinking any ESP32 chip would work... any plans to support this in the future? I foresee this becoming a really popular chip/pitfall.

Well such is life... i'l go bash my head against a wall then...

blazoncek commented 2 months ago

The S3 is supported as far as WLED code goes. You may need to fiddle with flashing process, but that's all. @Fuxy22

As for I2S, it has 2, but Espressif decided to change API and it is incompatible with NeoPixelBus (as of this writing), so WLED can only use 4 RMT channels for LED output. Audio works though, kind of.