A fatal error occurred: Failed to connect to ESP32:

Hello!

I have tried so many different things and have finally resorted to my first forum question ever lol.

I have an ESP32-Wroom-32D that I have used in the past and it has worked no problem with my arduino ide on my laptop. I finally pulled it back out and tested some stuff on my desktop at home. But I get the following error anytime I try to upload anything (even a "hello world!"):

Sketch uses 265953 bytes (20%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20224 bytes (6%) of dynamic memory, leaving 307456 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.6
Serial port COM4
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.
For troubleshooting steps visit: Troubleshooting - ESP32 - — esptool.py latest documentation
Failed uploading: uploading error: exit status 2

I have installed the esp32 by espressif, made sure I was using the right ports (even went through device manager), made sure I had the additional url in the preferences, removed and re-installed, and tried a handful of chat gpt's suggestions and some suggestions from other's on this forum.

The ONLY THING THAT WORKS is when I do the manual override boot and EN. When I upload code and hold down the boot button it usually will work. But its really cumbersome to have to do that every time; and id like for it to just accept the things I upload to it.
I think that the boot does something with the firmware of the chip from what I have read... but I really have no idea what thats all about, but perhaps I manually overwrote the firmware on my esp32 and now its not functioning properly bc I did that??

Overall, ive tried a lot of things and have no idea why its not working. If anyone has any suggestions I would greatly appreciate it! PS Idk how active I will be on the forum but I will try to be since I am the one asking and you are spending your time offering me suggestions.

Thank you!

Hi @amac_555 ,

I do not know what happened to your ESP32 board but you may try this suggestion

https://randomnerdtutorials.com/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header/

You may wire the capacitor using a breadboard to test it if it's working.

Good luck!
ec2021

P.S.:

Feel free to read also here (chapter 4):

https://randomnerdtutorials.com/esp32-troubleshooting-guide/

where the authors state

To be honest we’re not sure why that happens with the newer boards. We don’t have any ESP32 board with that behavior. We think there might be something different with your specific board or the Arduino IDE fails to send the right command sequence to put the ESP32 automatically in flashing/uploading mode.

It could also happen if your using an ESP32 with components wired to certain GPIO pins ...

There are five strapping pins: GPIO0, GPIO2, GPIO5, GPIO12, and GPIO15.

Source: https://lastminuteengineers.com/esp32-pinout-reference/#:~:text=There%20are%20five%20strapping%20pins,program%20to%20the%20flash%20memory)..)

Hey @ec2021,

I appreciate the response. I took a read of those links you sent.

I actually went back to my laptop where this esp32 has worked before and had absolutely no problem uploading to it. I had some development that I thought solved it, but ultimately I ran into the same issue.

I noticed as soon as I opened the Arduino IDE on my laptop it prompted to update the ide, but I chose not to update the ide.

I looked through to see what was different. Heres what I noticed:

-For one I think I had the wrong board selected, on my laptop it was labeled as ESP32-WROOM-DA Module. I guess in hindsight that was obvious since i have wroom model...

-Additionally, I noticed I had "CH341SER" driver on my laptop I that I could not find on my desktop. So I ended up uninstalling all drivers for the UART and USB connections from silicon, then redownloaded them and downloaded the "CH341SER." Which I thought solved it because once I did that everytime I plugged in on my dfevice manager it showed up as "COM3" where previously it would only show up as "COM4" AND I even got an error that said it couldnt detect COM4, but that only happend once.

In the end it did not work and I ended up with the same error as I started with.
I think I am going to try and uninstall and then reinstall the arduino ide and see what happens.

I just find it weird that it works fine on my laptop but not my desktop and I wonder if updating my arduino ide on my laptop would affect anything.

We shall see!

Did I understand correctly that you are able to upload sketches at your laptop?

If yes it might be interesting to check this:

  • Upload a simple sketch that transmits e.g. the time in millis every second via Serial
  • Test it at the laptop
  • Now connect it to your desktop and check Serial output

If it works you know that the serial data transmission is ok. It's not the solution but you might focus on the upload process rather than the serial driver.

You are quite the wizard @ec2021 I really appreciate it.

Thats a great idea to narrow the issues down. Ill give it a try and let you know!