Platform-espressif32 v5.1.0 and bootloop

Hi all,
I’m using PlatformIO on ESP32 since years now…

It worked well until v5.0… As soon as I update to 5.1 my firmware stopped working.
It boot loop.

I know that something is changed in the latest 5.1, in the release notes I read this:
“This release introduces an additional build step that merges all the primary binaries (partitions, bootloaders and the firmware itself) into a single binary before debugging or uploading via debug probes.”

ok… but how can I fix my bootloop now? :slight_smile:
thank you!

Does this happen with any sketch, e.g. the blinky sketch platform-espressif32/examples/arduino-blink at develop · platformio/platform-espressif32 · GitHub? If yes, please issue at Issues · platformio/platform-espressif32 · GitHub

1 Like

Hi @sblantipodi ! Could you please provide a bit more info on your setup? What’s your target and how do you program it? Anyway, you mentioned that it worked just fine with the v5.0.0, so you can always roll back to that version while we’re figuring out the cause of the problem, for example:


[env:lolin32]
platform = espressif32 @ ~5.0.0
framework = arduino
board = lolin32
monitor_speed = 115200
1 Like

it happen with every sketch I have.

Hi @valeros thanks for the prompt reply.

I’m using an ESP32 (TinyPICO and Lolin D32) with the latest PlatformIO v6.1.3.
Using Windows 11.

I rolled back to v5.0.0, with v5.0.0 works no problem.

the platformio.ini I’m using is available here:
https://github.com/sblantipodi/glow_worm_luciferin/blob/vectors_and_transitions/platformio.ini

OK, I don’t see any traces of the use of debug probes, so the warning from the release notes in the release do not apply here. Your project seems quite complex to debug the issue, any chance you could try a simpler example, e.g. wifi-scan?

thanks for the reply @valeros

I think that the problem is somewhat related to SPIFFS.

the boot loops shows this error in the console:

E (16314) SPIFFS: mount failed, -10025
E (32469) SPIFFS: mount failed, -10025
[ 32474][E][SPIFFS.cpp:114] format(): Formatting SPIFFS failed! Error: -1
[ 32475][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1

I tried Wifi-scan and it works no problem but as soon as I add these simple lines:

  if (SPIFFS.begin(true)) {
    Serial.println("Formatted");
  }

I got the error I mentioned before.

Is there some problems with SPIFFS in this new 5.1.0 version?

I know that SPIFFS has been deprecated in favour of LittleFS on ESP8266 but on ESP32 it should work.

Hi @valeros if this can help fixing the problem I have the same issue with LittleFS.

Using espressif32@5.0.0, I have no problem in writing and reading from LittleFS and SPIFFS,
with espressif32@5.1.0 I can’t read/write to LittleFS and SPIFFS using the same codeused with version 5.0.0.

When using LittleFS I have this error:

./components/esp_littlefs/src/littlefs/lfs.c:1071:error: Corrupted dir pair at {0x0, 0x1}
E (114) esp_littlefs: mount failed,  (-84)
E (117) esp_littlefs: Failed to initialize LittleFS
[   126][E][LittleFS.cpp:94] begin(): Mounting LittleFS failed! Error: -1
LittleFS mount failed
[   143][E][vfs_api.cpp:24] open(): File system is not mounted

the error I got with SPIFFS is reported in the post above this one.

Does this maybe have to do something with what’s discussed in esp32c3 - SPIFFS, FFat, fail to mount after commit 8ee5f0a · Issue #6614 · espressif/arduino-esp32 · GitHub? E.g. the esptool.py version?

@maxgerhardt thanks for the answer.
if I use the solution reported in that issue
switching from
platfrom = espressif32@5.1.0
to
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.4/platform-espressif32-2.0.4.zip

it works well…

it works even if I swtich from
platfrom = espressif32@5.1.0
to
platfrom = espressif32@5.0.0

Is this an issue that should be fixed on the PlatformIO side?

Is there some problems with SPIFFS in this new 5.1.0 version?

There were no explicit changes the filesystem processing.

[ 32475][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1

So, it’s not really a bootloop, only the filesystem fails to start. Have you tried erasing the entire flash memory before uploading? Just run the pio run -t erase command in the IDE terminal.

Also, could you please try the same wifi-scan example with SPIFFS in the Arduino IDE? Does it work there?

Hi @valeros
I have runned the command pio run -t erase before opening this thread, I tried the erase many times in the various try I made.

I have tried the sketch you suggested (wifi.scan) by adding only this in the setup()

if (SPIFFS.begin(true)) {
    Serial.println("Formatted");
  }

With Arduino IDE it prints “Formatted” and it works as expected.

With PlatformIO I see this in the console:

E (322) SPIFFS: mount failed, -10025
E (16597) SPIFFS: mount failed, -10025
[ 16602][E][SPIFFS.cpp:114] format(): Formatting SPIFFS failed! Error: -1
[ 16602][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1

If I revert back to espressif32@5.0.0 in platformio, it works even on PlatformIO.

Hi @sblantipodi , thanks for testing it with the Arduino IDE. I also tried that code with all boards I have at hand and sadly wasn’t able to reproduce. Could you please try the following configuration with the same wifi-scan example:

[env:lolin_d32]
platform = espressif32 @ ~5.1.0
framework = arduino
board = lolin_d32
platform_packages = 
    framework-arduinoespressif32 @ ~3.20003.0

By specifying the previous version of the Arduino framework we will check if there is no regression in the latest version of the development platform.

Hi @valeros, no problem, I need to thank you for your super awesome work on this project, the entire community must thank you I think. :slight_smile:

I followed your instructions and it works like a charm.

The strange thing is that in Arduino IDE I’m using espressif 2.0.4 and it works.

It seems something has changed in the framework itself. I noticed that you adjusted flash frequency in your platformio.ini via board_build.f_flash. Are there settings the same when you’re testing in the Arduino IDE? I’m asking mainly because the prebuilt images in the latest revision of the Arduino framework is quite sensitive to these values.

I reset the board_build.f_flash to the default. same problem.

In Arduino IDE I’m using the defaults for the Lolin D32 board and for the TinyPICO,
boths works well in Arduino IDE.

weird

I would like to release a firmware for ESP32 devices that works on most ESP32 devices using a minimum common denominator.

Basically I want to build a firmware for 4MB flash and 320KB RAM boards.

what board should I use in my platformio.ini in the
board =
section for this purpose?

I always used esp32dev or lolind_d32 and it always worked pretty well but since PlatformIO 5.1 this does not work well at all.

I need to use the right board in platformio.ini config for the right board to make it work.

what’s the difference between a Lolin D32 versus a DevKit or a TinyPICO?

Hi @sblantipodi !

In Arduino IDE I’m using the defaults for the Lolin D32 board and for the TinyPICO,
boths works well in Arduino IDE.

Ok, let’s get back to the non-working configuration without the platform_packages option. What happens if you don’t format SPIFFS on the first start (SPIFFS.begin(false)) and then upload a simple filesystem image via PlatformIO? Does it fail as well? Can you see the files uploaded to the filesystem?

IMO, this is not the best approach. With each new release the Arduino core for ESP32 changes its approach to handling different board variants and their flash memory settings, it’s especially evident with the ESP32S3 target that can have completely different flash memory configuration based on the chip revision. By default you can compile for the esp32dev, but it might be a good idea to clearly mention it in your release notes.

what’s the difference between a Lolin D32 versus a DevKit or a TinyPICO?

By default Lolin D32 and DevKit use different flash mode and hence the same firmware may not work on both targets. TinyPICO is even more different target, it has PSRAM on board and hence compiled with additional build flags to make is usable.

Hi Valeros,
thanks for the answer again.

if I manually upload the FS and use SPIFFS.begin(false) it works on PlatformIO 5.0.0.
I can see the uploaded file.
The same does not work on PlatformIO 5.1.1

We are in the era of the web installers, tasmota, esp home and very known firmware are releasing only one binary for every ESP32…

example:
https://tasmota.github.io/install/manifest_ext/release.tasmota.manifest.json

I always done something similar and it always worked, sad that something broke :slight_smile:

don’t ask me why but it seems that I solved all my errors by simply adding:
board_build.flash_mode = qio
to my platformio.ini
using esp32dev

in this way it seems to work well on all my ESP32 boards.
I have a

  • ESP32 dev kit
  • Lolin D32
  • TinyPICO
  • QuinLED-ESP32

Does this have any sense? What’s the sense in fixing it that way? O_o