esp-littlefs failing to format flash partition

maldus
Posts: 83
Joined: Wed Jun 06, 2018 1:41 pm

esp-littlefs failing to format flash partition

Postby maldus » Tue May 30, 2023 1:48 pm

Hello everyone,
I've started working on a new custom ESP32S3 board and I'm stuck on an esp-littlefs issue.
Basically the library is unable to format its dedicated flash partition; the example (https://github.com/joltwallet/esp_littl ... er/example) outputs the following error:

Code: Select all

Demo LittleFs implementation by esp_littlefs!
   https://github.com/joltwallet/esp_littlefs
This is esp32s3 chip with 2 CPU cores, WiFi/BLE, silicon revision 1, 2MB external flash
Free heap: 389312
Now we are starting the LittleFs Demo ...
I (293) demo_esp_littlefs: Initializing LittleFS
E (293) esp_littlefs: /home/maldus/Source/Github/esp_littlefs/src/littlefs/lfs.c:1224:error: Corrupted dir pair at {0x0, 0x1}

W (303) esp_littlefs: mount failed,  (-84). formatting...
W (353) esp_littlefs: /home/maldus/Source/Github/esp_littlefs/src/littlefs/lfs.c:1887:warn: Superblock 0x0 has become unwritable

E (353) esp_littlefs: Failed to format filesystem
E (353) esp_littlefs: format failed
E (363) esp_littlefs: Failed to initialize LittleFS
E (363) demo_esp_littlefs: Failed to mount or format filesystem
I have made some tests with a different board (the featherS3 https://esp32s3.com/feathers3.html) and found out that this issue arises on my custom board with ESP-IDF v5.0. With ESP-IDF v5.1 littlefs works on both modules.

The two modules I've used have the following hardware configuration:

Code: Select all

# Configuration of the board that doesn't work
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 68:b6:b3:3c:c8:18
Uploading stub...
Running stub...
Stub running...
Manufacturer: c2
Device: 8039
Detected flash size: 32MB
Flash type set in eFuse: octal (8 data lines)

# Configuration of the board that works
esptool.py v4.5.1
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 70:04:1d:ad:8f:b8
Uploading stub...
Running stub...
Stub running...
Manufacturer: ef
Device: 4018
Detected flash size: 16MB
Flash type set in eFuse: quad (4 data lines)
Hard resetting via RTS pin...
Could the flash type (octal) cause this problem? Why would ESP-IDF 5.1 work while 5.0 doesn't?

ESP_rrtandler
Posts: 24
Joined: Wed May 31, 2023 6:54 pm

Re: esp-littlefs failing to format flash partition

Postby ESP_rrtandler » Thu Jun 01, 2023 8:59 am

Please try to enable CONFIG_ESPTOOLPY_OCT_FLASH using menuconfig in IDF 5.0. The IDF 5.1 has auto detection of octal flash and this could explain why it works there.

maldus
Posts: 83
Joined: Wed Jun 06, 2018 1:41 pm

Re: esp-littlefs failing to format flash partition

Postby maldus » Thu Jun 01, 2023 1:36 pm

Indeed; now it works, thank you very much!

Who is online

Users browsing this forum: MicroController, snutw_ and 89 guests