The partitions.csv should be in the same place as the platformio.ini
@sivar2311 I am currently using platform = espressif32@6.12.0. Should I switch to some other platform for e.g. the latest pioarduino? What version are you using? I would like to make my settings as close to you as possible.
That depends on your needs.
Usually I use the latest pioarduino espressif32-platform version.
But when I need Espressif Arduino 2.x (for compatibility reasons) I use the latest official PlatformIO espressif32-platform.
I ran the test with both latest versions without issues.
Ok. And do you also perform Upload Filesystem Image (for data folder) before flashing the code? I see that when I use SPIFFS, I am not getting any error. Only with LittleFS I am unable to work.
First, I just uploaded the sketch to see what would happen. I got an error message saying that the partition could not be mounted. This was to be expected, as there was no valid LittleFS file system in the partition yet.
I then created the file system and uploaded it. After restarting the ESP32, the partition was successfully mounted (as expected).
Yes, its only a name but show in LittleFS.h header file.
bool begin(bool formatOnFail = false, const char *basePath = "/littlefs", uint8_t maxOpenFiles = 10, const char *partitionLabel = "spiffs");
The default label of a littlefs partition is âspiffsâ. You should name it that or tell the label name of the begin function.I think that was done for compatibility reasons.
I am having issues using littlefs with esp32s3-n16r8 as well using the Espressif 32 6.12.0 platform, platformio VS Code:
[env:esp32-s3-n16r8]
platform = espressif32
board = esp32-s3-devkitc-1-n16r8v
framework = arduino
monitor_speed = 115200
board_build.partitions = default_16MB.csv
board_build.filesystem = littlefs
upload_protocol = esp-builtin
build_flags =
-D ARDUINO_USB_CDC_ON_BOOT=1
-D ARDUINO_USB_MODE=1
-DBOARD_HAS_PSRAM
-D PIO_FRAMEWORK_ARDUINO_LITTLEFS
And I keep getting this on serial:
--- Terminal on COM5 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0))
waiting for download
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
E (3012) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1367:error: Corrupted dir pair at {0x0, 0x1}
This is my partition table printed with esp_partition_get:
--- Partition Table ---
Name | Type | SubType | Offset | Size
---------------------+-------+---------+------------+-----------
nvs | 0x01 | 0x02 | 0x00009000 | 0x00005000
otadata | 0x01 | 0x00 | 0x0000e000 | 0x00002000
app0 | 0x00 | 0x10 | 0x00010000 | 0x00640000
app1 | 0x00 | 0x11 | 0x00650000 | 0x00640000
spiffs | 0x01 | 0x82 | 0x00c90000 | 0x00360000
coredump | 0x01 | 0x03 | 0x00ff0000 | 0x00010000
Same result after uploadfs:
PS I:\Arduino\Projects\Test1\Test1> pio run --target uploadfs
Processing esp32-s3-n16r8 (platform: espressif32; board: esp32-s3-devkitc-1-n16r8v; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1-n16r8v.html
PLATFORM: Espressif 32 (6.12.0) > Espressif ESP32-S3-DevKitC-1-N16R8V (16 MB QD, 8MB PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b
- tool-esptoolpy @ 2.40900.250804 (4.9.0)
- tool-mkfatfs @ 2.0.1
- tool-mklittlefs @ 1.203.210628 (2.3)
- tool-mkspiffs @ 2.230.0 (2.30)
- tool-openocd-esp32 @ 2.1100.20220706 (11.0)
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
- toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- FS @ 2.0.0
|-- LittleFS @ 2.0.0
Building in release mode
Building FS image from 'data' directory to .pio\build\esp32-s3-n16r8\littlefs.bin
/hello.txt
Uploading .pio\build\esp32-s3-n16r8\littlefs.bin
Open On-Chip Debugger v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
adapter speed: 40000 kHz
Warn : Transport "jtag" was already selected
adapter speed: 5000 kHz
** Programming Started **
** Programming Finished in 43488 ms **
** Verify Started **
** Verify OK **
shutdown command invoked
============================================================================== [SUCCESS] Took 46.74 seconds ==============================================================================
PS I:\Arduino\Projects\Test1\Test1>
Serial:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037b31a
pro cpu reset by JTAG
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
E (3014) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1367:error: Corrupted dir pair at {0x1, 0x0}
E (3014) esp_littlefs: mount failed, (-84)
E (3017) esp_littlefs: Failed to initialize LittleFS
E (3049) esp_littlefs: Failed to format filesystem
[ 3336][E][LittleFS.cpp:123] format(): Formatting LittleFS failed! Error: -1
[ 3347][E][LittleFS.cpp:98] begin(): Mounting LittleFS failed! Error: -1
NOTE:
My board works fine with Littlefs uploading example from Arduino IDE.
What platform version do you use / which one do you have installed?
This board definition is not included in the official PlatformIO espressif platform.
Where does this come from? (Looks like AI generated)
If you go with PlatformIOâs espressif32 platform (6.12.0) use this platformio.ini:
[env:esp32-s3-devkitc-1]
platform = espressif32 @ 6.12.0
board = esp32-s3-devkitc-1
framework = arduino
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 = default_16MB.csv
board_build.extra_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DBOARD_HAS_PSRAM
If you use pioarduinoâs espressif32 platform use this platformio.ini:
[env:esp32-s3-devkitc1-n16r8]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip
board = esp32-s3-devkitc1-n16r8
framework = arduino
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
The use of -DARDUINO_USB_CDC_ON_BOOT=1 is only necessary if you want to use the native built-in usb port instead of the UART usb port.
Try the LittleFS example provided by Espressif: