← Projects

ESP32-S3SWDCMSIS-DAP v2USB CDC serial9 STM32 familiesWiFi + MQTT

STM32 SWD Flasher V2

An ESP32-S3 that programs STM32 microcontrollers over SWD. A single native USB-C port is both a driverless CMSIS-DAP v2 debugger (a drop-in ST-Link replacement) and a USB serial bridge to your target — or run it standalone over WiFi with a secure web UI, no PC required.

What it does

A single ESP32-S3 board that flashes STM32 chips over Serial Wire Debug (SWD) — three ways, all at once:

  • USB debugger — appears as a CMSIS-DAP v2 probe, so it works out of the box with OpenOCD, pyOCD and STM32CubeProgrammer, replacing an ST-Link.
  • USB serial — the same USB port also exposes a CDC serial port ("STM32 UART") bridged to the target's UART, so you flash and watch serial over one cable.
  • Standalone / WiFi — hosts its own UNOIoT-SWD access point with a secure web UI for field programming without a computer.

New in V2: one native USB port, fewer chips

V2 drops the CH340 USB-UART and the CH334R USB hub from V1. The ESP32-S3's native USB now presents a single composite device — CMSIS-DAP v2 and a CDC serial port on one connector — cutting two ICs and simplifying the board.

The target's serial output is captured once (ESP32 UART1) and fanned out to both the web monitor and the PC COM port at the same time — neither steals bytes from the other. It's bidirectional too: type in the web UI or your PC terminal and it reaches the target; set the baud from either side and both follow.

Driverless on Windows 8+ (WinUSB via BOS + MS-OS 2.0), macOS and Linux (both interfaces are standard/generic — no vendor driver). VID:PID 0x1209:0x0001 (pid.codes).

Supported targets

Nine STM32 families with per-family flash algorithms, auto-detected from the DBGMCU DEV_ID (or picked from a dropdown). The selection persists in NVS across reboots:

STM32F0 · F1 · F3 · F4 · L0 · L1 · L4 · G0 · G4

Key features

Secure web UI

HTTPS with a per-device self-signed cert, admin login (salted PBKDF2 hash), and a session cookie on every API call.

On-device firmware library

Keep multiple .bin files on SPIFFS, select one, and re-flash it repeatedly — no re-upload needed.

Physical button

Short press re-flashes the selected file (no WiFi needed); long-hold ≥3 s resets the STM32 target.

Dual LED status

Blue = activity/status (heartbeat, flashing, done), red = fault — consistent across web, MQTT and button paths.

Target serial monitor

See the STM32's UART live in the web UI and on a PC COM port simultaneously; send data back from either.

OTA self-update

Update the flasher's own firmware over WiFi (dual-OTA slots, anti-brick rollback, auto-reboot into the new image).

MQTT remote control

Flash / reset / query the STM32 and stream its serial over MQTT — a clean JSON API for fleets, CI, or an AI agent (firmware by URL + required SHA256).

Reboot to bootloader

A web-UI button drops the ESP into USB download mode so it can be reflashed without pressing BOOT.

Wiring (SWD + UART)

SWD plus an optional cross-wired UART to the target — levels are 3.3 V:

  • 3.3V → 3V3  ·  GND → GND
  • GPIO6 → SWCLK  ·  GPIO5 → SWDIO  ·  GPIO7 → NRST
  • GPIO17 (TX) → target USART RX  ·  GPIO18 (RX) → target USART TX

Hardware

  • MCU: ESP32-S3-WROOM-1 (N16R8 — 16 MB flash / 8 MB octal PSRAM)
  • USB: single native USB-C composite device (CMSIS-DAP v2 + CDC serial); no CH340, no hub
  • Status: red + blue LEDs, one flash/reset button
  • Storage: dual 3 MB OTA app slots + ~9.9 MB SPIFFS for STM32 .bin files
  • SWD core: based on the open-source swd-esp library by Jackson Ming Hu

Get the parts ← Back to all projects