Arduino support for ESP32-S2 chips

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Arduino support for ESP32-S2 chips

Postby ullixesp » Sat Jul 17, 2021 10:32 am

I have an ESP32-S2-Saola Dev Kit board with an `ESPRESSIF ESP32-S2-WROOM-I` module on it.

Under PlatformIO I can find the board name 'Espressif ESP32-S2-Saola-1' to be used as 'board = esp32-s2-saola-1'. But when compiling this message comes up:
Error: This board doesn't support arduino framework!
Too bad. I guess that the chip ESP32-S2 is not supported at all, no matter what the board?

Is there a newer version for arduino framework, which does support it? Is it even under consideration for extending the arduino framework to this chip?

lbernstone
Posts: 620
Joined: Mon Jul 22, 2019 3:20 pm

Re: Arduino support for ESP32-S2 chips

Postby lbernstone » Sun Jul 18, 2021 3:26 pm

https://github.com/espressif/arduino-es ... c3-support
This is already available in Arduino IDE. There are still many issues. The platform.io group is currently working on a v2.0-based package, but there are a number of issues to resolve. You can follow their progress at https://github.com/platformio/platform-espressif32

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Mon Jul 19, 2021 8:39 am

Thanks for the info.

Using the development version https://github.com/platformio/platform- ... nt-version works with the "classic" ESP32, but even when combined with the proper S2 board name, compiling fails. My settings in platformio.ini :

Code: Select all

[env:esp32dev]
; platform = espressif32
; board = esp32dev

platform = https://github.com/platformio/platform-espressif32.git
board = esp32-s2-saola-1
Anything more I can do except waiting?

lbernstone
Posts: 620
Joined: Mon Jul 22, 2019 3:20 pm

Re: Arduino support for ESP32-S2 chips

Postby lbernstone » Mon Jul 19, 2021 1:17 pm

Sure, you can use Arduino IDE. Or, there are lots of ways that you can do the integration work necessary to get everything properly situated for platform.io (or esp-idf). If you want someone else to do that work for you, then you have to wait for them to do it.

chegewara
Posts: 2173
Joined: Wed Jun 14, 2017 9:00 pm

Re: Arduino support for ESP32-S2 chips

Postby chegewara » Tue Jul 20, 2021 2:24 pm

This may works:

Code: Select all

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

platform_packages = 
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
  platformio/tool-esptoolpy @ ~1.30100

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Wed Jul 21, 2021 9:20 am

Unfortunately, it does not work, neither for the ESP32 classic, nor for the S2.

For both chips the compile ended with the same 'not found' error (to be sure, I cleaned PIO before each compile):

Code: Select all

...
Linking .pio/build/esp32dev/firmware.elf
/home/ullix/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: Datei oder Verzeichnis nicht gefunden
/home/ullix/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
Not surprisingly, when 'framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master' was commented out, it compiled fine for the classic chip, but not for the S2 ('A fatal error occurred: This chip is ESP32-S2 not ESP32. Wrong --chip argument?')

chegewara
Posts: 2173
Joined: Wed Jun 14, 2017 9:00 pm

Re: Arduino support for ESP32-S2 chips

Postby chegewara » Thu Jul 22, 2021 5:38 am

Thats strange, because i can build PIO project for S2 (part of logs removed):

Code: Select all

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 0.0.0+sha.21947eb 
 - tool-esptoolpy 1.30100.210531 (3.1.0) 
 - toolchain-esp32s2ulp 1.22851.191205 (2.28.51) 
 - toolchain-xtensa32s2 1.80400.210211 (8.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP32TinyUSB> 1.2.0+sha.a81de14
|   |-- <FS> 2.0.0
|   |-- <SD> 2.0.0
|   |   |-- <FS> 2.0.0
|   |   |-- <SPI> 2.0.0
|   |-- <SPI> 2.0.0
Building in release mode
Compiling .pio/build/esp32dev/src/main.cpp.o
Generating partitions .pio/build/esp32dev/partitions.bin

.pio/libdeps/esp32dev/ESP32TinyUSB/src/classes/midi/midiusb.cpp: In function 'void tud_midi_rx_cb(uint8_t)':
.pio/libdeps/esp32dev/ESP32TinyUSB/src/classes/midi/midiusb.cpp:197:29: warning: 'bool tud_midi_receive(uint8_t*)' is deprecated: tud_midi_receive() is renamed to tud_midi_packet_read() [-Wdeprecated-declarations]
     if(tud_midi_receive(_mid)) {
                             ^
In file included from .pio/libdeps/esp32dev/ESP32TinyUSB/src/classes/midi/midiusb.cpp:5:
/home/chegewara/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/midi/midi_device.h:113:20: note: declared here
 static inline bool tud_midi_receive(uint8_t packet[4])
                    ^~~~~~~~~~~~~~~~
.pio/libdeps/esp32dev/ESP32TinyUSB/src/classes/midi/midiusb.cpp:197:29: warning: 'bool tud_midi_receive(uint8_t*)' is deprecated: tud_midi_receive() is renamed to tud_midi_packet_read() [-Wdeprecated-declarations]
     if(tud_midi_receive(_mid)) {
                             ^
In file included from .pio/libdeps/esp32dev/ESP32TinyUSB/src/classes/midi/midiusb.cpp:5:
/home/chegewara/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/midi/midi_device.h:113:20: note: declared here
 static inline bool tud_midi_receive(uint8_t packet[4])
                    ^~~~~~~~~~~~~~~~

Linking .pio/build/esp32dev/firmware.elf
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13432 bytes from 327680 bytes)
Flash: [==        ]  17.0% (used 223162 bytes from 1310720 bytes)
Building .pio/build/esp32dev/firmware.bin
esptool.py v3.1
Merged 2 ELF sections
EDIT Sorry, there is missing 1 line in that config:

Code: Select all

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_build.mcu = esp32s2

platform_packages = 
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#2.0.0-alpha1
  platformio/tool-esptoolpy @ ~1.30100

For some reason i also have similar issue with current master, so new config is with 2.0.0-alpha1

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Thu Jul 22, 2021 11:45 am

Well, partial success.
Using your config as provided, I could compile and upload to my S2. WiFi works, webserver works, web pages appear as they should. File system FFat could be mounted, and NVS initialized.

However, I am unable to save any file to the FFat file system, and I am unable to store any values into the NVS! Both remain empty. No error messages, except for things like 'open("file")' failed.

Are FFat and NVS not supported (yet)?

The code I am using for these tests can be downloaded here in both a PlatformIO and Arduino version: https://github.com/ullix/ESP32-Flash-Crash

ullixesp
Posts: 83
Joined: Wed Oct 16, 2019 9:34 am
Location: Germany

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Thu Jul 22, 2021 12:08 pm

Tested file systems SPIFFS and LittleFS also: same or worse problems:

Code: Select all

SPIFFS:
14:01:07.629 > [  1869][I][myfilesystem.cpp:13] initFileSystem(): Init FileSystem
14:01:07.640 > [  1870][I][myfilesystem.cpp:170] formatFileSystem():    Formatting File System 'SPIFFS'   
14:01:07.646 > [  1872][E][esp32-hal-misc.c:125] disableCore0WDT(): Failed to remove Core 0 IDLE task from WDT
14:01:22.699 > E (32603) SPIFFS: mount failed, -10025
14:01:22.699 > [ 16934][E][SPIFFS.cpp:114] format(): Formatting SPIFFS failed! Error: -1
14:01:22.705 > [ 16935][I][myfilesystem.cpp:195] formatFileSystem():    FAILURE
14:01:37.810 > [ 32040][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1
Perpetual crashes with LittleFS:

Code: Select all

LittleFS
13:57:19.936 > [  1873][I][myfilesystem.cpp:13] initFileSystem(): Init FileSystem
13:57:19.952 > [  1875][I][myfilesystem.cpp:171] formatFileSystem():    Formatting File System 'LittleFS'   
13:57:19.958 > [  1883][E][esp32-hal-misc.c:125] disableCore0WDT(): Failed to remove Core 0 IDLE task from WDT
13:57:19.969 > assertion "partition_label" failed: file ".pio/libdeps/esp32dev/LittleFS_esp32/src/esp_littlefs.c", line 275, function: esp_littlefs_format
13:57:19.980 > 
13:57:19.980 > abort() was called at PC 0x40019fbe on core 0


Who is online

Users browsing this forum: ESP_Sprite and 80 guests