Learn how to fix the Fatal Error Occurred: “Failed to connect to ESP32: Timed out waiting for packet header” error when trying to upload new code to your ESP32 board once for all.
![[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header](https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/02/esp32-waiting-for-packet-header-featured.jpg?resize=828%2C466&quality=100&strip=all&ssl=1)
Why are you getting this error?
Some ESP32 development boards (read Best ESP32 boards) don’t go into flashing/uploading mode automatically when uploading a new code.
This means that when you try to upload a new sketch to your ESP32, the Arduino IDE fails to connect to your board, and you get the following error message:

Holding the BOOT/FLASH button
One of the ways to solve this is holding-down the “BOOT/FLASH” button in your ESP32 board while uploading a new sketch at the same time. But having to worry about this every time you want to upload new code can be tedious, specially when you’re testing and debugging your code. There is a way to fix this once for all – no need to hold down the “BOOT/FLASH” button anymore.
How to fix the Error?
To make your ESP32 board go into flashing/uploading mode automatically, you can connect a 10 uF electrolytic capacitor between the EN pin and GND.
You may want to test this setup first on a breadboard to make sure it works for your ESP32 development board.

Note: electrolytic capacitors have polarity. The white/grey stripe indicates the negative lead.
If it works, then you can solder the 10 uF electrolytic capacitor to the board. Since the EN and GND pins are far apart from each other, you can simply connect the capacitor between the EN and the GND of the ESP32 chip as shown in the schematic diagram below:

Recommended: ESP32 Pinout Reference: Which GPIO pins should you use?
The following figure shows how my ESP32 looks like after soldering the capacitor. It doesn’t occupy much space, and fortunately you won’t get more trouble connecting to the ESP32 when uploading new code.

Before trying to upload a new code, you should check the connections with a multimeter in continuity mode – check that you haven’t inadvertently solder anything to the next pin.

If everything is soldered properly, you won’t need to press the BOOT button when uploading new code. You also won’t get the Fatal Error Occurred: “Failed to connect to ESP32: Timed out waiting for packet header”.

Wrapping Up
We hope you’ve found this trick useful and it solved your problem. Thanks to Ben Hall for the suggestion.
- For more ESP32 troubleshooting tips, consult the ESP32 troubleshooting guide.
- To learn more about ESP32 enroll in the Learn ESP32 with Arduino IDE course.
- More projects about ESP32: 20+ ESP32 Projects and Tutorials
I wonder what would occur if I used a 100uf Capacitor instead of the 10uf one as recommended in the post above? Would it hurt the ESP board?
Did you try the 100uF Capacitor?
For me it worked only with 100uF capacitor. I tried with many capacitors ranging from 10-470 uF. There wasn’t en pin in my ESP32s board so i soldered the third one on the chip and the first one.
Before doing any soldering make sure that you are using the correct GND pin. On my ESP32 Wroom Devkit V2 , the pin next to the 5V pin is incorrectly labelled as GND whereas it should have been CMD, and using it by mistake gave this error message
I have an ESP32 with this problem. I have added the capacitor as described in the article. Now the upload start automatically, but the software does not start. I I press the reset I obtain the following message
rst:0x1 (POWERON_RESET),boot:0x0 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_FEO_V2))
waiting for download
the only way to start the program is to switch off and the switch on again the esp32.
Any Idea?
I have resolved the problem in my previous post by adding a resistor of one 1kohm between the pin EN and the 3v.
Now the upload runs automatically and the reset maintain its function.
Thank you for sharing that solution.
Regards,
Sara
I would recommend using OTA to program the ESP32.
Elegant OTA allows me to save my file from Arduino as a binary, then upload it quickly without the need to press any button by going to /upload
Even better I don’t need a usb connection or to be the same location of the device.
https://github.com/ayushsharma82/ElegantOTA
https://github.com/ayushsharma82/AsyncElegantOTA
Hi.
Thanks for sharing that.
Regards,
Sara
I would like to add that in some cases, with some esp32 I must add a 47 uF capacitor + resistence of 1Kohm for resolving the problem.
Muito Obrigado pelo excelente post, me ajudou e muito e tenho certeza que vai ajudar muitas outras pessoas. “Compartilhar conhecimento só enriqueci o nosso saber”
Obrigada 🙂
¡gracias!
por la informacion que deberia venir con la placa
Thanks 🙂
Hello, thanks for the info.
I have the same problem, but the device I’m using is ESP-32 CAM, so the pinouts are different from the original ESP-32. Do you have a solution for this? Thanks again in advance.
Hi Budi.
To upload code to the ESP32-CAM you need an FTDI programmer. Please make sure that you have RX and TX pins wired correctly.
Also, very important: GPIO0 needs to be connected to GND, otherwise the ESP32 will not be in flashing mode: https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/03/ESP32-CAM-wiring-FTDI1.png
I hope this helps.
Regards,
Sara
I have a Lolin D32 board which was giving this error. It has only one button(Reset). I put the capacitor like suggested above but the error was persistent. As a last ditch effort I used a jumper on GPIO0 to GND during compile and upload(I use Arduino IDE). Now the code is uploaded without a problem. I remove this jumper and the board functions as programmed.
Hi.
Thank you for sharing your solution. It will certainly be useful for other readers that use the Lolin D32 board.
Regards,
SAra
Thank you for the article. I have exactly the same board as in your pictures. It was enough to use 2.5 uF and no resistor was needed. However I didn’t like the metal can of the capacitor so close to the antenna. An alternative location is negative to the pin of the AMS1117 that is closest to the USB connector, positive to the middle pin of the transistor closest to D2. And of course if project allows, the capacitor can be applied on the underlying project PCB.
Many thanks, it worked!
Is this for esp8266 or is it just in case of this error in esp32? Well, I noticed that the sketch loads faster.
Another thank you, this solved my problem as well. Great stuff Rui and Sara, keep it comming 🙂
Hi! How remove error (A fatal error occurred: Timed out waiting for packet header) to ESP32-CAM Esp32s module ?
Hi Vitali.
That means that your ESP32-CAM is not in flashing mode.
See our troubleshooting guide and follow all the exact steps to put the EPS32 in flashing mode: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/ its in bullet 1.
I hope this helps.
Regards,
Sara
Hi,
I’m getting error “Connecting…….._____….._____….._____….._____….._____….._____…..____An error occurred while uploading the sketch”
its a Webcam ESP32s.
I’ve been able to connect to “factory setting AP” and test the camera and wifi ok but doesn’t matter what I try I can get it to upload a new sketch. I have two and one works as expected but the other is a no go.
Would try to add a 10 uF electrolytic capacitor but the pinout on the Webcam ESP32 is different from the image shown above. Do you have the EN pin placement for Webcam ESP 32?
Any ideas?
Hi Gary.
That error means that your ESP32-CAM is not in flashing mode when uploading code.
Make sure you follow the exact same steps we describe in our troubleshooting guide, bullet 1: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
I hope this helps.
Regards,
Sara
Hi Sarah thanks for the reply but I had followed all the troubleshooting elements of the guidelines. I have one esp32 webcam that works so i know my setup is correct.
My real question was: were is EN pin on the esp32 webcam so I could try the capacitor fix. The esp32 in that example was not a webcam version.
Thanks! Works for me!!
Thanks for posting the solution. I had been using the ESP32 on my Windows 10 desktop with no issues uploading. Wanted to move over to my MAC Laptop. First issue was the lack of USB driver on the MAC. Found info on that, but then it kept failing to connect – timing out. I assumed it was still an issue with the USB Port / Driver, till I saw your comment about holding down the Boot button throughout the upload process. Worked perfectly. Thank you.
Hi Steve.
I’m glad this solved your problem.
Have fun programming your ESP32 board 🙂
Regards,
Sara
Hey Sara Santos!
I pulled up EN to 3v3 with a 10K ohm resistor and a switch to ground it while uploading.
I Pulled up IO0 to 3.3V using a 10K ohm resistor and A button switch to pull it down to GND while uploading the code.
The Tx and Rx are also correctly connected to the FTDI programmer(PS. I’m using the same 3.3V- 5V programmer that I use for Esp8266).
And still I am receiving this error. I have even tried attaching capacitor between the EN pin and the gnd. Still the code is just not flashing.
It flashed once and I was able to blink a LED, but after that the device is just not flashing the code.!
Please suggest a solution 🙂
“”Connecting…….._____….._____….._____….._____….._____….._____…..____An error occurred while uploading the sketch
_
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header””
Hi.
Are you using an ESP32-CAM?
In that case, you should follow our ESP32-CAM troubleshooting guide, bullet 1: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
I hope this helps.
Regards,
Sara
Vielen Dank für die Info – nun funktioniert es!
Great!
Regards.
Sara
I am trying to connect with Custom ESP32 Board, Here I have used USB to UART converter for programming the ESP32. While programing first time it showed the timed out and waiting for packet header After I used 10uF capacitor across EN and Ground pin first time it’s programmed fine, Next time I tried to program its showes the same error.
I don’t know how to resolve this.
Usa un condensatore elettrolitico da 6.8 uF 25v
Worked fine, thanks!
Thanks for this tip.
I have a Heltec LoRa ESP32 with OLED. It has a RST pin, but not EN. Will this trick work for me on the RST pin?
Hi Rick.
Yes, It think it should work.
I recommend testing the circuit on a breadboard first to make sure it works, and only then solder the capacitor to your board.
Regards,
Sara
Hi, Sara.
Thanks for really quick reply!
I just tried it. The cap slows the connection operation a few seconds, but once it connects it still gives the timeout error. My esp32 has a lot of serial activity going on – GPS, OLED, LoRa, SD Card – which I think challenges the USB flashing.
On another note, I’m using Windows 10, which has the irritating habit of frequently causing the serial port to lose my esptool script, forcing me to restart the PC. Ever see that issue?
Thanks!
Hi Rick.
The timeout error means that the ESP is not in flashing mode (to receive the code).
Usually, the solution is to press the BOOT button when you start seeing the dots appearing on the serial monitor.
In the board you’re using, I think it is the PRG button you need to press when you see the dots.
Pressing the PRG button solves the problem?
Unfortunately, I don’t have a board like that to experiment.
I usually don’t have problems with the serial port. But sometimes if your ESP32 needs a lot of current to operate (like you have), your usb port might not provide enough power and some “strange” things can happen like disconnecting from your computer and having to restart.
Regards,
Sara
Hi, Sara.
I found the flashing worked when I temporarily removed one of the peripheral device that was drawing power through the ESP32_LoRa chip. After flashing I reconnected it, and everything is working great. Thanks, again!
I have resolved the problem.
In my case, there is a jumper (on the FTDI programmer) which sets the output to be 3.3V or 5V.
It should go along with the power supply pin you use on the ESP32 (3.3V or 5V pin).
Hope this helps.
That’s right!
Thanks for sharing 😀
I found my problem was with the USB port on my laptop. If I use a USB 3.0 cable (USB-A -> USB 3) in the USB 2.0 port, I get the exact error messages above. When I moved the cable to the USB 3.0 port it worked just fine. I didn’t realize my laptop had a single 2.0 port which is the one I naturally use due to it’s location. As I understand, it should have worked with the USB 2.0 port, but it does not on my laptop either due to the cable or the port. Hope this helps someone.
Thanks for sharing Greg.
This can be the issue of many of our readers.
Regards,
Sara
Thanks Dude ! I finally resolved this problem after trying a week
I just bought an esp32 , and I am a beginner .
when I upload the blink , this failed message comes, please help me
A fatal error occurred: failed to connect to ESP32: timee out waiting for packet header
Hi.
I recommend following the suggestion in this article.
Also, you may need to reduce the upload rate in your Arduino IDE in Tools > Upoload Speed.
I hope this helps.
Regards,
Sara
disconnect any Device From ESP8266 …Compile —- Upload
it’s work Form Me .
yooo! thanks dude for sharing this,it worked for my esp32sim800l module
For me with the 10uF the ESP32 did not start the program after the download.
With a 1uF the ESP32 starts the program automatically after the download.
Checking the board, it looks like the CP2102 (USB to Serial) is not an original one, as it has no label on it.
On another ESP32 (Which is working normaly) the CP2102 has a label printed on top.
Another solution!! I found that setting my upload speed to 57600 fixed this issue!!!
It works for me. Thank you.
Hi:
I am using a LOLIN D1 Mini. After several successful uploadings I suddenly got this error; however this board does not have an EN Pin and it only has a RST .
Do you have any suggestion to correct the problem?
Thanks in advance, Gerardo
Hi Gerardo.
EN and RST is the same.
I don’t know if this trick works for the ESP8266. This article was written for the ESP32.
Regards,
Sara
Thank you Sara, regards.
Hi. Very Nice tutorial. After connect a 10 uF electrolytic capacitor it work just fine for me. Thanks!
Great!
I note that Expressif recommends to load the En line with a 100nF cap if you have programming “connecting” problems
https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
I had the same problem on a NodeMCU-32s.
The nice part is that the En line is right next to the 3.3V line and at AC all power pins are the same so connecting a cap to the 3.3V line or Gnd will provide the same filtering (assuming this cap provides noise filtering or slew limiting). I used a 0805 100nF MLCC which just fit between the 0.1″ spaced pins 1 and 2 (En and 3.3V) on the top of the NodeMCU. Now it programmes perfectly.
A large cap caused me problems with reset after programming but this smaller cap works fine.
Hi Stephen.
Thanks for sharing that.
Regards,
Sara
thank’s so much for the sharing .
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
Soldered the capacitor to EN and GND.
Tried this thing as well: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
not working.
I’m using ESP32 CAM AI-Thinker
5V, tested ever single connections with volt meter. Everything works fine.
Tried all possible ways.
Watched like 3 hours of youtube.
Doesn’t fix the problem. Any suggestions? I would really appretiate that.
Hi.
Where did you connect the 5V power source?
Make sure that you connect your power source to the 5V pin not VCC pin.
That error means that the ESP32-CAM is not in flashing mode.
Make sure that your GPIO 0 is connected to GND.
Read this post carefully and make sure that you follow ALL the steps.: https://randomnerdtutorials.com/program-upload-code-esp32-cam/
regards,
Sara
Never mind. It was ESP-01 and https://www.youtube.com/watch?v=u78W3GKtcrw this video solved the problem.
Sorry wrong post, I replaced the capacitor with lower capacitance and it solved.
First of all – thank you for sharing this solution.
I recently bought two ESP32-boards from OLIMEX and had problems uploading. It was very strange, since it worked the first time, but never again ??? After googling around for quite some time, I found your solution.
DanKoloff from Olimex gave me some tips too, but it was a capacitor at EN that helped. From curiosity I tested different caps, diffent resistors and the two Olimex-boards plus a AZ-delivery ESP32-Dev which I had bought the week before.
You can find the table of my tests at
https://github.com/OLIMEX/ESP32-POE/issues/11
Regards, Karl
Hi Karl.
I’m glad you solved your problem and thanks for sharing that table. It may be useful for many of our readers.
Regards,
Sara
Hi Sara,
I was not really satisfied with this solution. Also I noticed, that the RST-button did not always work. Shortly I heard of power-monitoring ICs for the gereation of a clean reset.
So I ordered a few TPS3809K33 (SMD) and a few MCP102-300 (for breadboard tests). The ESP32-PoE from Olimex has a RST-button from EN to GND. Since the MCP102 has an open collector output, you can connect it directly to ESP_EN (pin4 on EXTERN1). But if you use the TPS3809 (it has a push-pull output), I suggest a resistor in between the output of the IC and EN. I use 4k7 since it only draws current while RST is pressed.
For me this is the best solution, since it is not dependent on the time constant and now even the RST-button works flawlessly. Now I can upload code and use the RST-button.
Regards, Karl
Hey guys,
I admit I’ve never encountered this problem before. The board I’ve been using so far seems to be free of this malfunction… But since I unpacked 3 other identical boards (that I bought at the same place), I’m now facing the problem.
For those who are interested, here are the boards I use:
https://www.aliexpress.com/item/33057018346.html
I guess I can compile my projects with the DoIt ESP32 DevKit v1 model. Anyway, that’s what I’ve been doing since the beginning, and it works. If you think it’s not the most appropriate model for compiling, don’t hesitate to let me know!
I’ve tried by all means to solve the problem with software, but without success. And I stumbled upon a post on the forum with the reference to this article… A providential chance!
The solution is simple and efficient. Nevertheless, I have a small question: why 10 µF? How did you choose this value? In an empirical way, or is there a logical explanation for that?
In any case, a big thank you… I can finally stop pulling my hair out on this thing that was driving me crazy.
All the best,
Steph
Hi Steph,
I did a few tests with OLIMEX-boards. see:
You can find the table of my tests at
https://github.com/OLIMEX/ESP32-POE/issues/11
But as I wrote later this can give problems with the RST-button. So, as I wrote in my last post I now use a MCP102-300 (for breadboard tests) and will late use TPS3809K33 (SMD) on the EN-pin.
All the best,
Karl
Indeed, as far as I’m concerned, my boards are very widespread, and they are very similar to Rui and Sara’s favorite boards… so it’s easier to find a solution.
On the other hand, thanks for the info about the MCP102, it’s good to know!
Thanks Karl!
Does this work on ESP32-CAM ?
Read this for the ESP32-CAM: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Very handy little trick. I was suffering with this error for a while, but thanks to you i can use my boards just fine 🙂
Great!
Hey Dear,
In my case, I tried 33uF.
It really works, Thanks a lot.
I own a TTGO LoRa Esp32 v2 and I am struggling to upload the new code (.bin). I treat it with really care, I was uploading and testing some codes and suddenly, it stop allowing me to upload new programs.
I have tried many different things and combinations of all of them:
usb ports
usb wires
2 linux
windows
arduino ide
platformio
pressing the RST button (it doesn’t have boot)
changing the baud rate (upload speed)
changing the flash freq
changing the board type (TTGO Lora32 v1, v2, Heltec…)
And I get always this:
python /home/user/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py –chip esp32 –port /dev/ttyUSB0 –baud 115200 –before default_reset –after hard_reset write_flash -z –flash_mode dio –flash_freq 80m –flash_size detect 0xe000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin 0x1000 /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 /tmp/arduino_build_119083/WiFiScan.ino.bin 0x8000 /tmp/arduino_build_119083/WiFiScan.ino.partitions.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting…….._____….._____….._____….._____….._____….._____…..____An error occurred while uploading the sketch
Failed to connect to ESP32: Timed out waiting for packet header
The weird thing is that I achieved loading sample programs like OLEDHelloWorld and it is working (showing that program in the OLED), but I cannot boot/upload any other program since that happened (yesterday).
Any idea?
I faced the same problem, after adding 10uF capacitor it still could not work.
Finally, I found that problem caused by myself, I connected TX0 RX0 pin to RS485 transceiever. After moved the transceiver to UART2 the problem gone.
I am using a DOIT ESP32 WROOM-32D board and facing same issue. Adding a 10uF capacitor solves the sketch loading problem but the board needs to be manually reset every time.
Hi.
The reset is needed so that the ESP32 starts running the code.
Regards,
Sara
Hi Sara
On the RPi /Node red side everything seems fine, with mqtt nodes showing connected.
Then, to download the code, I tried a several ESPs, using a capacitor etc and nothing worked. Finally I found that I had an ESP 12F, tried this, and amazingly it uploaded. However, when I went to do the test as you suggested (before building the DHT circuit) the message I get I failed to get an MQTT connection.
My router says that I have an IP address for the ESP12F,
If you have any suggestions why I can’t connected to the MQTT on RPI – that would be much appreciated. I put the correct address of my RPi in the code and included the 1883 port in the address. So frustrating when you get so close.
Hello,
I have the AI Thinker module of ESP32-CAM. My problem is similar but at a later stage. When I upload the sketch, it can connect and start writing, however at the end it fails with the same error as above. Here is the output:
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting…….._
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: f0:08:d1:76:94:38
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Configuring flash size…
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Compressed 8192 bytes to 47…
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4217.0 kbit/s)…
A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header
Hi.
Take a look at the ESP32-CAM troubleshooting guide: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/
Regards,
Sara
Good day,
Can this trick be done by only using the bread board and not soldering.
Rgds.
Yes.
I just added a 10uF cap to a little breadboard I have the ESP board on, and it worked for me as well! Thank you
Great!
Hi, I put 10 uF electr. (smd) cap.
It was not working.
Then i put an 1k resistor (THT) between rst and 3v3
It was not working.
Then take the resistor and now it is working 😀 😀 (cap. is still soldered)
I really do not understand yet, but maybe this can help sy else too.
Hi all,
For those who find ESP WROOM 32 not flashing, no need for capacitor or to press BOOT key.. just change the board to “ESP32 Dev Module”. It works like a charm
Currently I’m testing a nodeMCU ESP32 with 38 pins and on 1µF capacitor (metal-film) works fine to solve the flash-problem. I can imagine that for this particular problem a metal-film capatictor is more suitable than an electrolytic capacitor. Anyway it’s much more fun that pressing the EN-button every time. Thank you for this hint and of course for all your helpful tutorials.
Thanks you very much. It is working now.
After lots of experimentation with different RC timings on EN, different bulk capacitance and PS filtering, I eventually discovered that this is a regression in esptoolpy 2.6 and 2.8. Using version 2.1, my ESP32 will flash perfectly every time at up to 430kbps. I’ve reported this to esptool (https://github.com/espressif/esptool/issues/570) and hopefully they’ll be able to figure it out. For folks using Platform IO, you can add the following to your platformio.ini to cause it to use esptoolpy 2.1:
platform_packages = [email protected].0
excellent thought. It worked.
i also have the same problem but i am using esp32 ttgo t call and i tried it but still can’t?
This is my solution for the board Lolin32 Lite
Arduino IDE
Board : “ESP32 Dev Module”
Upload Speed: “115200”
Cpu frequency: “240Mhz”
Flash Frequency:”80Mhz”
Before:
“A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header”
Then Do this: Remove any connector from the board or at least from 3.3 pin
After:
“Hash of data verified.
Leaving…
Hard resetting via RTS pin…”
It’s working!
Ciao 🙂
Hello All,
I am unable to upload the blink example to ESP32. i am using ESP32 devkit v1. I tried to hold boot button and momentarily pressed EN button for the upload. It always fail with following error message. I tried with different capacitor value but still failing. In monitor mode when i pressed boot button and EN. It shows waiting for download in terminal. I closed the terminal and then tried to upload again but so far i have not able to upload the code once. Any help would be appreciated. I tried with different USB cable but still not working. i tried with Arduino IDE also using IDF framework (terminal build) but nothing works. i wanted to try any other suggestion before i would like to buy new ESP32 dev kit again.
Flash logs from Terminal
Executing action: flash
Running ninja in directory c:\users\mohan\esp\esp-idf\examples\get-started\blink\build
Executing “ninja flash”…
[1/4] Performing build step for ‘bootloader’
ninja: no work to do.
[1/2] cmd.exe /C “cd /D C:\Users\Mohan\esp\esp-idf\components\esptool_py…” -P C:/Users/Mohan/esp/esp-idf/components/esptool_py/run_esptool.cmake”
esptool.py –chip esp32 -p COM4 -b 115200 –before=default_reset –after=hard_reset write_flash –flash_mode dio –flash_freq 40m –flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 blink.bin
esptool.py v3.0
Serial port COM4
Connecting…….._____….._____….._____….._____….._____….._____….._____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
CMake Error at run_cmd.cmake:14 (message):
esptool.py failed
Call Stack (most recent call first):
run_esptool.cmake:21 (include)
serial monitor (only boot button)
rst:0x10 (RTCWDT_RTC_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
waiting for download
ets Jun 8 2016 00:22:57
(boot and EN button)
rst:0x1 (POWERON_RESET),boot:0x1 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_REO_V2))
waiting for download
Hi.
Don’t press the RST button.
Just press the BOOT button.
Regards,
Sara
Hi Sara,
Thanks for the response. I tried just using boot button but it did not work. I also used 10 microfarad capacitor connecting EN & GND as mentioned but that also did not work for me. I changed the micro USB cable as well this time for testing. Also i tested with IDF framework, PlatformIO and Arduino IDE and all 3 upload fails. May be i will buy a new Dev Kit and test it. Thanks again for your response.
Hi Mohan, there is a regression in the current version of esptool.py that caused this to fail regularly for me; an older version (2.1) works perfectly. One of the maintainers is looking into the problem.
I am using platformio with vscode; here’s an example of my platformio.ini that works; you can also try slowing down the upload_speed:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
[env]
upload_speed = 460800
upload_port = COM4
upload_protocol = esptool
platform_packages = [email protected].0
Hi David,
Thank you for your response. i tried as you have suggested but it seems to fail again. Here is the output
Verbose mode can be enabled via
-v, --verbose
optionCONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.1.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
– framework-arduinoespressif32 3.10004.201016 (1.0.4)
– tool-esptoolpy 1.20100.0 (2.1.0)
– tool-mkspiffs 2.230.0 (2.30)
– tool-openocd-esp32 2.1000.20201202 (10.0)
– toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [ ] 4.7% (used 15436 bytes from 327680 bytes)
Flash: [== ] 16.5% (used 216621 bytes from 1310720 bytes)
Configuring upload protocol…
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port…
Use manually specified: COM4
Uploading .pio\build\esp32dev\firmware.bin
esptool.py v2.1
Connecting….
Chip is ESP32D0WDQ6 (revision (unknown 0xa))
C:\Users\Mohan.platformio\packages\[email protected]\esptool.py:2236: DeprecationWarning: inspect.getargspec() is deprecated since Python
3.0, use inspect.signature() or inspect.getfullargspec()
Uploading stub…
operation_args,,,_ = inspect.getargspec(operation_func)
Running stub…
Stub running…
Configuring flash size…
Warning: Could not auto-detect Flash size (FlashID=0xffff*** [upload] Error 2
ff, SizeID=0xff), defaulting to 4MB
Compressed 15872 bytes to 10319…
A fatal error occurred: Timed out waiting for packet content
========================================================== [FAILED] Took 29.13 seconds ==========================================================
The terminal process “C:\Users\Mohan.platformio\penv\Scripts\pio.exe ‘run’, ‘–target’, ‘upload'” terminated with exit code: 1.
Is your ESP32 connected to COM4? In my example I used COM4, but you should change that to whatever serial port your ESP32 is connected to. Also, if it doesn’t work at such a high speed, try slower upload speeds such as 115200 or even 57600.
Hello David, Sara,
I tested with new ESP32 development board and it is working fine. I think the first board that i had may have hardware fault. It always printed warning that it cannot detect flash size. anyways thank you for the reponses. Have a great day!!
Many thanks for this good hint! It works fine with a small 10uF ceramic capacitor.