ESP8266 "Upload Filesystem Image" A fatal error occurred: Timed out waiting for packet header

Programme uploading works fine (so, not connection issue), but if I try to upload a file, “A fatal error occurred: Timed out waiting for packet header” occurs. What did I do wrong?

PS: Is “SPIFFS” the right choice if I only want to have some “asset” files? I am not going to create or modify files at run-time, but I just need some static files for a web server that runs on ESP.

  1. Create data directory and put a small text file.
    image
  2. Click “Upload Filesystem Image”
    image

Building file system image from ‘data’ directory to .pio\build\esp01_1m\spiffs.bin
/test.txt
Looking for upload port…
Use manually specified: COM4
Uploading .pio\build\esp01_1m\spiffs.bin
esptool.py v3.0
Serial port COM4
Connecting…
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Compressed 262144 bytes to 431…
Writing at 0x000bb000… (100 %)
Wrote 262144 bytes (431 compressed) at 0x000bb000 in 0.1 seconds (effective 27314.8 kbit/s)…

A fatal error occurred: Timed out waiting for packet header
*** [uploadfs] Error 2
================================================== [FAILED] Took 6.09 seconds ==================================================The terminal process “.platformio\penv\Scripts\platformio.exe ‘run’, ‘–target’, ‘uploadfs’, ‘–environment’, ‘esp01_1m’” terminated with exit code: 1.

Well the SPIFFS image was uploaded with the correct number of bytes at the correct address (ldscript), so it should work regardless of that final error.

I assume it wants to do a reset after flashing. Youre platformio.ini selects board = esp01_01m with has the reset method “ck” (source), aka a connection between the serial adapter’s RTS and DTR line to the ESP8266’s RESET and GPIO0 is assumed (with some hardware in between).

  • Does normal uploading work and is able to reset the board after upload?
  • How is the ESP01 module connected to the serial adapter?
  • Have you tried other reset methods?

it should work regardless of that final error.

Does not seem to work. I have tried the following code below, and the output was “Failed to open file for reading”. I am using this adapter called ESP Link v1.0. Uploading did not work out of the box, so I had to add board_upload.resetmethod = nodemcu in the ini file. With that, uploading/resetting works without any problem.

PS: It worked. I had not called SPIFFS.begin(); before opening. Now it is not absolutely needed, but I hope I could remove that fatal error warning, if possible.

1 Like

If uploading works with the NodeMCU reset method I don’t see a reason why it shouldn’t work after the SPIFFS image is uploaded. Maybe ask at GitHub - espressif/esptool: Espressif SoC serial bootloader utility if they know more about the error message in conjuction with the NodeMCU reset method and a SPIFFS upload.