ESP32 “Failed to connect: Timed out waiting for packet header”: fixes

The upload tool could not put the ESP32 into download mode and so got no reply. On most dev boards this is a cable, driver or boot-button problem. The code is not the cause.

What the message means

To flash, the ESP32 must restart into its serial bootloader. The tool toggles the reset and boot pins through the USB-serial chip. If that handshake fails, you see “Failed to connect to ESP32: Timed out waiting for packet header”.

Fix it in this order

  1. Use a data-capable USB cable. Charge-only cables are the most common cause.
  2. Select the right board and port under Tools. Check the port number changes when you replug the board.
  3. Install the driver for the USB-serial chip on your board (CP210x or CH340), then replug.
  4. Hold the BOOT button when the IDE prints “Connecting……”, release it once the upload starts.
  5. Disconnect anything wired to the GPIO pins used for boot (GPIO0, GPIO2, GPIO12, GPIO15) during upload.
  6. On boards that never enter download mode automatically, a capacitor of about 10 uF from EN to GND is a known fix.
  7. Lower the upload speed in Tools if the cable is long or poor.

Why it happens

To flash an ESP32, the uploader needs the chip to start its serial bootloader instead of running the sketch. The uploader pulls the reset line and the GPIO0 boot pin through the USB-serial chip in a particular sequence. If that handshake does not happen, the chip never answers, and the tool reports a timeout waiting for a packet header.

Several things can break the sequence: a charge-only cable with no data lines, a driver missing for the USB chip, the wrong port selected, or a circuit on the boot pins holding them in the wrong state. Some boards lack the automatic reset circuit, so the BOOT button must be held by hand. Power dips during upload can also cut the handshake short.

If you see this, do this

You seeDo this
Works only while holding BOOTAuto-reset is not working. Try the EN capacitor, or keep the BOOT routine.
Port is missingCable or driver. Check Device Manager.
It fails with a shield or sensor attachedRemove it from the boot pins and upload again.

Confirm the fix

  1. Replug the board and confirm a new COM port appears in the IDE. That confirms the cable carries data and the driver loads.
  2. Run esptool’s chip information command on the port with BOOT held during reset. A chip ID response confirms the bootloader is reachable.
  3. Hold BOOT while the IDE shows Connecting, release it once the upload starts. A successful upload confirms the manual sequence works.

Common mistake: Most readers assume that a timeout during flashing means the sketch or the ESP32 is broken, when the cause is usually the cable, driver, port or boot sequence.

ESP32 pinout for robotics, ESP32 brownout.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.