Arduino support for ESP32-S2 chips

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

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Fri Jul 23, 2021 8:44 am

... and the failure of all types of file systems is also a known bug?


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

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Sat Jul 24, 2021 9:18 am

That little `qio` is quite relevant!

Simply adding that statement to otherwise your config makes now my complete pio.ini:

Code: Select all

[platformio]
description = Download big files with JavaScript

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_build.mcu = esp32s2
board_build.flash_mode = qio
platform_packages =
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#2.0.0-alpha1
  platformio/tool-esptoolpy @ ~1.30100

lib_deps =
	me-no-dev/ESP Async WebServer@^1.2.3
	powerbroker2/SafeString@^4.1.5
	lorol/LittleFS_esp32@^1.0.6

monitor_speed = 115200
monitor_filters =
	log2file
	time
	default

upload_speed = 921600
upload_port = /dev/ttyUSB0
build_flags = -D CORE_DEBUG_LEVEL=5
board_build.partitions = partitions.csv
and now all three file systems FFat, SPIFFS, and LittleFS do work! And also NVS is working! All can be created, mounted, read from, written to as one would expect.

However:

My motivation to test the S2 comes from the fact that the ESP32-"classic" has a major, major problem when downloading files >150k! Files of around 300k present the biggest problem! In easily up to 50% of any download attempt the Watch-Dog-Timer triggers (on 'async_tcp'), resulting in aborting.

The severity seems to depend on the device and the flash used (i.e. flash manufacturer dependent). I had concluded that the ESP32-"classic" has either a hardware defect, or a software defect, or both, but certainly isn't fit for commercial use when big files are involved.

Unfortunately, in this aspect the ESP32-S2, with the present code, is even worse! Here the failures are at 95% if not higher!

Opening the Network tab on any browser's toolbox shows that from a 300k file only 100k ... 150k are downloaded, then the ESP crashes, and eventually the browser times out.

This is discussed in depth here: https://github.com/me-no-dev/ESPAsyncWe ... issues/984
and my code to test this is here: 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 » Sun Jul 25, 2021 8:58 am

A bit strange:

My previous post shows that I get the S2 chip to work properly with any File system and NVS by defining 'board_build.flash_mode = qio'.

But running one of the IDF example scripts on the very same device gives me:

Code: Select all

I (28) boot.esp32s2: SPI Speed      : 40MHz
I (33) boot.esp32s2: SPI Mode       : DIO
I (38) boot.esp32s2: SPI Flash Size : 4MB
So, IDF thinks 'DIO' is correct, and not 'qio'.

When I attempt to force 'qio' by inserting into platformio.ini the line 'board_build.flash_mode = qio' it compiles and executes ok. However, my forcing seems to be ignored, as the debug output is the very same as above, namely 'DIO'!

If we trust the IDF output as correct, then it would mean that the Arduino framework has got this flash stuff in reverse to what it really is?

dimake
Posts: 3
Joined: Wed Jul 21, 2021 10:09 am

Re: Arduino support for ESP32-S2 chips

Postby dimake » Mon Jul 26, 2021 6:19 am

I struggle with similar issues as you and played with DIO/QIO as well.
When you define in platformio.ini flash_mode as QIO it compiles and works (at least somehow), if I compile with DIO then my LittleFS or SPIFFS can't be mounted.
So, I compile with QIO (until a stable framework release).

On the other hand, my flash doesn't support QIO mode (quad IO). And VS Code automatically flashes with DIO parameter.
Just for fun, I tried to flash manually with QIO param and, surprise surprise, it doesn't work.

dimake
Posts: 3
Joined: Wed Jul 21, 2021 10:09 am

Re: Arduino support for ESP32-S2 chips

Postby dimake » Tue Jul 27, 2021 6:02 am

In a recent days a new version of PlatformIO/Espressif32 was released:

Code: Select all

Updating platformio/espressif32               3.3.0                              [Updating to 3.3.1]
Platform Manager: Installing platformio/espressif32 @ 3.3.1
Unpacking  [####################################]  100%
Platform Manager: espressif32 @ 3.3.1 has been installed!
They fixed QIO/DIO bug. So I compiled again with DIO and I'm back to the previous step

Code: Select all

E (738) SPIFFS: mount failed, -10025
[126773][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1
[126779][E][vfs_api.cpp:22] open(): File system is not mounted 
:x :x :x

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

Re: Arduino support for ESP32-S2 chips

Postby ullixesp » Wed Jul 28, 2021 9:06 am

Well, now nothing works :-(

I also upgraded platform espressif32 to 3.3.1 and my code from above posting.php?mode=quote&f=19&t=22209&p=80731#pr80731 no longer works. All I get in the monitor is some - I believe - bootloader code, which repeats endlessly.

Removing line `board_build.flash_mode = qio` from pio.ini and it compiles fine and runs. WiFi works, webserver works, but neither file system LittleFS nor NVS work!

Now I inserted line `board_build.flash_mode = dio` into pio.ini to set it explicitly. The result is the very same as if not inserting it at all.

So, you can't go with "qio" and you can't go without it!

dimake
Posts: 3
Joined: Wed Jul 21, 2021 10:09 am

Re: Arduino support for ESP32-S2 chips

Postby dimake » Wed Jul 28, 2021 8:00 pm

I'm trying now to compile with the latest Arduino engineering release RC1

Code: Select all

framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#2.0.0-rc1
But compilations fails with this error

Code: Select all

c:/users/dimake/.platformio/packages/toolchain-xtensa32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: final link failed: bad value
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
Trying to solve this issue, who knows, maybe this release is better than 'alpha1'.

greg-solargik
Posts: 12
Joined: Wed Aug 04, 2021 8:45 am

Re: Arduino support for ESP32-S2 chips

Postby greg-solargik » Wed Aug 04, 2021 8:51 am

I am trying to compile a blank sketch for esp32-saola-m1 using platformio, here's my configration:

Code: Select all

[env:esp32-saola-m1]
platform = https://github.com/platformio/platform-espressif32.git
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0-rc1
framework = arduino
board = esp32dev
board_build.flash_mode = qio
board_build.mcu = esp32s2
monitor_speed = 115200
And I also get:

Code: Select all

Linking .pio\build\esp32-saola-m1\firmware.elf
c:/users/******/.platformio/packages/toolchain-xtensa32s2/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: final link failed: bad value
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32-saola-m1\firmware.elf] Error 1
Any ideas?


Who is online

Users browsing this forum: No registered users and 76 guests