Skip to content

Failed to connect to ESP32: Timed out waiting for packet header #1497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aniellod opened this issue Jun 14, 2018 · 74 comments · Fixed by #8241
Closed

Failed to connect to ESP32: Timed out waiting for packet header #1497

aniellod opened this issue Jun 14, 2018 · 74 comments · Fixed by #8241
Assignees
Labels
Type: For reference Common questions & problems

Comments

@aniellod
Copy link

aniellod commented Jun 14, 2018

Hardware:

Board: ESP32 LOLIN w/OLED - ESP-WROM32
Core Installation/update date: (see below)
IDE name: Arduino IDE 1.8.5
Flash Frequency: 80Mhz
Upload Speed: Tried various

Description:

Unable to upload anything to this module.

Have another identical one and same sketch uploads and runs fine. Rules out cable, connection or computer. I tried to upload using esptool.py directly and also using FTDI but same problem.

How can I test if the board damaged? Any tips on how to revive it?

Debug Messages:

(/dev/ttyUSB1)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

Sketch uses 638418 bytes (48%) of program storage space. Maximum is 1310720 bytes.
Global variables use 38948 bytes (13%) of dynamic memory, leaving 255964 bytes for local variables. Maximum is 294912 bytes.
esptool.py v2.3.1
Connecting........_____....._____....._____....._____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Thanks

@mrmonteith
Copy link

I take it the port shows and that it just doesn't upload. I've bought a couple of dev boards that they didn't design well. I have to hold down the reset but after esptool starts to try to send for about a second or two and then release and it loads. All my other boards load with no hand holding. Hope that is what the problem is.

@aniellod
Copy link
Author

Sadly it's not helping in this case. Any variations of pressing the boot/flash button or holding it, releasing it seems to fail. Oddly enough the problem was gradual. The board was working fine without needing to press "boot", then it stopped working and I had to press "boot" for it to accept the code. Now nothing works. I had a look and tried to diagnose using this information but no luck.

@CaptIgmu
Copy link
Contributor

Make sure certain pins are not connected when uploading programs! In my case, pin 12 was connected to an INT signal from a sensor and could not upload. There may be other ESP32 pins that are sensitive. Also, try DIO mode for the flash in boards.txt file . . .

@lbernstone
Copy link
Contributor

lbernstone commented Jun 16, 2018

gpio12 and gpio2 are particularly notable on this: https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio12. It can be burned into a state where it will not interfere with your boot. This should interfere with normal boot, not uploading though. I'm afraid your system may be dead. Can you post the link to where you bought it? Maybe we can shame the manufacturers into doing some qc.

@aniellod
Copy link
Author

@lbernstone Thanks. The only one who might need to be shamed is myself. I might have done something wrong to the board which broke it. I ordered two and the second one is fine. Perhaps too much voltage on pin 0 and 2.

@davidbono
Copy link

I had the same issue and fixed it by rotating 180° lopy4 board when plugin into the expansion board ... shame on me.

@pwpolar
Copy link

pwpolar commented Aug 2, 2018

I'm having this issue with an ESP32 DevKitC_V4 board. Loads fine and then all of a sudden get this message:
Flashing binaries to serial port COM27 (app at offset 0x10000)...
esptool.py v2.1
Serial<id=0x24dcfec, open=True>(port='COM27', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
Connecting......................................_____.....
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Sometimes power cycling board fixes problem other times does not. I can see ESP32 replying using scope on TXD0 but computer is not seeing response.

@dcartman
Copy link

I had this same issue with an ESP32 Dev Module V1, to "fix it" I held down the boot button while compiling/uploading the sketch from Arduino.

Once the sketch was uploaded I power cycled by unplugging the USB and plugging back in. Uploads worked fine after that for a while.

@Fuzzbinder
Copy link

I take it the port shows and that it just doesn't upload. I've bought a couple of dev boards that they didn't design well. I have to hold down the reset but after esptool starts to try to send for about a second or two and then release and it loads. All my other boards load with no hand holding. Hope that is what the problem is.

This just fixed the same issue for me. Thanks

@nello
Copy link

nello commented Oct 2, 2018

I get this error whenever the tx0 pin is connected to my breadboard. Letting it float free is the only thing that allows me to upload new code. Very strange. My board is an ESP-WROOM-32.

@nello
Copy link

nello commented Oct 8, 2018

FIXED: To be able to upload to the EP-WROOM-32 when connected to a breadboard, you need a 10K (or so) pull-down resistor between RX0 and GND.

@Amaktronix
Copy link

@dcartman Thanks. yours solution gave a effect.
The problem was solved for me
My module is DOIT ESP32 DEVKIT V1 which is the same of ESP32 Dev Module V1 .

fixed the same issue for me. Thanks

@lemonbuzz
Copy link

I have a custom board with the same issue. I get the 'waiting for download' prompt but the upload always times out.

@pjvander
Copy link

pjvander commented Jan 7, 2019

I ran into the same issue and couldn't resolve for the life of me. Turns out I have been shipped (twice, now) an ESP8266 in an ESP32 packaging. Configuring for the ESP8266 solved my issue, naturally. Throwing this out there in case this same thing happened to others.

@Stitch0
Copy link

Stitch0 commented Feb 8, 2019

Hi. In my case, pressing the "boot" button helped. Press button when starting download sketch.

@68gt500
Copy link

68gt500 commented Feb 23, 2019

I had the same problem on my Windows 10 PC.
In my case installing CP210x USB to UART Bridge VCP Drivers solved the issue.
Works perfectly, even at the highest baud rate of 921600.

@Paelgin
Copy link

Paelgin commented Mar 9, 2019

I had that Timeout problem, but it only just showed up when using my old Dell Inspiron 1525 (from 2006, but running Win10). My newer laptop had done fine (but sadly, it is not on vacation with me, only my old one) On a hunch, I went out to Best Buy and bought a USB 3.0 powered hub, and with great joy, I found that programming it now works through that hub.

I'm using a "ESP32-01 Breakout and Development Board" from www.ezsbc.com to make Geoff Bunza's "Simplified WiFi Throttle" that he described in Model Railroad Hobbyist (https://model-railroad-hobbyist.com/node/35652).

Phil in gorgeous Young Harris, Georgia, USA

@sravanth005

This comment was marked as off-topic.

@Gohith
Copy link

Gohith commented May 2, 2019

Hardware:

Board: ESP32 LOLIN w/OLED - ESP-WROM32
Core Installation/update date: (see below)
IDE name: Arduino IDE 1.8.5
Flash Frequency: 80Mhz
Upload Speed: Tried various

Description:

Unable to upload anything to this module.

Have another identical one and same sketch uploads and runs fine. Rules out cable, connection or computer. I tried to upload using esptool.py directly and also using FTDI but same problem.

How can I test if the board damaged? Any tips on how to revive it?

Debug Messages:

(/dev/ttyUSB1)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

Sketch uses 638418 bytes (48%) of program storage space. Maximum is 1310720 bytes.
Global variables use 38948 bytes (13%) of dynamic memory, leaving 255964 bytes for local variables. Maximum is 294912 bytes.
esptool.py v2.3.1
Connecting........_____....._____....._____....._____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Thanks

Just hold the BOOT switch while it says "Connecting......."
It solved for me.

@Parth7030
Copy link

I had the same problem on my Windows 10 PC.
In my case installing CP210x USB to UART Bridge VCP Drivers solved the issue.
Works perfectly, even at the highest baud rate of 921600.

Thanks, It worked for me...

@VijayJaybhay
Copy link

Make sure certain pins are not connected when uploading programs! In my case, pin 12 was connected to an INT signal from a sensor and could not upload. There may be other ESP32 pins that are sensitive. Also, try DIO mode for the flash in boards.txt file . . .

Thanks, it worked not sure why it is so

@beegee-tokyo
Copy link
Contributor

Reserved GPIOs - special use GPIOs

@daveyman123
Copy link

daveyman123 commented Jun 8, 2019

I have tried UART drivers. no pins are connected to anything. I am using the sparkfun thing if it matters.
I am getting this error and no series of button presses will fix it. How do I start over?

@nello
Copy link

nello commented Jun 8, 2019

@DaveyMan try a pull down resistor on RX0 (see my comment above).

@mikkieg
Copy link

mikkieg commented Jul 27, 2019

Had the same problem which seems to be fixed now with a 10uF cap between RST and GND

@gpratt3151
Copy link

I found my problem was with the USB port on my laptop. If I use a USB 3.0 cable (USB-A -> USB 3) in the USB 2.0 port, I get the exact error messages above. When I moved the cable to the USB 3.0 port it worked just fine. I didn't realize my laptop had a single 2.0 port which is the one I naturally use due to it's location. As I understand, it should have worked with the USB 2.0 port, but it does not on my laptop either due to the cable or the port. Hope this helps someone.

@mehtaSmitK
Copy link

Just make sure whether following conditions meet,

  1. Check if GPIO 0(IO0)) is connected with Ground(gnd),
  2. Press & Hold rst button when you are uploading the code,
  3. In my case, I had connected 5V output instead of 3 .3V output.

@men0
Copy link

men0 commented Nov 2, 2019

3. In my case, I had connected 5V output instead of 3 .3V output.

#3 did work for me! thanks a lot.

@night021
Copy link

night021 commented Nov 4, 2019

Just make sure whether following conditions meet,

  1. Check if GPIO 0(IO0)) is connected with Ground(gnd),
  2. Press & Hold rst button when you are uploading the code,
  3. In my case, I had connected 5V output instead of 3 .3V output.

Where is GPIO0 on esp32 dev kit v1

@lbernstone
Copy link
Contributor

GIS: esp32 dev kit v1 pin map
There are about 100 images there

@oabravo
Copy link

oabravo commented Aug 23, 2020

I had the same problem on my Windows 10 PC.
In my case installing CP210x USB to UART Bridge VCP Drivers solved the issue.
Works perfectly, even at the highest baud rate of 921600.

Thanks :D it worked!

@zatuliveter
Copy link

Thanks to @mikkieg

Had the same problem which seems to be fixed now with a 10uF cap between RST and GND

Here is how I fixed firmware upload on ESP32-DevKitC V4 with ESP-WROOM-32 board
No need to hold Boot button during upload.

esp32-board-upload-fix-no-boot-button-2

@rhyslewis-aws
Copy link

I can't say for sure which of these are required, but I got it working when I:

  • Changed the upload speed to 115200
  • Held down the reset button while the sketch was compiling, then released it after the Arduino IDE said, "Connecting ..."
  • Put a jumper between Gnd and 001

Once that was done I removed the jumper and USB, then reinserted USB, and the sketch was running fine.

@quantumfluctuations
Copy link

I too had the same issue..
I was working with my laptop which had a single USB 3.0 port and dual USB 2.0 ports
I then switched to my old laptop in which all the ports were USB 2.
This error did not fire when I used the ESP32 WROOM 32 board on my old laptop
I suggest everyone working on the ESP32 modules to use systems with uniform USB standard revisions

@Aidenir
Copy link

Aidenir commented Jun 5, 2021

Super strange, I was working on a program, uploading changes every half hour or so for like 4 hours, suddenly I'm getting this error out of nowhere... Tried multiple different modules, none work. Tried a Pro micro, that worked fine. What got me back up and running was googling "CP210x USB to UART Bridge VCP Drivers" like @68gt500 said, and now it works. Although now I do have to hold the boot button while it says connecting, which I didn't before :/

@willz1200
Copy link

I had a similar issue to this when attempting to program an ESP32-S2 under esp-idf. Upon entering programming mode the following error occurred.

esptool.py v3.1-dev
Serial port COM5
Connecting.....
Chip is ESP32-S2
Features: WiFi, ADC and temperature sensor calibration in BLK2 of efuse
Crystal is 40MHz
MAC: ##:##:##:##:##:##
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 3072 bytes to 143...

A fatal error occurred: Timed out waiting for packet content

The issue turned out to be a bad solder joint between the ESP32-S2 and flash chip (even though I could id the esp and flash using esptool).
After reworking the chips everything programs fine.

@b0xmaker
Copy link

b0xmaker commented Aug 4, 2021

Similar issue here. Using an Ubuntu VM through Windows 10, with an Adafruit Huzzah 32 (based on ESP32).

A fatal error occurred: Timed out waiting for packet content

I was able to resolve this issue by bumping up the USB hub speed, it was set to USB 1.1 but once changed to USB 3.0 I got it to work.
image

@markotime
Copy link

TTGO-T display unit. Would not communicate, port did not show up in WIN10 device manager. Noticed that an UNO using CH340 did appear later, showing port number, so reconnected TTGO. Nothing until I updated drivers, and all ok since. Surprised that versions using CP21XX and CH340 would be available, without showing in spec.

@HarborDesigns
Copy link

IMG_3421
I have a custom board where I am using an ESp32 Wroom module. I am not able to flash code via serial communication. I am using FTDI232 USB to UART for serial communication. I am able to get serial messages in my serial monitor which mean there is no issue in serial wires.

I have attached a capacitor and a pull up resistor on EN line. GPIO0 is also pulled to GND during flashing the code. Please see the attached rough schematic of my system and timing diagram for more information. I have jumped my EN and GPIO0 line from board to breadboard where I am manually jumping the EN & GPIO 0 wires to GND. This is just to be sure that I am pulling down the signals while booting and there is no noise or sudden voltage fluctuation while toggling the signals.

For extra precaution I have also pulled up or pulled low other strapping pins as shown in schematic. I am not sure where I am doing mistake.

While uploading the code I pull down first GPIO 0 line and then EN line to GND and later when I see _'Connecting........_____' message on my Arduino IDE terminal I pull up the EN line and keep pressing the GPIO0 line until the Arduino IDE display error message: 'A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header'

@atanisoft
Copy link
Collaborator

@HarborDesigns refer to any of the DevKit schematics (ie: https://dl.espressif.com/dl/schematics/esp32_devkitc_v4-sch-20180607a.pdf) for the DTR/RTS reset circuit requirements to have the board automatically enter download mode.

@HarborDesigns
Copy link

@atanisoft I have those two transistors on my board but to isolate the issue I have temporarily removed the transistors from board and manually doing it to figure out the problem. Its shouldn't matter if I do it manually if the signals are correctly timed.

@atanisoft
Copy link
Collaborator

If you force the esp32 into download mode esptool should just work. However, you will need to hold IO 0 low until it starts downloading firmware.

@HarborDesigns
Copy link

Yes, i should be able to do that but it is not flashing new code on ESP32. Does my rough timing diagram looks correct in my previous picture?

I know I can enter my ESP32 into program mode as I see following message on my serial monitor. Whenever my GPIO 0 is low and then when I toggle the EN signal from 1 (high) to 0 (low) and then back to 1(high). It shows following message which is good
'rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download'

Looks like it doesn't reads data over serial communication after that but my serial communication works. What I understand is that I can put ESP32 in program mode if my GPIO 0 is zero after reset and if my GPIO 0 is high after reset then it goes into normal mode. In my case, I can enter in and out of both modes and my serial communication prints that message but I can't flash new code because of packet header issue/ time out of the session.

@atanisoft
Copy link
Collaborator

I would suggest posting on esp32.com and have someone assist with a schematic review to ensure the hardware you have selected for your custom PCB will work as expected for esptool etc.

@Mathteus
Copy link

Mathteus commented Dec 16, 2021

Resume
I have an esp32 card that was compiling before normally, it has the code working inside it, but it stopped compiling I don't know how to solve it, could someone help me?

config
wifi-esp-wroom-32
ide arduino 1.8.18
board: esp32 wrover module
uploaad speed: 921600
flash frequency 80MHz
flash mode QIO
partition schema: default 4Mb
core debug level: none
port: ttyUSB0

things already tested
hold, press several times, press the boot - reset - boot + reset buttons from time to time during the compilation, place a capacitor in GND and GIO 0, place a capacitor between GND and 3v3

nothing went right with me will my plate burn?

@DaveStu
Copy link

DaveStu commented Jan 7, 2022

Hi all. I've had this board for a couple of months with a project I'm working on with someone else.
Its a TTGo display ESP32 with CP2104 USB to UART
I've been flashing .bin files with esphome flasher succesfully for the last few months, now suddenly it stopped taking a flash.
The screen will start to flash several times while esphome flasher tries to connect, but it fails, then boots back to previous code and is able to work with last upload, just no new flashing.
I've been all over forums and internet looking for solutions, tried to hold reset, button 1 and/or 2.
Tried different USB c data cables. I cannot disconnect board as its soldered in, to test out of circuit.
The port is correct and other variables, which were never changed but checked anyway

I'm now stuck with last code and cannot update our project. Can I bypass USB and flash via pins, like esp01 with USB flasher?
Up till now this board has been great, but this has now got me so frustrated.

Any clue anyone? Really strange all of a sudden. Thanks

##update##

After reluctantly desoldering TTGO board, I was able to flash it again. Then I resoldered it back onto the PCB attached back component at a time, the line elevel converter for LED strips was causing some short or glitch. I assume it has died or failed somehow.
I've now just left it disconnected and the TTGO flashes and functions fine.

@jparshook
Copy link

For what it's worth: I had issues with an ESP32 not flashing, even while holding boot or using a resistor. The other 4 boards that came with this board were working fine. I used a small convection oven at 450 F for 2 minutes to reflow the solder. The board in question is flashing now without any issues.

@cvcore
Copy link

cvcore commented Mar 17, 2022

Using m5stack-timer-cam here.
Setting upload_speed = 115200 instead of the default value solved the problem for me.

@thgfeller
Copy link

Same problem here with an ESP32-S 2AHMR
I have it connected to an ESP32-CAM-MB. That should be the official programming board. Has both reset and IO0 but no matter how I fiddle with them I receive always : "Failed to connect to ESP32: Timed out waiting for packet header". Arduino IDE says it is connected to Com4. But serial monitor never shows anything, not even after I pressed reset.

@Dasberacynthia
Copy link

I'm having the same problem with ESP-32 cam-S. Compiling is done perfectly but while uploading I am getting the error "failed to connect esp32:timed out waiting for packet header" repeatedly even when I am holding the reset button while uploading.
How can I find out if the camera module is working properly or not?If yes then what went wrong....if anyone have solution to my problem it'd be really helpful....

@adrianTNT
Copy link

2 years ago I had Timed out waiting for packet header error and it worked after I moved it in another USB port, probably didn't have enough power.

@Dasberacynthia
Copy link

Well....tried in another ports too...but still showing the same error message. How can I know if my camera module is working?..

@lbernstone
Copy link
Contributor

Cam modules often don't have a button on gpio0. You need to hold gpio0 low (ground) to put it into programming mode.

@adrianTNT
Copy link

The camera module is a module on main ESP board ? If so, I would try with camera and/or other modules/sensors disconnected. If It starts, it could be too much power draw or incorrectly connected pin(s).

@VojtechBartoska
Copy link
Contributor

@PilnyTomas good candidate for FAQ.

@PilnyTomas
Copy link
Contributor

This will be solved by the #8241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: For reference Common questions & problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.