espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.23k stars 7.34k forks source link

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

Closed aniellod closed 1 year ago

aniellod commented 6 years ago

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

rhyslewis-aws commented 3 years ago

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

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

quantumfluctuations commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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_REOV2)) 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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

thgfeller commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

lbernstone commented 1 year ago

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

adrianTNT commented 1 year ago

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 commented 1 year ago

@PilnyTomas good candidate for FAQ.

PilnyTomas commented 1 year ago

This will be solved by the #8241