Embedded and systems
JTAG
JTAG is a standardised interface under IEEE 1149.1 for debugging and programming microcontrollers and for testing circuit boards via boundary scan. On ARM processors the leaner SWD variant is widespread.
Also known as: SWD, Serial Wire Debug, boundary scan, debug interface, IEEE 1149.1
Three uses
- Debugging: halting the program, setting breakpoints, reading registers and memory while the firmware runs on the real chip
- Programming: writing firmware into flash memory, see flashing
- Boundary scan: driving and reading a chip’s pins directly to check solder joints and traces without any firmware
JTAG and SWD
JTAG uses at least four signal lines and can address several chips in a chain. ARM’s Serial Wire Debug (SWD) gets by with two lines and is the standard for debugging and programming Cortex-M microcontrollers.
In automated testing
Through the debug interface, tests can see more than is visible from outside: reading internal variables, checking memory contents, measuring code coverage on the target, or driving processor-in-the-loop tests. In production devices access is often locked for security reasons, which the test concept has to take into account.