ESP 8266 timed out waiting for packet header

I’m having a similar problem but I think I’ve found the cause.

I don’t know why I didn’t spot it the first time. Some tomb-stoned resistors.

A 10mf cap between enable and ground might help some having this issue.

I reckon 10 milliFarads is a bit excessive. Surely 10µF would be enough? :-)))

I have also same issue with esp 01
i tried to reset esp 01 but no changes occur error is there
can any one help in this?
Thanks in advance.

I'm new at ESP8266 stuff. Windows 10:My serial ports are all correct with latest drivers. All cables are good quality and tested. I used the USB programmer (in program mode) with the bare-bones ESP8266 boards. Tried 2 different boards - both time out. Tried 2 different nodeMCU boards - both time out. All units are brand-new just out of the packages.

esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

I have no idea how to reflash to a different firmware. I guess you have to compile it in order to have something to flash? All I have is one entire day wasted trying over and over and getting no where.

I can plug the same cables into an arduino and have no problem pushing code. I'm just baffled. I've never had anything in the microcontroller world act so badly.

Anyone have any idea of a brand/type that will work right out of the packaging? I guess I'm going to have to look at some other platform - Pi Zero or something like it. Read an entire book on 8266 - seems so easy and simple. This is supposed to be fun, right?

Hi, may I know what is the cause of esp8266 timing out waiting for packet header? I just ran blink on it and it did not seem to work. Any help is greatly appreciated

The error message are as shown below:

Arduino: 1.8.9 (Windows 7), Board: “Generic ESP8266 Module, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), ck, 26 MHz, 40MHz, DOUT (compatible), 512K (no SPIFFS), 2, nonos-sdk 2.2.1 (legacy), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

Sketch uses 257696 bytes (51%) of program storage space. Maximum is 499696 bytes.
Global variables use 26572 bytes (32%) of dynamic memory, leaving 55348 bytes for local variables. Maximum is 81920 bytes. v2.6
2.6 v2.6
Serial port COM5
Connecting……____Traceback (most recent call last):
File “C:\Users\Ong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/”, line 25, in
File “C:/Users/Ong/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool\”, line 2653, in main
File “C:/Users/Ong/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool\”, line 468, in connect
raise FatalError(‘Failed to connect to %s: %s’ % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header


This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Solved this issue by changing the reset method : dtr (aka nodemcu). Was set in default as : no dtr (aka ck)


I found solution this might help [Solved] esp8266 a fatal error occurred: timed out waiting for packet content | Port not found - YouTube

I would suggest uploading the blink basic example before uploading your code too. I just found out that if you have old code on the uno that has anything to do with serial communications, then that counts as the port being open even though you aren't actively seeing any of that data come through because the serial port isn't open on your computer. The arduino is still trying to send data and that messes up the upload.

I'm having trouble with this too.

The strangest part is that it is intermittent. Most of the time it does not work, but sometimes it does. I've confirmed it uploaded by changing the LED blink sequence (tried with both an internal and an external LED) of the blink sketch and outputting custom serial messages to the serial monitor. I also have been able to interact via AT commands in the serial monitor.

What I cannot figure out is why it sometimes works and sometimes does not. I've tried various permutations of plugging it in and holding GPIO0 to GND (direct connection, with a button, holding the button for a short period, holding it for a long period, plugging in the USB soon after unplugging it, or leaving it to sit for a little while then plugging in USB, etc.).

Here's some details on my setup:

  • I installed the drivers suggested in reply #45. I was not able to connect prior to this, and was able to after. However, connecting is still very intermittent (and fails more times than it succeeds), so I'm not sure this was the solution.
  • Arduino Uno as connection to my laptop (macOS Big Sur).
  • ESP8266 Boards v2.7.4
  • Using button to set GPIO0 to GND. Have held it down when plugging into the computer and releasing, and also holding it down when plugging in and through the flash attempt.
  • No resistors or capacitors in any connections.
  • Pin-outs: GND to GND, 3.3v to 3.3v, CH_PD/EN to 3.3v, GPIO0 to GND, TX to TX, RX to RX.

Spent a bunch more time experimenting and seems like I was able to make some progress.

A few items:

  • I tried using PlatformIO (another IDE which integrates with VS Code) and I've been able to upload sketches.
  • I was also able to get uploads working more consistently with the Arduino IDE. If I restart the Arduino IDE, then upload using the process I mentioned in my prior post, I'm able to very consistently connect. In one case, I was able to upload 4 times in a row. However, once I opened the serial monitor, my uploads started failing with the "Timed out waiting for packet header" message. I tried closing the serial monitor, but uploads would still fail. If I restart the Arduino IDE, but don't open the serial monitor, then I'm able to upload again.

So perhaps, at least in my case, it has something to do with the serial monitor?

This could also be a problem when using PlatformIO, but I haven't used it enough to see if the serial monitor problem is there too.

Edit: Well, I just went back to work on my script and now uploading to the ESP 01 fails with the same error every single time. Both PlatformIO and the Arduino IDE fail and I have not opened the serial monitor in either one. I didn't change any of the connections, setup files, or process from when it was working earlier today.

After it didn't work in the earlier configuration, I removed the button directly wired GPIO0 to GND, and that has worked the last few times.

At this point, I really have not been able to point to a single thing that causes it to work or fail.

Edit 2: I've been able to get PlatformIO to upload pretty reliably. I'm using the same set-up as mentioned above. The key thing seems to be to plug in the power, then wait about 5 seconds before trying to upload.

Since I have been struggling with this a lot lately, I also want to provide what I've been able to figure out so far. I'm using an ESP-07, but it should be the same for all ESP-Chips you can get online.

There are a few stumbling blocks that can really ruin your day:

  • Permanently pull GPIO15 to GND
  • Permanently pull GPIO2 to 3.3V

Otherwise, you'll get unexpected behavior. Next up, how to properly program with 100% success rate:

  • Pull RESET to 3.3V
  • Pull GPIO0 to 3.3V
  • Then, use this logic to bind DTR (Data Terminal Ready) and RTS (Request To Send) to RESET and GPIO0. You can read on how this works in the answer on stack-exchange, needed parts are only 2 NPN-Transistors and 2 10k Resistors as base current-limiters.

Most common USB2Serial converters don't have RTS exposed as a pin, which is why I will create my own barebones setup on my PCBs. But you can always search for the pin on the IC on the board and just solder a breakout wire to it.

1 Like

I have a Node MCU ESP12E that has been running nicely since 2017. I wanted to add a relay to the onboard LED pin (GPIO2/D4), so I connected the base of a 2N2222 via a 270 ohm resistor to the pin. When I tried to update the app, I got this error (esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header). I tried updating the board version, and rolling it back to older versions, closed the monitor, pressed the reset button while holding down the flash button, etc. Finally, I disconnected the 2N2222, and bingo!, it worked. My app turns the onboard LED on and off, so I assume the load on the pin is affecting the comms. I'll try it with a bigger resistor.

You cannot pull down GPIO2/D4 - it will not boot because that is a programming control pin. :astonished:

Use any pin other than GPIO0 or GPIO2.

I tried everything here on these forums and elsewhere. I bought the Chinese knockoff with the CH340 uart. What worked was setting the board to: Olimex MOD-WiFi-ESP8266 (-DEV) and the sketch uploaded without a hitch. I was able to see the web page it was supposed to generate so life is good. Hope this helps others.

1 Like

thx!! that worked for me

using Olimex board works only once then fails. But you can emulate "first use":

  1. setting back ESP12E board
  2. attempting upload (which fails)
  3. setting again Olimex board
  4. attempting new upload (now it works)

In my test this mode works in stable manner.

(magic... :slight_smile: )

Even now this was the case for me. I'm following this code from tutorial below:

#include <ESP8266WiFi.h>        // Include the Wi-Fi library

const char* ssid     = "SSID";         // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "PASSWORD";     // The password of the Wi-Fi network

void setup() {
  Serial.begin(115200);         // Start the Serial communication to send messages to the computer
  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    Serial.print(++i); Serial.print(' ');

  Serial.println("Connection established!");  
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer

void loop() { }

Tutorial: A Beginner's Guide to the ESP8266

Selecting version 2.5.0 for esp8266 in board manager solved my problem, not all new software is better software :wink:

Dude! You've saved my dayyyy! GPIO15 must be pull down to the GND when downloading the program.

Yeah I didn't actually have time to read all of these 57 posts- but I want to add that depending on the setup, you will have to hold down RESET and/or GP0 to get it to accept the flash.

For example I am using an Arduino Uno to program the ESP-01, and it will never get past the
step if I don't hold down the two buttons connected to RESET and GPIO 0.

Here is an article dealing with a different chip that explains the steps to put it into bootload mode.

Also, for other chips, the speed you select does matter. Whereas the some ESP-12E can do anything up to 921600, some ESP-12F can only do 115200. Always try different speeds to rule that out if you are having problems.