Crafted with ❤️ by Diwakar
FlashWave STM32 is a web-based utility that allows you to update the firmware of an STM32 microcontroller over Wi-Fi using an ESP32 as the host. The ESP32 serves a lightweight webpage (accessible from any browser on the same network) where you can upload a .bin firmware file, which is then flashed to the STM32 over UART using the STM32 bootloader protocol.
No USB cable to the STM32 is required — just Wi-Fi.
Once the ESP32 is connected to Wi-Fi and you open the IP address in your browser, the following interface is displayed:
The dashboard shows:
- Device online status indicator
- Total size of stored files
- Max file size limit (200 KB)
- Files stored count
- A drag & drop upload area for
.binfiles - A Server path input field with an Upload button
- A Stored Files section listing previously uploaded files
After flashing the ESP32 and powering it on, the serial monitor confirms Wi-Fi connection and displays the assigned IP address:
I (6060) wifi:connected with Iron_man, aid = 1, channel 12, BW20
I (6060) wifi:security: WPA2-PSK
I (7070) WIFI: GOT IP
I (7070) esp_netif_handlers: sta ip: 10.190.220.209, mask: 255.255.255.0, gw: 10.190.220.218
xx -- Initializing SPIFFS -- xx
Copy the IP (e.g., 10.190.220.209) and open it in your browser.
- 📡 Hosted entirely on the ESP32 (no external server needed)
- 🌐 Browser-accessible UI with drag & drop file upload
- 📦 Supports binary firmware files up to 200 KB
- 🔄 Automatic STM32 reset and boot mode control via GPIO
- 💾 SPIFFS-based file storage on ESP32
- 🔒 WPA2-PSK Wi-Fi connection (Station mode)
| Component | Details |
|---|---|
| ESP32 | Any standard ESP32 dev board |
| STM32 | Any STM32 with UART bootloader support |
| Connection | UART (TX/RX) + RESET + BOOT0 GPIO lines |
The following GPIO pins on the ESP32 are used to interface with the STM32:
#define TXD_PIN (GPIO_NUM_17) // ESP32 TX → STM32 RX
#define RXD_PIN (GPIO_NUM_16) // ESP32 RX ← STM32 TX
#define RESET_PIN (GPIO_NUM_19) // ESP32 → STM32 NRST
#define BOOT0_PIN (GPIO_NUM_21) // ESP32 → STM32 BOOT0Note: Alternate pin assignments are shown in comments within the source (e.g.,
GPIO_NUM_1,GPIO_NUM_3,GPIO_NUM_12,GPIO_NUM_2) — update#definevalues as needed for your board layout.
STM32_FIRMWARE_UPDATE(WEBPAGE)/
├── .devcontainer/
├── .vscode/
├── build/
├── components/
│ ├── stm_flash/
│ │ ├── include/
│ │ │ └── stm_flash.h # STM32 flasher header
│ │ ├── CMakeLists.txt
│ │ ├── component.mk
│ │ └── stm_flash.c # STM32 UART bootloader logic
│ └── wifi/
│ ├── CMakeLists.txt
│ ├── connect.c # Wi-Fi STA connection implementation
│ └── connect.h # Wi-Fi connection header
├── main/
│ ├── webpage/ # Static web assets (HTML/CSS/JS)
│ ├── CMakeLists.txt
│ ├── component.mk
│ ├── file_server.c # HTTP server & file upload handler
│ └── main.c # Entry point, Wi-Fi init, server start
├── .gitignore
├── CMakeLists.txt
├── Makefile
├── partitions_example.csv # Custom flash partition table
├── README.md
├── sdkconfig
└── sdkconfig.old
In main/main.c, set your Wi-Fi SSID and password:
ESP_ERROR_CHECK(wifi_connect_sta("Iron_man", "Hewlett@123", 10000));Replace "Iron_man" and "Hewlett@123" with your own network credentials.
⚠️ Your laptop/PC and the ESP32 must be connected to the same Wi-Fi network.
idf.py build flash monitorWatch the serial monitor for the assigned IP:
I (7070) esp_netif_handlers: sta ip: 10.190.220.209, mask: 255.255.255.0, gw: 10.190.220.218
Paste the IP into your browser:
http://10.190.220.209
- Click "Choose a file" or drag & drop your
.binfile. - Enter the filename in the Server path field.
- Click Upload.
- The ESP32 stores the file in SPIFFS, then flashes it to the STM32 via the UART bootloader.
[ Browser ] --HTTP--> [ ESP32: file_server.c ]
|
SPIFFS storage
|
UART Bootloader Protocol
(stm_flash.c)
|
[ STM32 ]
- The ESP32 runs a lightweight HTTP server (
file_server.c). - Uploaded
.binfiles are stored in SPIFFS. stm_flash.ccontrolsBOOT0andRESETpins to enter bootloader mode.- Firmware is transferred via UART using the STM32 system bootloader protocol.
- STM32 is reset to boot from the new firmware.
- SPIFFS component (built-in)
- ESP HTTP Server component (built-in)
MIT License — feel free to use, modify, and distribute.
Crafted with ❤️ by Diwakar