WLED icon indicating copy to clipboard operation
WLED copied to clipboard

Support for the ESP32-S3

Open kylehovey opened this issue 3 years ago • 13 comments

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!

kylehovey avatar Jul 30 '22 03:07 kylehovey

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.

blazoncek avatar Jul 30 '22 06:07 blazoncek

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:

  • latest arduino-esp32 core is needed. However that one has networking problems - see https://github.com/Aircoookie/WLED/issues/2518

  • Neopixelbus - some improvements for ESP32-S3 were made recently, however not availeable as a release yet. Also the number of LED PINs (channels) is less than ESP32 - only 4 RMT channels, and no I2S channels (due to completely different API from espressif)

  • the board has different GPIO properties (more GPIO, very few GPI (input-only)). Also number of LEDC channels, and maximum led PWM frequencies are different. Needs changes in PinManagerClass.

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

softhack007 avatar Jul 30 '22 16:07 softhack007

@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?

kylehovey avatar Jul 30 '22 17:07 kylehovey

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.

blazoncek avatar Jul 31 '22 05:07 blazoncek

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.

softhack007 avatar Aug 02 '22 21:08 softhack007

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

Jason2866 avatar Aug 06 '22 18:08 Jason2866

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

blazoncek avatar Sep 15 '22 11:09 blazoncek

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 = [email protected]
platform_packages = platformio/[email protected]

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 avatar Sep 17 '22 11:09 softhack007

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.

softhack007 avatar Sep 17 '22 13:09 softhack007

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

blazoncek avatar Sep 18 '22 05:09 blazoncek

@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 avatar Sep 18 '22 12:09 softhack007

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

softhack007 avatar Sep 18 '22 13:09 softhack007

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

Yes.

blazoncek avatar Sep 18 '22 17:09 blazoncek

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.

softhack007 avatar Jan 25 '23 11:01 softhack007

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.

schmarrele avatar Mar 30 '23 11:03 schmarrele

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:

  • audioreactive: no support for analog microphones
  • I2C does not work well (may hang your device)
  • Serial sometimes hangs, then the chip heats up, and you need to erase flash to make it work again
  • bootloader: it can be a nightmare to find the "right" bootloader for each board. "classic esp32" bootloaders will not work.
  • ESP32 supports up to 10 LED outputs, but the max on -S3 is 4 outputs (3 on -S2, 2 on -C3).

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).

softhack007 avatar Mar 30 '23 12:03 softhack007

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.

blazoncek avatar Mar 30 '23 13:03 blazoncek

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

NEVER BUY WEMOS!

githubmoose avatar Apr 26 '23 19:04 githubmoose

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.

softhack007 avatar Apr 27 '23 14:04 softhack007

@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…..

githubmoose avatar Apr 27 '23 19:04 githubmoose