I'm designing a product that will have an optional add-on board that contains a ESP32-WROOM-32E which will be used to add wifi functionality.

Communicating between the ESP32 and my primary MCU a STM32H7 isn't too hard. But I would like the STM32H7 to be able to write the firmware of the ESP32. The purpose being that I don't have to worry about firmware version mismatch between the 2 boards. The main board will simply reflash the add-on board if it's the wrong version.

I'm new to the ESP32, and it's not totally clear to me how it's programmed. It looks like most dev boards use USART0, but that presumably uses a bootloader (and therefore another piece of firmware to track for compatibility).

What are the minimum pins I can connect between the ESP32-WROOM-32E and my main MCU, that will allow me to talk to it, and also flash the firmware? It could use the following configurations, in order of desirability:

  • Without using a bootloader

  • Using a standard bootloader

  • Using a custom bootloader

  • \$\begingroup\$ The esp32 has a built in serial bootloader, so your choice is made. As well as usart0 rx and tx, you need to be able to reset the esp32 and hold the boot pin to activate the bootloader. \$\endgroup\$
    – Kartman
    Feb 12, 2021 at 1:22
  • 1
    \$\begingroup\$ The ESP's bootloader is in ROM and you can't change it \$\endgroup\$
    – Sim Son
    Feb 12, 2021 at 4:49
  • \$\begingroup\$ @SimSon Thanks Sim, I didn't know that. I suppose the answer then would be to communicate over UART0, plus some additional lines so I can trigger the bootloader. \$\endgroup\$
    – Drew
    Feb 12, 2021 at 6:57
  • \$\begingroup\$ Check below post: electronics.stackexchange.com/questions/448187/… \$\endgroup\$
    – Givi
    Sep 12, 2022 at 17:44

1 Answer 1


Ok, I've basically figured it out.

As Sim commented, the ESP32 uses a ROM bootloader that loads firmware through UART0. That's the standard method of programming it, which I didn't understand.

Unfortunately the bootloader cannot be accessed using serial alone. A boot pin (GPIO0) needs to be held low while the device is reset to trigger the bootloader. The device can be reset using the EN pin.

Official dev boards use the serial RTS and DTR signals to toggle these pins. That pretty much tells me its the "right" way to do it.

Therefore, the complete answer is to comunicate with the ESP32 via UART0, and include either 2 additional signals for EN and GPIO0. Or 1 signal plus a circuit to hold boot low while toggling EN.

Documentation here: https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.