JTAG#
IEEE 1149.1 boundary-scan and on-chip debug. Four or five wires drive a state machine inside the chip that lets the operator read and write every register, halt the CPU, dump flash, and walk the boundary-scan chain through every pin on every chip on the board. The back door cut into the chip by the manufacturer; if the operator finds an unsealed JTAG header, the operator owns the device.
Wires#
Signal |
Direction |
Purpose |
|---|---|---|
|
Probe out |
Test clock. Drives the JTAG state machine. |
|
Probe out |
Test mode select. Transitions drive the state machine. |
|
Probe out |
Test data in. Shifts into the chain. |
|
Probe in |
Test data out. Shifts out of the chain. |
|
Probe out |
Test reset; asynchronously resets the JTAG TAP. |
|
Probe out |
System reset; resets the chip, not just the JTAG TAP. |
|
Reference |
Ground. |
Headers are typically 2x5, 2x7, or 2x10 0.1-inch pitch. ARM’s 20-pin Cortex Debug connector is a common standard pinout.
Wire format#
JTAG is a state machine driven by TMS sampled on the rising
edge of TCK.
Test-Logic-Reset, the safe idle state.
Run-Test/Idle, the operating state.
Select-DR / Select-IR, branch into a Data Register or Instruction Register shift sequence.
Capture-DR/IR → Shift-DR/IR → Exit1 → Update, the cycle for one register operation.
Standard instructions include IDCODE (32-bit chip identifier),
BYPASS (skip this chip in a chain), SAMPLE/PRELOAD,
EXTEST (drive the boundary-scan cells onto the chip’s pins),
and vendor-specific debug instructions.
Pads#
The operator’s first job on an unknown board is to find the JTAG pads. Vendors leave them unlabelled and sometimes spread the signals across the PCB.
Look for a 2xN 0.1-inch unpopulated header near the main MCU.
Look for unmarked test points clustered in a square or row.
Use a tool like
JTAGulatorto brute-force the pin assignment.
ARM Cortex Debug pinout (20-pin):
Pin |
Signal |
|---|---|
1 |
|
2, 6, 8, 10, 12, 14, 16, 18, 20 |
|
3 |
|
5 |
|
7 |
|
9 |
|
11 |
|
13 |
|
15 |
|
Tools#
Tool |
Effect |
|---|---|
|
Open-source JTAG / SWD daemon; drives most adapters. |
|
Lower-level JTAG manipulation; boundary-scan and flash programming. |
|
Identifies the JTAG pinout on an unknown header by
trying every permutation against |
|
JTAG adapters with progressively more capability and cost. |
|
Attaches to OpenOCD or BlackMagic Probe for live debug. |