← All notes

May 2026

Getting a microcontroller out of a bootloop

Force the ROM bootloader, fully erase flash, reflash a minimal firmware with no radio or exotic PSRAM to isolate hardware from software. The PSRAM mode trap.

A microcontroller that restarts in a loop does not tell you whether it is dead or merely badly flashed. The reflex is to reflash everything, but without method you reflash over the corrupted state and the bootloop persists. You must first neutralize the software to isolate the hardware.

Force the bootloader and erase everything

First force the ROM bootloader, burned at the factory and independent of the application firmware, by holding the boot pin at reset. This mode always responds, even if the application is broken. Then perform a full erase flash: partition table, NVS and OTA zones included, not just the application partition.

A corrupted NVS or an OTA table pointing to an invalid image is enough to sustain a bootloop indefinitely.

Reflash minimal and the PSRAM trap

Then reflash a minimal firmware, with no radio or exotic PSRAM, just enough to blink an LED and talk over the serial port. If it runs, the hardware is sound and the problem was software. The classic trap is PSRAM mode: a firmware built for an absent or different PSRAM variant loops at startup before any useful trace.

The takeaway: erase everything, start from a bare firmware, and reintroduce radio then PSRAM one step at a time.