DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkSWD vs JTAG for ARM Debugging
Both protocols give you real-time debugging capabilities on Cortex-M processors. Here's when each matters.
SWD (Serial Wire Debug) uses only two signals (SWDIO, SWDCLK) plus power and ground. This is the reason most small MCU boards expose SWD — it's fine for debugging a single target and takes minimal PCB space. JTAG uses four signals (TDI, TDO, TCK, TMS) plus optional TRST and SRST. The advantage of JTAG is boundary scan and daisy-chain: you can address multiple devices on a single chain.
For solo MCU debugging, SWD is fine. If you're doing board-level testing or have multiple programmable devices on one board, JTAG's chain scan capability is worth the extra pins. Probe-rs supports both; OpenOCD supports both. The J-Link can switch between them dynamically.