Fix “Timed out waiting for packet header” on ESP32
Your PC sees the ESP32 but the bootloader isn't answering. Nine times out of ten it's the BOOT button, the USB cable or the driver — fix it in under a minute.
Community draft — report a mistake
What you see
Sketch uses 284517 bytes (21%) of program storage space. Maximum is 1310720 bytes.
esptool.py v4.8.1
Serial port COM5
Connecting......................................
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2Sketch uses 284517 bytes (21%) of program storage space. Maximum is 1310720 bytes. esptool.py v4.8.1 Serial port COM5 Connecting...................................... A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html Failed uploading: uploading error: exit status 2
esptool talks to a small bootloader in the ESP32’s ROM. That bootloader only listens if GPIO0 is LOW when the chip comes out of reset. “Timed out waiting for packet header” means esptool sent its sync packets and nothing came back: either the chip never entered that mode, or the bytes never reached it.
Work through the quick fixes in order — they’re sorted by how often they solve it.
Quick fix — try in order
- 1
Hold BOOT, then click Upload
Keep holding the BOOT (IO0) button until you see
Writing at 0x…, then let go. - 2
Swap the USB cable
Many phone cables are charge-only. If the COM port appears but uploads fail, try a cable you know carries data.
- 3
Lower the upload speed
Tools → Upload Speed → 115200. Long or cheap cables can't hold 921600 baud.
- 4
Unplug everything from GPIO 0, 2, 12 and 15
These strapping pins decide the boot mode. A sensor or LED pulling them the wrong way blocks flashing.
Why it happens
The board never entered download mode
Auto-reset uses the DTR/RTS lines to pulse EN and IO0. Some clone boards have a weak capacitor on EN, so the timing misses. Holding BOOT forces download mode; a permanent fix is a 10 µF capacitor between EN and GND.
Driver missing or wrong
Check which USB-serial chip sits next to the USB socket — CP2102 (Silicon Labs) or CH340 (WCH) — and install that maker's driver only.
Another program owns the COM port
Close the Serial Monitor, a 3D-printer slicer, another IDE or a terminal app that has the port open.
Weak power
A drooping 3.3 V rail during the handshake resets the chip. Use a USB port on the PC itself, not a passive hub, and unplug power-hungry modules.
Board-specific notes
ESP32-CAM: No USB chip on the board. Bridge IO0 to GND on the programmer, press RST, upload, then remove the bridge and press RST again.
ESP32-S3 / C3 (native USB): Hold BOOT, tap RST, release BOOT — the port name changes after this, so re-select it in Tools → Port.
Drivers — official sources only
Did this fix it?
Thanks — that helps us keep this page right.