# ESP8266 Flashing Problem-A fatal error occurred: Timed out waiting for packet header

I have been having some issues with flashing the firmware to my ESP8266 wifi module.I am using Linux OS and using the method illustrated Here to flash the the esp8266. The following are the connections between the esp8266 and FTDI board:

  FTDI (Rx)<--ESP(Tx)
FTDI(Tx) -->ESP(Rx)
Common ground between the FTDI, ESP and external 3.3 power supply.
ESP(GPIO0)-->Ground (While Flashing)
ESP(CH_PD)-->VCC (3.3V)


I have researched online and have verified all my connections to be fine. But some observations I have made are as follows:

1. The ESP does not respond to any AT commands or display any garbage data on the serial monitor, when restarted with the GPIO 0 pin connected to ground.

2. The ESP responds to AT command as OK and works fine while displaying some garbage data followed by "ready" on the serial monitor, when powered up with the GPIO 0 pin floating.

3.Shows ERROR for the command AT+CIOBAUD?

1. Have also read that, there are some duplicate FTDI hardwares floating around in the market and online stores, that may be one of the reasons for this flashing problem.

Coming to the problem i.e. whenever I try to flash the esp8266 using the esptool.phy, the flashing begins and at around 8% to 12%, it gets stuck displaying the error

 A fatal error occurred: Timed out waiting for packet header


I have stated my observations above, so that it would be easy for the fellow members to address the issues with the flashing. Looking forward to response from people who have faced, solved, encountered or have any opinions/suggestions regarding this problem.

Try -b 57600

This will take time but flash it fine:

python esptool.py -b 57600 -p /dev/ttyUSB0 write_flash 0x000000 "firm0.bin"

• Welcome to EE.SE! If you're providing instructions for commands to use, please consider using the code formatting using either the  key for fixed-width formatting` or indenting by 4 spaces in a paragraph for multi-line code. – user2943160 Jul 12 '16 at 23:00
• Counterfeit FTDI chips cant be used for flashing firmware. I don't know if you have tried it with that. Between this issue is long solved, like I have mentioned in my answer. – PsychedGuy Jul 14 '16 at 6:05
• My ESP 12F won't query/program at anything other than 115200 (any other baud rate results in connection failure) - any idea why this might be the case? – davidA Aug 7 '17 at 1:21

The problem is fixed. As a last resort, I decided to try flashing the firmware with a different serial to usb converter as suggested by some folks online. So I bought the CP2102 Serial to USB converter from amazon and this worked!!!. So, the problem was with the FTDI hardware, I believe it was a dupe and could not handle transfer at high baud rates. I hope this answer may help someone in the future facing the same issue, trying to flash firmwares using the fake FTDI hardwares.