OK. I have found the solution, finally, but it has been a journey, let me tell you that! And the solution is without using the Arduino IDE for the following reasons:
What a mess ...
Developing web pages using the built-in WIFI of the Arduino Nano ESP32 has become such a horrible mess for novice people like me ... It is incredible ... When you purchase the Arduino Nano ESP32 and it arrives in your mail box, you get overwhelmed by "tutorials", "posts", "youtube videos" and they all speak like "It is very easy to upload files to your SPIFFS using PlatformIO", or even "more easier using the Arduino IDE 1 ESP32 file upload tool".
The truth using the Arduino Nano ESP32 is different however ...
Root cause ... Where are the data files ???
The issue originates that the Arduino Nano ESP32 uploads sketches using the DFU tool. However, in these sketches, which finally result in "program images", there aren't any data files included! There is no single way to include data files in program images. So the search starts: "How to upload data files to the Arduino Nano ESP32", for example an index.html file???
"The remedy" -> Use Arduino IDE 1
Then you will quickly learn that there is a tool out there, for which you can find "installation manuals" like this: ESP file upload tool installation manual for the ESP32 file system.... All a waste of time ... The Arduino IDE 2 does not support this tool, so the Arduino IDE 1 must be used.
OK ... So I use the Arduino IDE 1, installed the tool and tried it ...
The user interface of this tool seems to work on the IDE 1 apparently. Here I select to upload files to the SPIFFS ... (At this time I had hardly any idea what SPIFFS is and what it REALLY means ...)
So when i press enter, I see this:
The upload failed!
Reason? Very simple: The Arduino Nano ESP32 does not have a BAUD setting in the menu!
OKAY. So that didn't result in much ... That is not working. I have checked the code of this tool and indeed, there is a setting as a parameter given that requires the BAUD rate to be specified, which is retrieved from the IDE parameter settings ... Which is null in case of the Arduino Nano ESP32 in the IDE 1 ...
So back to the IDE 2 ...
Then I started to wonder ... What exactly is this SPIFFS and I walked into the partitions topic, an other horrible unclarity for the Arduino Nano ESP32 ...
To make a long story short, it turns out that the "default.csv" is not used !!!** for the Arduino Nano ESP. Instead, when you carefully observe the logs in the IDE 2, you'll find that for SPIFFS it uses a specific csv for the partitioning of the Arduino Nano ESP32 ... I created a new, empty sketch and uploaded it ... In the logs I find the following:
I open this file and I see:
So the spiffs partition is written from 0x610000 to 0x960000 on the ESP32.
Platform IO
Then I learn that there is an other IDE in existence, the "Platform IO based on VSCODE" that you can use to build and create your sketches, but also to burn your own data files on SPIFFS in a data partition!
So I tried this ... But it didn't work for the following issues (i'm going to spare you the details...)
- There is no Arduino Nano ESP32 board when you initially start platform IO and you want to create a new project.
- When you finally understand what a "platform.ini" file is, and you then find the right settings, you'll learn that there is an arduino_nano_esp board setting, but that is uses it's own .csv files for partitioning, when you compile the file system or the sketches!!!
And the partition file it uses for the Arduino Nano ESP32 does not match the one that the IDE 2 uses!!!!
So to make a long story short: this is my platformio.ini file:
[env:arduino_nano_esp32]
platform = espressif32
board = arduino_nano_esp32
framework = arduino
board_build.filesystem = spiffs
; upload_protocol = esptool
board_build.partitions = app3M_spiffs9M_fact512k_16MB.csv
monitor_speed = 9600
board_build.mcu = esp32s3
lib_deps =
wnatth3/WiFiManager@^2.0.16-rc.2
me-no-dev/ESP Async WebServer@^1.2.3
You can see the board_build.partitions = app3M_spiffs9M_fact512k_16MB.csv which I've included specifically to make the partitioning correct using the PlatformIO file manager, so it writes the data to the addresses 0x610000 to 0x960000 !
Next, you have the issue that for the Arduino Nano ESP32 firmware, it writes sketches using the DFU tool but file images using the ESP tool!
So when you flash file images, you need to configure your platformio.ini file, enabling the upload_protocol = esptool before you create the file image! When you do this, the PlatformIO will use the ESPTOOL as the upload tool. You need to double press the Arduino Nano ESP32 reset button, so it goes into "loader mode" ... The COM port changes, but the ESP tool should automatically find the correct COM6 port. If not the first time, then retry the 2nd time to do the file upload.
Once you have the files written, you need to comment the upload_protocol = esptool again to ; upload_protocol = esptool adding a ; in front or pressing CTRL-:
Then you can upload your sketches using PlatformIO, it works great, but the only caveat is that when you change the platformio.ini, the tool will RESCAN your complete project, and will RECOMPILE your whole solution. So try to minimize the upload of your data folder, updating your file images on SPIFFS, so save a lot of time!
I've given up on the Arduino IDE 2 for the Arduino Nano ESP32, for the moment ...
I also noticed that PlatformIO compiles the solution much faster. It doesn't spend wasting time to find the "correct libraries" and does a much better job identifying the compilation needs when you change source code.
To the Arduino Developer Team
If you want to make the Arduino IDE 2 a success, ensure that you get either this IDE 1 plug-in working, or even better to include a file upload function as a standard function in the IDE 2 !!!!. Also, it is completely UNCLEAR how to add new plug-ins to the IDE 2, spite the friendly help given (which I appreciate).
This journey has taken me 10 days to conclude all this ... right now I'm building asynchronous web sites using PlatformIO for the Arduino Nano ESP32 ...
Sven