Home / Learn Chip Programming / SWD and JTAG: Hardware Debug Interfaces
SWD and JTAG: Hardware Debug Interfaces
Two or four wires give you breakpoints, memory access and flashing.
Theory in plain words
What it is
SWD (Serial Wire Debug) uses SWDIO and SWCLK; JTAG uses TCK, TMS, TDI, TDO (+TRST). ARM debug logic (CoreSight) lets a probe halt the CPU, read/write memory, set breakpoints and flash.
Why we use it
No professional firmware work happens without a hardware debugger: ST-LINK, J-Link, CMSIS-DAP, Black Magic Probe.
How it works
Connect SWDIO, SWCLK, GND, and (optionally) NRST and SWO to the probe. Use OpenOCD or vendor IDE to connect. 10-pin 1.27 mm Cortex Debug connector is standard.
Where it is used
- Flashing and debugging STM32/nRF/RP2040
- Production programming
- Reading a stuck system
Pin mapper
SWD only needs two signal wires: that is why ARM MCUs use it.
| Probe | Price (India) | Strength |
|---|---|---|
| ST-LINK V2 clone | Rs 300 to 500 | STM32 only, cheap |
| Nucleo on-board ST-LINK | included | STM32 and others via SWD pins |
| Raspberry Pi Pico as debugprobe | Rs 350 | CMSIS-DAP, any ARM Cortex-M |
| SEGGER J-Link EDU Mini | Rs 4000+ | fast, any ARM, RTT |
| Black Magic Probe | Rs 5000 | built-in GDB server, no OpenOCD |
| ESP-PROG / ESP32-S3 USB-JTAG | Rs 700 / built-in | ESP32 JTAG |
Quick quiz
1. Minimum wires for SWD?
Plus VTref helps for level matching.
2. Which probe is built into Nucleo boards?
Usable for other targets too.
Common questions
Minimum wires for SWD?
SWDIO, SWCLK and GND. Plus VTref helps for level matching.
Which probe is built into Nucleo boards?
ST-LINK. Usable for other targets too.