Embedded development can be a tough process. Between weird electrical gremlins, obscure bugs and our own mistakes, it can be a real struggle at times. To keep cognitive loads to a minimum, it’s best to make sure your tools are as simple and easy to use as possible. [tech] got tired of having to push a button to prepare the ESP32 for programming, and decided to solve the problem.
The solution comes via another microcontroller, in this case an ATtiny9. The small device listens in on the ESP32’s serial receiving pin. When it detects the Arduino IDE’s boot sequence on the line, it switches the BOOT0 and RESET lines on the ESP32, emulating the button presses to force it into programming mode.
Once you’ve become accustomed to one-click programming your ESP boards, you’re not going to want to go back. We could imagine this hack being replicated in a tidy piggyback format so it could be moved from board to board as workflow dictates.
If you’ve got an ESP32 lying around and don’t know what to do with it, you could always consider getting into game development.
28 thoughts on “Parasite ATtiny Resets Your ESP32 For You”
Or the Arduino IDE could make use of the RTS and DTR pins…
Was thinking the same… Even the ESP-IDF uses the RTS and DTR pins, so i don’t get why would you need something like this on a development board
But I think it is a neat idea, but not for that… Maybe for an external Watchdog or a power supply guard
Maybe because of the many usb serial cables that do not have those lines brought out.
This board appears to be a NodeMCU-32S and has a CO2102 on it which does have them and they are appropriately tied
But this project is useful for anyone using the bare modules with a generic serial cable
I’ve seen schematics for simpler versions of this setup that used an RC network with a transistor to hold the correct pins low if the serial line spends too long low. (this is what the break key did on old terminals and signaled the mainframe to change baudrates)vI think it was provided by one of the developers of the arduino port to the esp8266.
I just use OTA, myself. It’s faster than uploading via serial and I still avoid having to press any physical buttons on the board.
Not all boards that have an esp will come with enough free flash to transfer the image ota. I can name quite a few times where I wish this was possible but had to use the manual flashing mode.
I don’t understand, this is a Dev board with a USB serial chip that had signaling on those pins already. Do Arduino users really need to manually manipulate those? Does arduino not use esptool to upload?
I have a visually identical board, and the automatic RTS/DTR rebooting works very erratically – it reboots the board, but most of the time it boots up in the normal (non-bootloader) mode. I guess that the author’s board behaves in a similar way, giving the impression that there are no provisions for automatically entering the bootloader mode.
Wonder if there is a better fix then? Perhaps the firmware needs to be more robust or the signal is hindered for some other reason.
I a man very confused at why this exists. I have the exact same dev board and it’s one click programmable form the Arduino IDE with out any mods.
Mine (ESP32 Dev Board) works every time, but only if I use a USB 2.0 or newer. My old laptop with USB 1.0 does not, so I got a USB hub and that works great,
Recreating that infamous face-hugger scene from Alien?
Realizing this could also be used as a hardware watchdog. Consistent pin ping, when no reply after x number of fails, reset.
If you’re feeling extra thrifty use the 3-cent PMS150C
Benchoff told me that the PMS150C is a terrible microcontroller
No need for an separate chip, just put a 100nf between EN and GND , Autoprogramming should work
I’ve read elsewhere that adding the capacitor fixes the issue 99.9% of the time!
I used a timer chip by ST to do hourly resets of an esp32 in a semi-kinda-critical application
Reminds me of older routers.
The fix to keep them running was a Christmas light timer that powercycled them in the middle of the night.
The inspiration was actually from an old co-worker talking about doing just that same thing years with one of those analog timers on an old closed server that would just fill with garbage every few days and had to be reset :P
“have you tried turning it off and then on again? ” shouldn’t be a often employed solution, but it’s the only one that’s gotten a consistent and reliable track record.
no idea how autocorrect got novelty
Why not just do a basic flip flop? Think Forrest Mims.
Otherwise use a pair of NPN transistors and trigger the GPIO 0 and RST lines via the USB serial adapter you have on hand? DTR and RTS pins… Should be selectable as to which programming method you are using in either PlatformIO or in Arduino IDE.
Next up, a piggy backed MCU to facilitate programming of the piggybacked MCU
Actually bookmarking this so I can modify my $2 ebay usb-serial device :D
the earlier esp32 boards all seemed to do it automatically, but recently (last few months) many seem to have settled on a design that you HAVE to hit the button…
I think it is because they want to maximize the usable pins broken out..
It’s very annoying
I’m going to blow your minds…. add a 0.1uf capacitor between EN and GND and it will auto reset when you upload.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)