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

Viewed 16745

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
6 Answers

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 wires 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?

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.

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

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.

Related