SWD Programmer
Flash STM32, PUYA PY32 and Microchip ATSAMD microcontrollers over SWD with a DAP-Link (CMSIS-DAP), ST-Link or J-Link. The programmer and the chip are detected automatically. Write BIN and HEX files, erase, lock and unlock the chip, enable the BOOT0 pin and set up the NRST pin.
Firmware
Connect the programmer first. The chip is halted, erased completely, the firmware is written by a small flash loader in the RAM of the chip and verified byte by byte, then the chip is reset and starts it.
Chip
Detects the chip and shows its flash size, read protection and pin options. The chip is reset afterwards.
Erases the whole flash (mass erase). A locked chip is unlocked for this.
Removes the read protection (or the security bit on ATSAMD). This erases the flash.
Sets read protection level 1 (security bit on ATSAMD). The flash can then not be read until the chip is unlocked and erased.
More actions
Sets the option bytes so that the BOOT0 pin starts the embedded bootloader again (STM32C0/G0/U0: nBOOT_SEL = 0; G4/L4/L5/U5/WB/WL: nSWBOOT0 = 1; F0/F3/PY32: nBOOT1 = 1, plus BOOT_SEL = 1 on STM32F04x/F09x). Nothing to do on chips with a fixed BOOT0 pin.
Saves the whole flash of an unlocked chip as a BIN file.
STM32C0/G0/G4/U0 and PY32: makes the NRST pin a normal I/O pin. SWD still works; the app then connects without the reset line.
Makes the NRST pin a reset input again.
Wiring and programmers
Connect the SWD lines of the programmer to the chip (3.3 V logic). NRST is optional, but it lets the app reach a chip whose firmware disables SWD or sleeps (connect under reset):
Programmer Chip SWDIO <-> SWDIO (STM32/PY32: PA13, ATSAMD: PA31) SWCLK --> SWCLK (STM32/PY32: PA14, ATSAMD: PA30) GND --- GND NRST --> NRST / RESET (optional) 3V3 --- VDD (if the programmer powers the chip)
Supported programmers:
- CMSIS-DAP v2 (bulk): DAPLink, Raspberry Pi Debug Probe and Picoprobe, WCH-LinkE in DAP mode, MCU-Link and many others. Most work without a driver.
- CMSIS-DAP v1 (HID only, older probes): choose CMSIS-DAP v1 (HID).
- ST-Link V2, V2-1 and V3, also the ST-Link on Nucleo and Discovery boards. V2 needs firmware J24 or newer.
- SEGGER J-Link (also J-Link OB) with the WinUSB driver on Windows.
The programmer is detected from its USB descriptors, the chip from its debug and ID registers. If the browser shows no programmer, open More options next to the programmer and list all USB devices.
Supported chips
ID: DEV_ID of STM32 chips (DBGMCU_IDCODE). Flash: the largest chip of the line; the app reads the real size from the chip. The list is the one of tinyOCD.
| Chip line | ID | Flash | BOOT0 pin | NRST pin |
|---|