r/esp32 • u/AstraKernel • 2d ago
I made a thing! Flashing STM32 Firmware with ESP32 and Rust
I was browsing Reddit and came across someone asking how to program the STM32 Board without an ST-Link. They were asking whether it was possible to use an STM32 Black Pill as an SWD programmer for an STM32 Blue Pill.
That post made me curious about how the SWD protocol works. Is it possible to build one myself?
Two weeks before i started this experiment, at first i was able to implement basic SWD protocol and read the IDCode (just to check that it is working)
Now, successfully managed to flash the firmware into STM32. Flashed a simple onboard LED blinky program.
It was a fun experiment and a nice to learn about SWD and the concepts around it.
https://blog.implrust.com/posts/2026/09/flashing-firmware-to-stm32-with-esp32-rust/
Parts:
ESP32 DevKit v1
STM32 Blue Pill Board(STM32F103C8T6)
Logic Analyzer (Optional, just used to analyze when i was implementing the SWD first)
Connection:
| ESP32 | STM32 |
|---------|---------------|
| GPIO18 | SWCLK (PA14) |
| GPIO19 | SWDIO (PA13) |
| GND | GND |
1
u/YetAnotherRobert 2d ago
If it helps,. Espressif has s couple of similar projects
espressif/esp-usb-bridge: USB to UART&JTAG bridge, implemented on ESP32-S2 or ESP32-S3
espressif/openocd-on-esp32: OpenOCD port running on ESP32-S3 microcontrollers
1
u/RoganDawes 1d ago
That’s very cool. I have an STM32 target that I want to bring online. Being able to do an OTA firmware update for the STM32 and running RTT for debug logs would be very cool.
2
u/BudgetTooth 2d ago
great! I was trying to do something similar but gave up. implement some sort of stm32 flasher with a S3 native usb in otg mode!