Esp32s3 N16R8 fails always with LittleFS

Error received:

E (1507) esp_littlefs: partition "spiffs" could not be found E (1507) esp_littlefs: Failed to initialize LittleFS [  1605][E][LittleFS.cpp:98] begin(): Mounting LittleFS failed! Error: 261 LittleFS Mount Failed  

I am using platform espressif32 6.12.0
My partitions.csv looks as follows:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,data,nvs,0x9000,0x6000,
phy,data,phy,0xF000,0x1000,
factory,app,factory,0x10000,0x100000,
spiff,data,spiffs,0x110000,0xEF0000,
type or paste code here

My platform.ini is configured as follows:

platform = espressif32@6.12.0
board = esp32-s3-devkitc-1
framework = arduino

board_build.filesystem = littlefs
board_build.arduino.memory_type = qio_opi
board_build.flash_mode = qio
board_build.psram_type = opi
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.partitions = partitions.csv
monitor_speed = 115200
build_flags =
  -DBOARD_HAS_PSRAM
	-D ARDUINO_USB_MODE=1 ; CDC/JTAG USB mode
	; Needed for USB to enumerate when user code starts
	-D ARDUINO_USB_CDC_ON_BOOT=1

So why is this called spiff instead of spiffs

I guess the first variable is just the name. One can define it anything

In turn if I use my partitions.csv as follows:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,data,nvs,0x9000,0x6000,
phy,data,phy,0xF000,0x1000,
factory,app,factory,0x10000,0x100000,
spiff,data,littlefs,0x110000,0xEF0000,

I am getting the following error:

Generating partitions .pio\build\esp32-s3-devkitc-1\partitions.bin
Error at line 5: Value 'littlefs' is not valid. Known keywords: ota, phy, nvs, coredump, nvs_keys, efuse, undefined, esphttpd, fat, spiffs
*** [.pio\build\esp32-s3-devkitc-1\partitions.bin] Error 2

No, I mean

# Name,   Type, SubType, Offset,  Size, Flags
nvs,data,nvs,0x9000,0x6000,
phy,data,phy,0xF000,0x1000,
factory,app,factory,0x10000,0x100000,
spiffs,data,spiffs,0x110000,0xEF0000,

I performed the same as you mentioned. Additionally, I erased the flash completely and then ran the program. Now I getting the following error:

E (1507) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1367:error: Corrupted dir pair at {0x0, 0x1} 

E (1508) esp_littlefs: mount failed,  (-84)
E (1510) esp_littlefs: Failed to initialize LittleFS
[  1613][E][LittleFS.cpp:98] begin(): Mounting LittleFS failed! Error: -1
LittleFS Mount Failed

And you did upload a filesystem separately?

Just create a data folder in your project, put some text file in it and use the project task “Upload filesystem” (https://docs.platformio.org/en/latest/platforms/espressif32.html#uploading-files-to-file-system).

Yes I have also tried doing it but no gain.

What if you delete this line and use project task → upload and project task → upload filesystem?

The default.csv already has a SPIFFS partition.

When I use the default partition by commenting board_build.partitions, I still see no progress. If you have a esp32s3 can you try the following code

#include <Arduino.h>
#include "esp_partition.h"
#include <LittleFS.h>

void listPartitions() {
  const esp_partition_t   *partition;
  esp_partition_iterator_t partition_iterator = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
  Serial.println("Name                 | Type  | SubType | Offset     | Size");
  Serial.println("---------------------+-------+---------+------------+-----------");
  while (partition_iterator != NULL) {
    partition = esp_partition_get(partition_iterator);
    Serial.printf("%-20s | 0x%02x  | 0x%02x    | 0x%08x | 0x%08x\n",
                  partition->label,
                  partition->type,
                  partition->subtype,
                  partition->address,
                  partition->size);
    partition_iterator = esp_partition_next(partition_iterator);
  }

  esp_partition_iterator_release(partition_iterator);
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  listPartitions();

  if (!LittleFS.begin(true, "/littlefs", 5, "spiffs")) {
    Serial.println("An Error has occurred while mounting LittleFS");
    return;
  }
  Serial.println("LittleFS mounted successfully");
}

void loop() {
}

The output that I got by commenting the partitions.csv is as follows:

Name                 | Type  | SubType | Offset     | Size
---------------------+-------+---------+------------+-----------
nvs                  | 0x01  | 0x02    | 0x00009000 | 0x00005000
otadata              | 0x01  | 0x00    | 0x0000e000 | 0x00002000
app0                 | 0x00  | 0x10    | 0x00010000 | 0x00330000
app1                 | 0x00  | 0x11    | 0x00340000 | 0x00330000
spiffs               | 0x01  | 0x82    | 0x00670000 | 0x00180000
coredump             | 0x01  | 0x03    | 0x007f0000 | 0x00010000
E (1009) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1367:error: Corrupted dir pair at {0x1, 0x0}

E (1010) esp_littlefs: mount failed,  (-84)
E (1012) esp_littlefs: Failed to initialize LittleFS
E (1051) esp_littlefs: Failed to format filesystem
[  1150][E][LittleFS.cpp:123] format(): Formatting LittleFS failed! Error: -1
[  1161][E][LittleFS.cpp:98] begin(): Mounting LittleFS failed! Error: -1
An Error has occurred while mounting LittleFS

It seems everyone is guiding to this link

But how do we achieve this in platformio. When I perform Upload Filesystem Image I already see it creating a littlefs.bin

Building in release mode
Building FS image from 'data' directory to .pio\build\esp32-s3-devkitc-1\littlefs.bin
/config.html
/style.css
Looking for upload port...
Auto-detected: COM8
Uploading .pio\build\esp32-s3-devkitc-1\littlefs.bin
esptool.py v4.5.1
Serial port COM8
Connecting...
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 80:b5:4e:c6:0b:38
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00110000 to 0x00ffffff...
Compressed 15663104 bytes to 27487...
Writing at 0x00110000... (50 %)
Writing at 0x0051db97... (100 %)
Wrote 15663104 bytes (27487 compressed) at 0x00110000 in 105.4 seconds (effective 1189.1 kbit/s)...
Hash of data verified.

Any help here would be appreciated.

Similar issue:Partition scheme not working

Hm… I had no issues running the code on my ESP32-S3-N16R8.

This output is just as “default_8MB.csv“ and it is shown in “esp32-s3-devkitc-1.json“,
it is not your “partitions.csv“.
You may confirm the location of your “partitions.csv“. Is it same folder of “default_8MB.csv“ ?

I think it is better to refer : Partition scheme not working

If you are using Esp32s3 devkitc-1 N16R8 , you must write as like
board = esp32-s3-devkitc1-n16r8
in your platformio.ini.
If you are using your original board, you must make a new (yourboard).json.
(I think it is better)
Then write your partition scheme in (yourboard).json like as
”partitions”:”partitions.csv”

The esp32-s3-devkitc1-n16r8 manifest you are mentioned is not available in a “vanilla” PlatformIO but in the pioarduino espressif32-platform! Therefore the settings in the platformio.ini made here are fully correct. There is no need to create a dedicated board manifest, but it is optional.

1 Like

>the settings in the platformio.ini made here are fully correct.
Why he got the result of “8MB partition” ?

As recommended in platformio documentation, I have placed my partitions.csv in the root folder of my project along with my platformio.ini file. Additionally, when I run Upload Filesystem Image it shows the correct address that I have set in my partitions.csv. This means it is referencing to the right address

1 Like

Hmmm. But the result of your program is that partition scheme is “default_8MB.csv”…

Ok let me try putting the partitions.csv at the location that you mentioned