What are the four JTAG signals (TMS, TCK, TDI, TDO), and how are they wired when several chips share one JTAG port?
TCK is the clock and TMS steers the JTAG state machine; both go to every chip in parallel. TDI and TDO carry the data one bit at a time and form a ring: the adapter's TDI enters the first chip, each chip's TDO feeds the next chip's TDI, and the last TDO returns to the adapter.
* Control lines are shared; the data line is one serial ring through every chip. *
| Signal | Name | Direction (from the adapter) | Job |
|---|---|---|---|
| TCK | Test Clock | out, to all chips | Every bit moves on a clock edge. |
| TMS | Test Mode Select | out, to all chips | Its value at each clock edge moves the JTAG controller to its next state (shift data, shift an instruction, idle, …). |
| TDI | Test Data In | out, to the first chip | Serial data into the chain. |
| TDO | Test Data Out | in, from the last chip | Serial data back out of the chain. |
The data path is one bit wide, which makes JTAG bit-serial: a long chain takes many clock cycles to shift through. That is a deliberate trade-off. These wires are used only in the factory and during repairs or debugging, never in normal operation, so the standard keeps the wire count as low as possible.
The clock rate can go up to around 100 MHz, but a chain only runs as fast as its slowest chip and the signal quality of its PCB traces allow. Debug setups usually run slower: Espressif's adapter configuration uses 20 MHz, the ESP32's limit at its full CPU clock is about 26 MHz.
Many parts add an optional fifth signal, TRST (test reset), which forces the JTAG logic back to its reset state. It is optional because holding TMS high for five clock cycles reaches the same state.
Go deeper:
Wikipedia — JTAG — the signals, daisy chaining and the TAP state machine in one article.