ESP32 auto reset circuit

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

ESP32 auto reset circuit

Post by liudr » Thu Jul 05, 2018 5:35 am

This circuit is supposed to be able to reset ESP32 or put it in boot mode. I read about the reset and boot about 6 months ago and due to age :lol: I've not remembered all that I learned. I think just pulling RESET to LOW for more than 100ms will reset the processor. If you want to put it in boot mode, when you release RESET, pull GPIO0 to LOW for 50ms. Is that correct?

Image

Can I use N-MOSFET instead of the NPN-BJT?

Additional circuit on RESET pin featured on Adafruit's ESP32 feather board design:

Image

I assume this is just a push button and the resistor debounces the button, correct?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 auto reset circuit

Post by Roberthh » Thu Jul 05, 2018 8:37 am

The first circuit is the standard set-up supported by esptool.py, and it works pretty well. The type of NPN transistor does not matter at all. Using a N-Mosfet may not work, because of the reverse polarity protection diode, but I did not try that out. No reason to try, since small signal NPN's are as easy to use.
Wemos is using a small circuitry call UMH3N, which included the two transistors and the resistors in one tiny package (too small for my old eyes and hands).
The debouncing at the reset circuit is achived by the 10k/1µF lowpass, whith the capacitor being parallel to the button.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ESP32 auto reset circuit

Post by pythoncoder » Thu Jul 05, 2018 9:27 am

Yes, I was about to reply that I was concerned about the diode. If you press the reset button it will pull RTS low with a possible effect on GPIO0. Best to stick with junction transistors.
Peter Hinch
Index to my micropython libraries.

User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

Re: ESP32 auto reset circuit

Post by liudr » Thu Jul 05, 2018 3:06 pm

Thanks guys. I'll grab some NPN BJTs. I'm learning everyday. I remember reading esptool.py 6 months ago to understand this boot process but that and a diagram I made were the only two things left. It's really hard to learn this kind of stuff when you are older, not even old, just older. I'll read esptool.py again but now with slightly better understanding of python and your explanations. This time I'll write down what I learn, like all other subjects I learn these days.

Here is what I found at mouser.com:

https://www.mouser.com/ProductDetail/To ... X7Q%3d%3d
Seems reasonably priced. Hate to place another order since I did one just recently. Maybe I'll wait until I finish my design so I don't end up placing yet another order.

User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

Re: ESP32 auto reset circuit

Post by liudr » Thu Jul 05, 2018 4:27 pm

By the way, I got my first pyboard. It's really tiny and comes without headers. I guess I'll start asking questions regarding the pyboard besides ESP32.

User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

Re: ESP32 auto reset circuit

Post by liudr » Fri Jul 06, 2018 10:58 pm

Found the thread I started 3 months ago! Content was related to this post:
https://forum.micropython.org/viewtopi ... =18&t=4607

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ESP32 auto reset circuit

Post by pythoncoder » Sat Jul 07, 2018 8:14 am

I find the circuit easier to understand if you draw it with the bottom NPN transistor the right way up ;)
Peter Hinch
Index to my micropython libraries.

User avatar
marfis
Posts: 215
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: ESP32 auto reset circuit

Post by marfis » Sat Jul 07, 2018 6:50 pm

you also might some information here
https://forums.adafruit.com/viewtopic.p ... 93#p487891

in general i believe this circuit is not 100% bullet proof as I have explaned in the thread above. yet it seems to be doing the job for most people...

adrianjball
Posts: 1
Joined: Sun Sep 22, 2019 9:47 pm

Re: ESP32 auto reset circuit

Post by adrianjball » Sun Sep 22, 2019 10:15 pm

The 1uF capacitor on the Adafruit board isn't for debouncing the switch, it's essential to make the circuit work.

With the cross-coupled transistor circuit it's not possible to have both GPIO0 and RESET low at the same time. Try it and they both go high instead. So you have to turn RESET off before you can turn GPIO0 on. This won't get you into boot mode, because the ESP32 requires GPIO0 to be low at the time RESET goes high. The ESP32 datasheet specifies a setup time on GPIO of zero milliseconds, and a hold time of 1mS minimum. The hold time isn't a problem, but the setup time can't be achieved unless the rising edge of RESET is delayed. That's what the 1uF cap does - it slows the rising edge of RESET by just enough (about 10mS) to allow RTS to be turned on after DTR is turned off, and still get a small overlap of GPIO0 and RESET both being low at the ESP32.

Note that if you have a really slow computer, the delay achieved by the 1uF may still not be enough! It all depends on how much time elapses between turning DTR off and then turning RTS on. If a language had a single command that could set the states of BOTH signals in one write to the port, such as setRTSandDTR(x,y) that would solve the problem! Unfortunately all languages I am aware of have separate commands, so there will always be an execution delay between turning DTR off and then turning RTS on.

danielm
Posts: 167
Joined: Mon Oct 05, 2015 12:24 pm

Re: ESP32 auto reset circuit

Post by danielm » Sun May 03, 2020 3:03 pm

I built custom board with FTDI231X and above-mentioned auto-reset circuit. Works with esptool without any issues.

However, in my application I need to have the ESP32 running continuously (powered from different power source than USB). When necessary I want to be able to connect to REPL via USB connection. The problem is that when USB is connected FTDI chip resets ESP32 via auto-reset circuit. This is obviously not an issue for single power supply development boards but it is an issue for my application.

How would you solve this problem? I am thinking to make use of CBUS pins of FTDI chip and control them outside of esptool.

Post Reply