Case study

ESP32 production flasher

One ESP32 flashes another: bootloader, partition table, application, and SPIFFS over UART, with status on an OLED. The flasher itself updates from OTAdrive.

Host ESP32 → UART bootloader → target flash → OTAdrive on the host

Record
Public repository
Stack
ESP-IDF, OTA, UART, SSD1306
Hardware
Host ESP32 · Target ESP32 · SSD1306 OLED
Links
GitHub

The problem

Programming a product on a bench with a PC on every unit does not scale, and it fails the day the USB port is inside a housing. The station should be another board: put the target in the ROM bootloader, write the images, show pass or fail on a screen, and still let you update the station without opening it.

What I built

An ESP-IDF project. The host stores the target images inside its own application, generated at build time from binaries/firmware/ESP32. On boot it drives the target BOOT and EN lines, connects with Espressif’s esp-serial-flasher, raises the baud, and writes four images. An SSD1306 shows progress and whether a target was found.

After the flash attempt, the host joins Wi-Fi and asks OTAdrive if the flasher firmware itself should update. The host partition table has OTA slots for that. The serial flash programs the target. OTAdrive programs the host.

Decisions

The target is held in download mode from GPIO, so nobody has to press BOOT. The link starts at 115200 and steps to 230400 for the transfer.

Addresses in this build are the usual ESP32 map: bootloader at 0x1000, partition table at 0x8000, application at 0x10000, SPIFFS at 0x290000.

The binary map in the current source is for an ESP32 target. The flasher component can speak to other chips, but this project stops if the target is not the ESP32 it has images for. That limit is in the code on purpose, until more images are added.

Display wiring is menuconfig, I2C by default on GPIO 22 and 21, 128x64. Host-to-target UART is GPIO 4 and 5, reset GPIO 25, BOOT GPIO 26.

What you can check

The repository README walks the boot order, the wiring, and the component versions: esp-serial-flasher 1.4 and OTAdrive 2.0.6.

Back to work Start a project