FFat inconsistent behavior

Hi,

Something weird going on - appreciate any help.
I am using ESP32-S3 board with FFat.
On one computer, everything works perfectly (init, read, write).
On a 2nd computer, running the same program, trying to build, upload, and run it gives the following error (during execution; build and upload going fine):

Inizializing FFat…
[ 14027][E][FFat.cpp:35] check_ffat_partition(): No FAT partition found with label ffat
[ 14027][E][FFat.cpp:49] begin(): No fat partition found on flash
FFat Mount Failed!

Few observations:

  1. On the failing computer, building and running my program from Arduino IDE works!.
  2. I have no notion of “board_build.filesystem = fatfs” in my platformio.ini file. As I said - works GR8 on one computer…
  3. Of course, if I upload the program from the “good” computer and only execute it (from within VS) on the 2nd computer - everything is OK. “Something” is going wrong during compilation on 2nd computer.
  4. I uninstalled and re-installed PlatformIO and VS Code - no luck :frowning:
  5. The program itself is quite “classic” FFat (and giving the same result regardless of the flag being true or false):

#include “Arduino.h”
#include “FS.h”
#include “FFat.h”

#define FORMAT_FFAT_IF_FAILED false

Serial.println(F(“\nInizializing FFat…”));
if (!FFat.begin(FORMAT_FFAT_IF_FAILED)) {
Serial.println(“FFat Mount Failed!”);
return;
} else {
Serial.println(“FFat Mount Successfull!”);
}

Appreciate you feedback.

Eli

Please use PlatformIO IDE for VSCode and compare “Activity Bar (Left bar) > PlatformIO > Project Tasks > %env% > Dependencies > List” on both machines. It looks like you use different versions of dependencies.

We recommend using semantic versioning and declaration. See the example for platform option. The same syntax is for lib_deps.

Thanks Ivan.
Please excuse the length of the response - would like to provide all info possible…

  • Codebase on both machines is the same.

  • I “solved” my problem by copying /Users/%user%/.platformio/packages from the successful to the failing machine. Still I don’t understand the root cause of the variance…

  • Looking at /Users/%user%/.platformio/packages on the failing machine, I see:
    contrib-piohome
    framework-arduinoespressif32
    toolchain-riscv32-esp
    toolchain-xtensa-esp32s3
    tool-esptoolpy
    tool-mkfatfs
    tool-mklittlefs
    tool-mkspiffs
    tool-scons

  • Looking at /Users/%user%/.platformio/packages on the successful machine, I see, in addition to the above:
    contrib-pioremote
    framework-espidf
    toolchain-esp32ulp
    toolchain-riscv32-esp@8.4.0+2021r2-patch5
    toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5
    tool-cmake
    tool-idf
    tool-ninja

  • As a result, prior to the copy I did, there was a variance in the dependency list:

  • On the successful machine:
    Platform espressif32 @ 6.1.0 (required: espressif32)
    ├── framework-arduinoespressif32 @ 3.20007.0 (required: platformio/framework-arduinoespressif32 @ ~3.20007.0)
    ├── framework-espidf @ 3.50001.0 (required: platformio/framework-espidf @ ~3.50001.0)
    ├── tool-cmake @ 3.16.4 (required: platformio/tool-cmake @ ~3.16.0)
    ├── tool-esptoolpy @ 1.40500.0 (required: platformio/tool-esptoolpy @ ~1.40500.0)
    ├── tool-idf @ 1.0.1 (required: platformio/tool-idf @ ~1.0.1)
    ├── tool-mconf @ 1.4060000.20190628 (required: platformio/tool-mconf @ ~1.4060000.0)
    ├── tool-mkfatfs @ 2.0.1 (required: platformio/tool-mkfatfs @ ~2.0.0)
    ├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
    ├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
    ├── tool-ninja @ 1.9.0 (required: platformio/tool-ninja @ ^1.7.0)
    ├── toolchain-esp32ulp @ 1.23500.220830 (required: platformio/toolchain-esp32ulp @ ~1.23500.0)
    ├── toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch5)
    └── toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5)
    Libraries
    └── ArduinoJson @ 6.21.2 (required: bblanchon/ArduinoJson @ ^6.21.2)

  • On the failing machine:
    Platform espressif32 @ 6.3.2 (required: espressif32)
    ├── framework-arduinoespressif32 @ 3.20009.0 (required: platformio/framework-arduinoespressif32 @ ~3.20009.0)
    ├── tool-esptoolpy @ 1.40501.0 (required: platformio/tool-esptoolpy @ ~1.40501.0)
    ├── tool-mkfatfs @ 2.0.1 (required: platformio/tool-mkfatfs @ ~2.0.0)
    ├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
    ├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
    ├── toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch5)
    └── toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5)
    Libraries
    └── ArduinoJson @ 6.21.2 (required: bblanchon/ArduinoJson @ ^6.21.2)

  • Last: I noticed, in the VS Code Terminal on the failing machine (prior to my “fix”), the following message appearing randomly:
    *[6/21/2023, 4:37:56 PM] Unable to resolve configuration with compilerPath *
    “C:/Users/elist/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/xtensa-esp32s3-elf-gcc.exe”.
    Using “cl.exe” instead.

THAT, I believe, would be the reason for the different behavior of the compiled code, still - why the packages on both machines vary? VS Code & PlatformIO is the same, ESP-IDF is 5.0 on the successful machine and 5.0.2 on the failing machine - could that be it??

Regards - Eli

The documentation explains this platform — PlatformIO latest documentation

Update the platform line in your platformio.ini file to espressif32 @ ~6.1.0

Worked like a charm!

Thanks a lot - Eli

1 Like