ri1_
ri1_

Reputation: 127

How to fix Failed to connect to ESP32: Timed out waiting for packet header error?

I tried to flash an ESP32 but I didn't succeed, I tried with esptool.py and Arduino IDE. I tried to press the boot button and reset but it didn't work. Here is the error:

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

Upvotes: 11

Views: 63555

Answers (14)

Shahrouz Shakeri
Shahrouz Shakeri

Reputation: 1

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

To solve this problem, disconnect TX0 and RX0 when uploading

Upvotes: -1

Zachary Vorhies
Zachary Vorhies

Reputation: 541

I'm on windows.

The only thing that worked for me was plugging the device to my MacOSX M1. It then successfully programs. Then I move it back to windows and it works there too now.

Installing the driver, doing a pulldown of GPIO2 to GND/3.3v didn't work for me. It appears that something inside the MCU is getting into a pad state.

Upvotes: 0

Viraj Nawarathna
Viraj Nawarathna

Reputation: 1

Download and install the latest CP2102 driver. This sloved the issue permenetly for me.

Upvotes: 0

Punnerud
Punnerud

Reputation: 8021

Changing by upload speed from 921600bps to 115200bps fixed it. No need to press any buttons.

Upvotes: 0

sumanta majumdar
sumanta majumdar

Reputation: 1

in my case buttons are new but not shorting properly as multimeter showed ..opened both scratched resoldered and all working

Upvotes: 0

Richard Campbell
Richard Campbell

Reputation: 91

If using the Arduino IDE, try lowering the upload speed (Tools/Upload Speed). Lowering mine from 921600 to 460800 did the trick.

First ensure that you are in download mode:

  • Start the serial monitor and set the speed (mine is 115200).
  • While pressing the "boot" button, press and release the "en" button (your buttons may be labeled differently).
  • You should see something like this on the serial monitor: waiting for download
  • Now start the upload

My development machine, a 2013 iMac is connected via USB to the USB-c port on my ESP32 Dev Module. Apparently the iMac's USB or ESP32 board's USB cannot keep up at the 921600 upload speed.

Upvotes: 9

Rizmy Abdulla
Rizmy Abdulla

Reputation: 31

This technique definitely working

Goto Tools > programmer, Select ISP and Upload Your Code.

if you can't see any programmer, then download 1.8.12 version.

https://www.arduino.cc/en/software/OldSoftwareReleases

Upvotes: 1

Ranjith.A
Ranjith.A

Reputation: 1

Install expressif.exe and port drivers,connect the port and flash the esp32 ,upload the code using ardiuno,solve the error

Upvotes: 0

Tarvo Mäesepp
Tarvo Mäesepp

Reputation: 4533

DISCLAIMER! May not be correct answer but may help to save time for someone.

Quick answer if you do not want read my experience: Disconnect all wires from pins and try uploading again! It may help.

I came across with the same error and could not figure it out. I first thought that something is wrong with the code, because it happened after I edited working code while figuring out where to connect what pin 😀. I also wasn't able to upload simple HelloWorld after it happened with connected wires. But then I disconnected all my wires from the board and the upload works fine.

I can not figure out the WHY factor but I think it must had been the input/data pin I was using, in my case D13. I have the DevKit with fewer pins. Maybe someone can comment why connected pins may make the error come up?

Upvotes: 9

ri1_
ri1_

Reputation: 127

Just download the drivers x)

CP210x: CP210x USB to UART Bridge VCP Drivers

FTDI: FTDI Virtual COM Port Drivers

Upvotes: 0

Muhammad Fadhil
Muhammad Fadhil

Reputation: 29

Try to do this one after the other

  1. Press the boot button when press uploading button until it write the code.
  2. Try disconnect esp32 from the board/header/pcb that you are using right at the time.
  3. Disconnect any other connection that your esp32 might have.
  4. Do not connect to anything even your hand if possible.
  5. Try put it in something that doesnt have a moist surface. look pic number 3.

MY CASES(30 pin version):

Case 1: I dont know why. I was connecting the pin to a female header it doesnt work and sometimes it just work like that. look pic number 1.

Case 2: when Im holding esp32 on my hand sometimes it wont work then i put it on my table and another time it doing well.

Case 3: pressing boot button when uploading it helped sometimes, and the other time it just work like it should.

Case 4: when it connected to pcb its simply just wont work, but when disconnected boom it work like nothing ever happen. look pic number 2.

Maybe just maybe something with capacitive or something like that (just assuming because number Case 1). hope that will help you out.

pic 1pic 2pic 3

Upvotes: 2

Asder Knaster
Asder Knaster

Reputation: 104

On some AliExpress-like ESP32s you have to press the boot button in order to upload your sketch. If you are watching the Arduino IDE console ouput and Connecting ... appears, you have to press the boot button for approximately 2 seconds until the console output changes.

Upvotes: 2

IanO
IanO

Reputation: 9

With Arduino IDE Make sure the Com port is selected under Tools menu. My experience with ESP32 is Com 5. If it is not available as an option, try changing USB ports and/or re-select Tools - Board - ESP32 dev module.

Watch the "Compiling Sketch" window. Press the "Boot" button as soon as you get the red message "Serial port Com 5" You can release the button as soon as it starts to upload. If this doesn't work,try plugging into another USB port.

The Reset button only resets the uploaded sketch to re-initialise and has nothing to do with the uploading.

Upvotes: 0

Sercan
Sercan

Reputation: 5081

To make your ESP32 board go into flashing/uploading mode automatically, you can connect a 10 μF electrolytic capacitor between the EN pin and GND. When I had the same problem, when I followed this advice, the problem was solved.


References

Upvotes: 3

Related Questions