What is JTAG?

A standard interface for chip testing and debugging that lets developers halt programs, inspect internal values and program flash. Arm also uses SWD, which needs fewer wires.

Field: Embedded Systems & Firmware

Japanese name: JTAG

Boundary scan: the original purpose

JTAG is named after the Joint Test Action Group, and the standard is IEEE 1149.1. Its original job was testing assembled boards. A boundary-scan cell sits just inside each I/O pin, and the cells are linked into a shift register. Through the test access port (TAP), test equipment shifts patterns in, drives them out of one chip's pins and captures them at another chip's pins, revealing solder opens and shorts even under BGA packages where no probe can reach.

The TAP signals and state machine

The TAP uses four signals: TDI (test data in), TDO (test data out), TCK (test clock) and TMS (test mode select), plus an optional TRST reset. TMS, sampled on TCK edges, steers a 16-state controller that decides whether bits shifted between TDI and TDO go into the instruction register or a selected data register. Several chips can be daisy-chained by connecting each TDO to the next TDI, so one connector reaches every device on the board.

Debugging and flash programming; JTAG vs. SWD

Chip vendors reuse the same port to reach on-chip debug logic. A debugger on a PC can halt the core, set breakpoints, single-step, read and write registers and memory, and program flash, exposing internal state where printf is unavailable. Arm's Serial Wire Debug (SWD) provides similar debug access over only two signals, SWDIO and SWCLK, saving pins on small microcontrollers, but it is a debug protocol and does not perform boundary scan. Many Arm devices support both on shared pins.

Locking the port in products

The access that helps developers also helps attackers. An open debug port can let anyone with a probe read out firmware, extract keys or bypass secure boot. Shipped products therefore disable the port permanently by blowing eFuses, apply read-out protection, or open it only after a cryptographic challenge-response authentication, so that authorized engineers can still analyze failed units returned from the field.

Try it: questions about JTAG

What is the main use of boundary scan, specified in IEEE 1149.1 (JTAG)?

  1. AMeasuring film thickness on wafers
  2. BEvaluating electromigration in wiring
  3. CTesting connections between the pins of ICs mounted on a printed circuit board, without applying probes
Show answer and explanation

Answer: C. Testing connections between the pins of ICs mounted on a printed circuit board, without applying probes

Boundary scan places scan cells just inside each I/O pin and chains them serially, so values can be set and observed externally through four signals, TDI, TDO, TCK and TMS (plus an optional reset). Solder opens and shorts on the board can be tested even for BGAs whose pins cannot be probed. The same port is widely used for debugging and programming flash memory.

What can be done through debug interfaces such as JTAG and SWD?

  1. AHalt or single-step the program on the real board, inspect registers and variables, and program flash
  2. BChange the microcontroller's manufacturing process
  3. CAutomatically translate the program into another language
Show answer and explanation

Answer: A. Halt or single-step the program on the real board, inspect registers and variables, and program flash

JTAG and Arm's SWD connect the on-chip debug circuitry to a debugger on a PC. You can stop at breakpoints to examine variables and registers, step one instruction at a time and program the flash. They reveal internal state even where printf cannot be used. When shipping a product, the debug function may be disabled so that third parties cannot read out the firmware.

FAQ

What are the JTAG pins?

TDI, TDO, TCK and TMS, plus an optional TRST reset, along with ground and usually a reference voltage on the debug connector.

What is the difference between JTAG and SWD?

SWD is Arm's two-wire debug interface offering similar halt, step and memory access with fewer pins. JTAG uses four or five signals and also supports boundary-scan board testing and daisy-chaining several chips.

Why is JTAG disabled on production devices?

Because it allows reading and writing memory and halting the processor, an open port lets attackers extract firmware and keys or bypass secure boot. Products disable it with fuses or require authentication to unlock it.

Questions that mention JTAG (1)

JTAG appears in 3 practice questions across 3 topics, including Testing and inspection, Embedded Systems & Firmware, Hardware Security.

  1. Why are debug ports such as JTAG disabled or placed behind authentication in shipped products?

Books on Embedded Systems & Firmware Ad

Learn hands-on: parts and kits

Building real circuits is a good way to check what you learned in the questions.

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary