Skip to content

Is ESP32-S2 SPIFFS not supported with Arduino Framework? #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pattobrien opened this issue May 21, 2021 · 14 comments
Closed

Is ESP32-S2 SPIFFS not supported with Arduino Framework? #546

pattobrien opened this issue May 21, 2021 · 14 comments

Comments

@pattobrien
Copy link

Hi everyone -

I've been trying to get SPIFFS working on an ESP32-S2-MINI-1 module for the past 24 hours with no luck. Everything builds and uploads fine, but I get the following error after restarting:

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

And here's my platformio.ini file contents:

[env:esps2]
platform_packages = 
	framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0-alpha1
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
board_build.mcu = esp32s2
monitor_speed = 115200

Has anyone had any success using SPIFFS with an ESP32-S2 using PlatformIO / Arduino-ESP32 Framework?

@valeros
Copy link
Member

valeros commented May 24, 2021

Hi @pattobrien! At the moment there is no stable Arduino package for ESP32-S2 so there is no SPIFFS functionality for this MCU.

@simon-jouet
Copy link

Hi @pattobrien, did you by any chance figure a workaround for this?

I'm running in exactly the same issue. Trying the spiffs example with the esp-idf is working fine on the esp32s2 but when setting up platform.io with arduino-esp32 I'm getting a similar error:

10:27:19.920 > E (92) SPIFFS: mount failed, -10025
10:27:19.923 > E (93) example: Failed to mount or format filesystem

I've tried a few workaround but so far without much success...

@pattobrien
Copy link
Author

@simon-jouet unfortunately no, I wasn't able to figure it out after a couple days of trying. I had my team stop digging, and re-prioritized our efforts in hopes that the upcoming official Arduino 2.0.0 release will trigger PlatformIO support for the S2 and C3.

@simon-jouet
Copy link

Thanks @pattobrien, I'm actually surprised this is related to platformIO, I don't really see why that would be the case. I might try to build the same code using the esp-idf and arduino-esp32 as a component to see if there is any difference

Do you have by any chance the different things you've tested on your hand? Just so I can give it a go as well without repeating what you've done already :)

@simon-jouet
Copy link

@pattobrien Okay I got it working on my end, just letting you know in case it solves the issue for you too.

The problem for me was that my board definition in platformIO was incorrect, my board was set in flash mode dio instead of qio which was the source of the issue. I've modified the board definition to "flash_mode": "qio" and it solved it for me.

I noticed this because it was working fine on the Arduino IDE but not on platformIO, after a bit of poking around I noticed that flashing the Arduino bootloader fixed the issue and at this point i realised that the difference between the two environments was the flash_mode

@dmitrykez
Copy link

Since platformIO 3.3.1 release "flash_mode": "qio" won't help anymore.
Any estimation when file system support for ESP32S2 will be implemented?

@valeros
Copy link
Member

valeros commented Jul 28, 2021

@dmitrykez As I already mentioned earlier in this thread, filesystems for S2 will be added once there is a stable Arduino core for this SoC.

@sweproj
Copy link

sweproj commented Aug 24, 2021

@dmitrykez

I have got it to work by set "flash_mode": "qio", in the board file. (same thing as @pattobrien)
This will break the boot process of the esp32s2. So i need to flash the bootloader seperate after the upload within platformio.
like this esptool.py --chip esp32s2 --port /dev/ttyUSB12 write_flash 0x1000 bootloader_qio_80m.bin, havent figured out why it breaks but anyway

@unaiur
Copy link

unaiur commented Sep 8, 2021

Arduino 2.0.0 with support for ESP32-S2 & C3 was released last week.

@nickleijenhorst
Copy link

I'm having the same issue, it's really mindblowing to be honest. I even tried putting flash mode in qio and reflashed bootloader, but still the same issue. What also confuses me, is that the flash mode is set to QIO in Arduino, but when the device actually boots, it says its working in DIO mode. Neither QIO or DIO seems to work for me in PlatformIO, which is quite annoying for my project... I'm now forced to compile with Arduino lol.

@ArnieO
Copy link

ArnieO commented Mar 25, 2022

Since some of the comments here are getting a bit old (and I believe framework has been updated in the mean time):

Reflashing the "qio" bootloader as described by @sweproj here above solves LittleFS-problem for me: #546 (comment)

Only flashing with "qio" bootloader does not work.
You need to flash with "dio" bootloader first, then reflash "qio" bootloader.

I use S2 bootloaders from here: https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/esp32s2/bin

@diegostf
Copy link

Since some of the comments here are getting a bit old (and I believe framework has been updated in the mean time):

Reflashing the "qio" bootloader as described by @sweproj here above solves LittleFS-problem for me: #546 (comment)

Only flashing with "qio" bootloader does not work. You need to flash with "dio" bootloader first, then reflash "qio" bootloader.

I use S2 bootloaders from here: https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/esp32s2/bin

How can I make this reflashing? Any tutorial?

@Jason2866
Copy link
Contributor

@diegostf Easy, use latest Platformio release for espressif32 and flash your device with Platformio ("build and upload"). That's all. All bugs have been fixed. No workarounds needed anymore.

@diegostf
Copy link

@diegostf Easy, use latest Platformio release for espressif32 and flash your device with Platformio ("build and upload"). That's all. All bugs have been fixed. No workarounds needed anymore.

Tks @Jason2866 .
The problem with "LittleFS mount failed" was due to not formatting the littleFS on first boot. I used a definition that works with ESP32 and ESP8266 (#define FORMAT_SPIFFS_IF_FAILED true), but it doesn't seem to work with ESP32-S2. So I made a modification to the code.

if(!LittleFS.begin()){
      Serial.println("[ LittleFS ] Formated");
      LittleFS.format();
      if(!LittleFS.begin()){
         Serial.print(F("[ LittleFS ] Error while mounting LITTLEFS\n\n"));
         return false;
      }
   }

Now everything works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants