ESP-07 flashing issue on PlatformIO and solution


Recently, I decided to port the ESPClock project to PlatformIO, and kept encountering an intermittent error during flashing:

 A fatal error occurred: Timed out waiting for packet header

Took me a long time to research the issue and making no headway,  until I stumbled upon this rare gem.

The file I needed to modify is:

  C:\Users\<Username>\.platformio\packages\tool-esptoolpy\esptool.py

I changed the values to:

 DEFAULT_TIMEOUT = 100
 START_FLASH_TIMEOUT = 40
 CHIP_ERASE_TIMEOUT = 240
 MD5_TIMEOUT_PER_MB = 8
 ERASE_REGION_TIMEOUT_PER_MB = 60
 DEFAULT_SERIAL_WRITE_TIMEOUT = 20

Originally, DEFAULT_TIMEOUT was set to 10. That made flashing the code reliable, but flashing the filesystem was still problematic. After increasing the value all the way to 100, I never encountered the error again.


Comments

Popular posts from this blog

Adding "Stereo Mixer" to Windows 7 with Conexant sound card

Hacking a USB-C to slim tip adapter cable to charge the Thinkpad T450s

Attiny85 timer programming using Timer1