I everyone! Just got my brand new nano esp32 and wanted to give a try to the LittleFS library on it, but it just doesn't work. This is what I've done so far (using Platformio):
FILE SYSTEM UPLOAD
I created the data folder, containing a .txt file, on the same level of the src folder, and then uploaded it using the Build file system and Upload file system functions. The csv partition table i've used is the following:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x2F0000,
app1, app, ota_1, 0x300000, 0x2F0000,
spiffs, data, spiffs, 0x5F0000, 0xA10000,
Everything went smooth and the file system was uploaded starting from address 0x5F0000 (the same one that is specified in the csv for the spiffs partition)
PLATFORMIO.INI CONFIGURATION
[env:arduino_nano_esp32]
platform = espressif32
board = arduino_nano_esp32
;upload_protocol = esptool ; protocol used for the filesystem upload
board_build.filesystem = littlefs
board_build.partitions = partitions.csv
ARDUINO CODE
#include <Arduino.h>
#include "FS.h"
#include <LittleFS.h>
#define FORMAT_LITTLEFS_IF_FAILED true
void setup() {
Serial.begin(9600);
while (!Serial);
if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)) {
Serial.println("Mounting Failed");
while (true);
}
Serial.println(":)");
}
void loop() {
}
There is no problem during the uploading of the arduino code, but LittleFS always fails to initialize.
After some time I've been able to print to the serial monitor the error code returned from the begin method (ESP_ERR_NOT_FOUND) and found out that that specific error is returned when Littlefs can't find its partition.
What am i doing wrong? The filesystem was uploaded correctly in the address specified on the partition table and there is no error during compilation, so i don't have any clue of what the problem is.
If anyone has any clue on how to fix this or knows what i am doing wrong, please lmk! Thanks!