Unable to Upload Filesystem Image to ESP32 Nano and begin SPIFFS

When using the developer version of PlatformIO or Arduino 2.1.1 to upload a Filesystem image to the ESP32 Nano, an error prevents the process from completing. Furthermore, SPIFFS cannot be initialized, even when using the default SPIFFS_Test example.
ERROR:

Opening DFU capable USB device...
Device ID 2341:0070
Device DFU version 0101
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(10) = dfuERROR, status(3) = Device is unable to write memory
Clearing status
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0101
Device returned transfer size 4096
Copying data from PC to DFU device

Download        [                         ]   0%            0 bytes failed!
DFU state(10) = dfuERROR, status(3) = Device is unable to write memory
*** [uploadfs] Error 74

Does anyone have any idea?

hello I have the same problem ! did you find a solution?
with an esp32 dev from az-delivery, it works without problems

Hi, I came across exactly the same problem, and I also read your issue on github Failure to Upload Filesystem Image to ESP32 Nano · Issue #1170 · platformio/platform-espressif32 · GitHub

In principle, a spiffs (or littlefs) image is created out of the data folder using mkspiffs (or mklittlefs), and then uploaded to Arduino Nano ESP32 using esptool under bootloader mode.

As to PlatformIO, it seems that the dfu protocol is used by default to upload both sketch and FS image. However, a esptool protocol should be used to upload the FS image.

So, I solved the problem by manually add "upload_protocol = esptool" in the platformio.ini when I'm uploading the FS image.
Note that the Arduino Nano ESP32 should be manually set to bootloader mode (by connecting B1 and Ground with a jumper wire) for the esptool to take effect. The serial port is also different from the one used in dfu protocol, so let it detect the serial port on its own.

After the FS image is successfully uploaded, don't forget to press the reset button on the board to exit from the bootloader mode, and change the line in platformio.ini to "upload_protocol = dfu" for the normal sketch uploading.

Reference:

3 Likes

Thank , it's good for me !!

1 Like

Thanks. it also worked for me.

hi , how to initialise spiffs on nano ? I've simple sketch for initialise but it doesn't initialized !

Hello!
To troubleshoot this please try:

  • Going to tools > Partition Scheme and selecting SPIFF
  • Also on tools select Burn bootloader
  • And following up by Sketch > Burn using bootloader (with the included SPIFF example)
2 Likes

Hello, wonderful, you solved my problem. I was able to transfer my files for my web page! Thanks again, you're great :).

Thank you, you fixed my problem. This was a great solution!

Where do you see here Sketch > Burn using bootloader?

@psousalima ?

The issue with activating the upload_protocol=esptool is that PlatformIO rescans your whole solution once you reset back to the normal sketch upload mechanism (commenting to ;upload_protocol = esptool).

And as a result, it completely recompiles your solution once you build and upload your sketch :frowning: For me this takes like 5 minutes.

Hi @svenvandevelde

I think it was meant to be Sketch> Upload Using Programmer, following the technique described in this Arduino Help Center article:

And what does this comment contribute to the initial problem described by the person who raised his issue or comment?

By "this comment", are you referring to my post #12?

Sorry, no, post #7. I mean, it confused me. I was looking into the IDE looking into your feedback, trying out your recommended solution, and did not find the correct menu option, and I don't understand how the IDE comment of Arduino can help with a PlatformIO related issue ...

1 Like