JTAG Overview
Back in 1985 in response to the increasing density of then new electronics packaging technologies, test engineers from the major silicon vendors in Europe formed the Joint European Test Action Group and set about forming proposals for a new way of testing electronic devices mounted on a printed circuit board. In 1986 the group expanded to include members from North America and was renamed the Joint Test Action Group. The findings and recommendations of this group were used as the basis for the Institute of Electrical and Electronic Engineers (IEEE) standard 1149.1: Standard Test Access Port and Boundary Scan Architecture. This standard is commonly know by the acronym JTAG, derived from the name of the group that formulated it.
The initial purpose of the JTAG standard, also referred to as Boundary Scan, was to set out a system that could be built into an IC to allow testing of the physical connection of the pins of the chip without the need to connect probes to the pins. It was conceived as an alternative or replacement for traditional bed-of-nails testing, which can be difficult, if not impossible, on many modern high-density surface mount boards.
On a JTAG-compliant device, each physical pin of the device is connected to the underlying logic via a small piece of circuitry called a Boundary Scan cell. Each cell is configured to be able to monitor the value of the device pin, and each cell is connected to its adjacent cells to form a serial chain allowing data to be extracted from the Boundary Scan cells without having to connect to each individual pin.
The full JTAG implementation requires only four pins on a device – TDI to load serial data in, TDO to extract serial data out, the TMS control line and the TCK JTAG clock, as shown in Figure 1.
The Test Access Port
The heart of JTAG communications is the Test Access Port or TAP. The TAP defines a set of registers and a controller that are used to define the operation of the JTAG interface.
There are two types of registers associated with boundary scan. Each compliant device has one instruction register and two or more data registers.
The instruction register holds the current instruction. Its content is used by the TAP controller to decide what to do with signals that are received. Most commonly, the content of the instruction register will define which of the data registers signals should be passed to.
There are three primary data registers:
- Boundary Scan Register (BSR) – this is the main testing data register and is formed by the JTAG cells connected between the core logic and the pins of the device. It is used to move data to and from the 'pins' on a device.
- BYPASS – this is a single-bit register that passes information from TDI to TDO. It allows other devices in a circuit to be tested with minimal overhead.
- IDCODES – this register contains the ID code and revision number for the device. This information allows the device to be linked to its Boundary Scan Description Language (BSDL) file. The file contains details of the Boundary Scan configuration for the device.
Other data registers may be present, but they are not required as part of the JTAG standard.
The TAP Controller
The operation of the JTAG port is controlled by a 16-step state machine called the TAP controller, shown in Figure 2.
It can be seen from Figure 2 that all states have two exits, so all transitions can be controlled by the status of the TMS line, which is sampled on the rising edge of the JTAG TCK clock input. The two main state paths allow for setting or getting data from either the Instruction register (IR) or the active data register (DR). The active data register is determined from the previously loaded value in the Instruction register.
While the JTAG standard describes a number of instructions that can be implemented, only the following three are mandatory:
- BYPASS – TDI and TDO are connected together via the bypass register.
- EXTEST – TDI and TDO are connected via the Boundary Scan register (BSR). The device's pin states are sampled with the
capture_dr
JTAG state and new values are shifted into the BSR with theshift_dr
state; these values are then applied to the pins of the device using theupdate_dr
state.
- SAMPLE/RELOAD – TDI and TDO are connected via the Boundary Scan Register (BSR). In this case, however, the device is left in its normal functioning mode and BSR can be scanned to take a sample of the pin states. The instruction is also used to preload test data into the BSR prior to loading an EXTEST instruction.
Chaining JTAG Devices Together
One of the strengths of JTAG is the ability to connect devices together to form a JTAG chain. The TDO of one device is connected to the TDI of the next device, with TMS and TCK being common to all devices, as shown in Figure 3. Data can then be read or loaded from any register of any device in the chain by appropriate manipulation of the TMS line.
To read or write to a particular device, other devices in the chain can be put into bypass mode, allowing for large numbers of devices to be chained together without seriously degrading the performance of the JTAG communications.