-->
Page 1 of 2

Fatal esptool.py error "Timed out waiting for packet header"

PostPosted: Sun Apr 30, 2023 11:47 am
by JoeT
Can anyone advise? I have three identical NodeMCU ESP8266 boards and known good compiled code that has successfully uploaded and run on all three. On two of these boards a subsequent plug-in to a USB port, followed by an upload results in: esptool.py v3.0 A fatal esptool.py error occurred: Failed to connect to ESP8266. Timeout waiting for packet header. It appears the the boards have just 'died' .... the only possible way I could have damaged them is plugging them in. Googling I see that others claim to have fixed an identical problem by downgrading the esp8266 drivers, but I can't fathom how to attempt this. Has anyone seen or fixed this issue before please?

Re: Fatal esptool.py error "Timed out waiting for packet hea

PostPosted: Tue May 02, 2023 6:38 am
by JoeT
Hi - please ... someone help me out here! I've now partially solved this problem. I buzzed out GPIO 0 (pin D3 and GND) on my NodeMCU. When I depressed the FLASH button, NO circuit was made i.e. the FLASH button does NOT ground GPIO 0. So, I did this 'manually' using bread-board wire and ... lo and behold, on my laptop, I could upload code just fine to all three of these previously 'not-working' NodeMCUs.
Spookily however, I still got the time-out error when attempting the same operations on my desktop PC ... a desktop PC that was previously uploading to two of these MCUs just fine. That is before I uploaded some code to an Arduino UNO and subsequently tried uploading the NodeMCUs again. I'm delighted that the NodeMCUs are all functional, but keen to bottom out how this time-out is caused!

Re: Fatal esptool.py error "Timed out waiting for packet hea

PostPosted: Tue May 02, 2023 10:36 am
by JoeT
Is this embarrassing or terrific? With much sweat I have now fixed this myself. On the desktop I opened Device Manager to inspect the COM ports. Two devices were reported as allocated to port COM3 - Communications Port (COM3) and USB-SERIAL CH340 (COM3). This was the cause of communication failing to the Node MCU. By opening these, going to Port Settings, then Advanced, I was able to change and thus separate the port allocations. The Arduino IDE did not automatically reflect this change; I had to close the IDE and restart it, following which both ports showed up under Tools. Selecting the port allocated to CH340 enabled me to load the code.

Re: Fatal esptool.py error "Timed out waiting for packet hea

PostPosted: Wed May 03, 2023 4:03 am
by QuickFix
Remove all your "Unused" (hidden) COM ports and it should work again; this is a known problem with esptool.py as it can't handle COM-port numbers with double digits (i.e. > 9):
  • Physically remove all your USB -> UART convertors (= all your NodeMCU's) from your PC
  • Press Windows start button
  • Type and open "Device manager"
  • Check the "Show hidden devices" option under "View"
  • In the tree open up the "Ports (COM & LPT)" node
  • Remove all COM-ports; if you have "Real" COM-ports on board your PC (often COM1/COM2), you can leave them as-is
  • Plug in your NodeMCU's one by one: they should be detected again and given a COM-port below 10
  • From now on, everything should work as expected
Tip: try to always use the same USB port on your computer to connect a dev-board to: this should (somewhat) limit the number of COM-ports it assigns to your boards.