Hello,
My comment seems to have gone unnoticed on the following tutorial:
[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header
So I’ll ask my question here again and hope for the best of luck:
Why do you use a 10 µF electrolytic capacitor? How did you choose this value?
In an empirical way, or is there a logical explanation for that?
Can you explain by what miracle this solution solves the problem?
Hello! There’s no miracle 🙂 basically some ESP32 dev boards miss a capacitor in the auto-programming circuit. If you add a capacitor in those pins, it solves the problem.
You can add a 1uF capacitor or even lower, but during my tests I found that a 10uF capacitor worked reliably while testing with multiple boards. It’s not the perfect value, but it has been working flawlessly for me.
If your ESP32 automatically auto-programs without holding the BOOT button, your ESP32 was properly designed and it comes with capacitor in the auto-programming circuit.
I hope that helps!
Hi Rui,
Thank you for your answer!
Nevertheless, it explains the how… but not really the why.
In the meantime, I also found an explanation that matches yours:
ESP32 Boot Mode Selection / Automatic bootloader
I was joking about miracles, of course… but until I understand what’s going on, it’s all the same to me… Well, I then came across a discussion that sheds more light on the matter (look especially at username‘s answers), and in particular with this diagram:
So, as I understand it, the winning scenario is to prevent EN
from returning to a logical HIGH level AFTER IO0
. And since EN
is pull-up, you just have to place the capacitor (a priori 100 nF is enough… but the results can vary according to the boards, as you said) which, as soon as it is charged (i.e. very quickly), will become insulating and therefore, EN
will go back to a HIGH logic level almost immediately, BEFORE the auto-programming sequence lets IO0
go back to the HIGH state too.
Here’s what I understand… and it makes sense to me now.
But tell me if I’m wrong…
Yes.
For the ESP32 to go into bootloader mode, both the EN and GPIO 0 must be pulled GND.
“The ESP32 will enter the serial bootloader when GPIO0 is held low on reset. Otherwise it will run the program in flash.”
The capacitor makes sure the ESP32 will go into bootloader mode and not simply a reset.