SWD#
Serial Wire Debug. ARM’s two-wire JTAG replacement on Cortex-M parts; the same debug capability (halt, register read/write, flash program) over a clock line and a bidirectional data line. Smaller header, smaller pin count, same access. When the operator finds an ARM micro on a target and the JTAG pads look stripped, SWD is the next thing to try.
Wires#
Signal |
Direction |
Purpose |
|---|---|---|
|
Probe out |
Serial Wire clock. |
|
Bidirectional |
Serial Wire data; the probe drives it during the request phase, the target drives it during the response phase. |
|
Probe in |
Serial Wire Output; one-way trace channel from target
to probe ( |
|
Probe out |
System reset; same purpose as JTAG’s |
|
Reference |
Ground. |
The 10-pin 0.05-inch Cortex Debug connector is the standard SWD/JTAG header on production boards.
Wire format#
Every transaction is a 46-bit packet on SWDIO clocked by
SWCLK.
Header (8 bits): start, AP/DP select, R/W, address bits, parity, stop, park.
ACK (3 bits, target-driven):
OK,WAIT, orFAULT.Data (32 bits) plus parity, in the direction set by the header.
A DAP (Debug Access Port) is the chip-level peer of the probe;
behind it sits one or more APs (Access Ports), most commonly an
MEM-AP that exposes the chip’s memory bus.
Pads#
ARM Cortex Debug pinout (10-pin, 0.05-inch pitch):
Pin |
Signal |
|---|---|
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
A 4-pad arrangement (SWDIO, SWCLK, GND, Vcc) is
the operator’s most common find on hobby and lower-end commercial
boards.
Tools#
Tool |
Effect |
|---|---|
|
Open-source SWD daemon; |
|
SWD adapter built into every STM32 Discovery and Nucleo board; the cheapest fast SWD probe. |
|
SWD probe with a built-in gdb server; no OpenOCD needed. |
|
Commercial probe with the broadest target support. |
|
ARM’s open-standard probe firmware; runs on many cheap boards. |
|
Python alternative to OpenOCD for CMSIS-DAP probes. |
References#
ARM
ADIv5Debug Interface Architecture Specification.ARM
IHI 0029Serial Wire Debug Port.JTAG for the wider boundary-scan predecessor.