Why I have to keep pressed reset button every time when loading?

Otherwise I get this error =>
Connecting……_____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2

Which board are you using?

esp32doit-devkit-v1 is my board.

Please try a full flash erase with “pio run -t erase” or use the Espressif flashtool (windows only).

Another issue could be, that the USB-UART bridge (CP210x) is not able to drive the EN and/or IO0 pin of the ESP32. These two pins are used to reset the controller and enter firmware loader mode. Have you connected any of these two pins externally?

EDIT:
And at leaste make sure, that you have set the right board (and optional upload_protocol) inside the platformio.ini file.

Thanks for reply. I will try erase operation.
The mystery is that the same code works OK in Arduino IDE.

That’s a interesting fact. (I think you mean the upload/programming of the firmware works fine with the Arduino IDE :wink: )
I will check this later this evening and reply to you.

Unfortunately I can’t really say what is the difference between the Arduino and the Platformio upload script (both uses esptool.py). Therefore I have no solution, just a bunch of “give it a try” ideas:

  • Try other USB port with or without USB-Hub
  • Try other USB cable
  • Reduce upload speed in platformio.ini with upload_speed eg. “upload_speed = 115200”
  • Install latest CP210x USB-UART driver

Greetings

Thanks a lot Julianobst for your help.:+1:

I would like to look into this as well. I have the same issue. Mine however did work for awhile then it quit.

I’m using PlatformIO with vscode on windows 7. I have the ESP32-DevkitC-V4 from Espressif.
I have tried multiple of these boards with the same result.
Even after the upgrade to 1.6 it still does not work.

Came across this thread while having the same problem.
Found this video on YouTube: https://www.youtube.com/watch?v=SlAG6DFLnBE
It said to put a 10 uF capacitor between ENA pin and ground.
Had something to do with some badly made boards.

It worked for me.