
Initialization and Configuration
190
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
JTAG Interface
3.3.4.4.2 SWD-to-JTAG Switching
To switch the operating mode of the DAP from SWD to JTAG mode, the external debug hardware must
send a switch command to the microcontroller. The 16-bit TMS/SWDIO command for switching to JTAG
mode is defined as b1110.0111.0011.1100, transmitted LSB first. This command can also be represented
as 0xE73C when transmitted LSB first. The complete switch sequence should consist of the following
transactions on the TCK / SWCLK and TMS / SWDIO signals:
1. Send at least 50 TCK / SWCLK cycles with TMS / SWDIO High to ensure that both JTAG and SWD
are in their reset states.
2. Send the 16-bit SWD-to-JTAG switch command, 0xE73C, on TMS/SWDIO.
3. Send at least 50 TCK / SWCLK cycles with TMS / SWDIO High to ensure that if SWJ-DP was already
in JTAG mode before sending the switch sequence, the JTAG goes into the Test Logic Reset state.
To verify that the DAP has switched to the JTAG operating mode, set the JTAG IR to the IDCODE
instruction and shift out the DR. The DR value can be compared against the device's known IDCODE to
verify the switch.
3.4
Initialization and Configuration
After a Power-On-Reset or an external reset (RST), the JTAG pins are automatically configured for JTAG
communication. No user-defined initialization or configuration is needed. However, if the user application
changes these pins to their GPIO function, they must be configured back to their JTAG functionality before
JTAG communication can be restored. To return the pins to their JTAG functions, enable the four JTAG
pins (PC[3:0]) for their alternate function using the GPIOAFSEL register. In addition to enabling the
alternate functions, any other changes to the GPIO pad configurations on the four JTAG pins (PC[3:0])
should be returned to their default settings.
3.5
Register Descriptions
The registers in the JTAG TAP Controller or Shift Register chains are not memory mapped and are not
accessible through the on-chip Advanced Peripheral Bus (APB). Instead, the registers within the JTAG
controller are all accessed serially through the TAP Controller. These registers include the Instruction
Register and the six Data Registers.
3.5.1 Instruction Register (IR)
The JTAG TAP IR is a four-bit serial scan chain connected between the JTAG TDI and TDO pins with a
parallel load register. When the TAP Controller is placed in the correct states, bits can be shifted into the
IR. Once these bits have been shifted into the chain and updated, they are interpreted as the current
instruction. The decode of the IR bits is shown in
. A detailed explanation of each instruction,
along with its associated Data Register, follows.
Table 3-2. JTAG Instruction Register Commands
IR[3:0]
Instruction
Description
0x0
EXTEST
Drives the values preloaded into the Boundary Scan Chain by the
SAMPLE/PRELOAD instruction onto the pads.
0x2
SAMPLE / PRELOAD
Captures the current I/O values and shifts the sampled values out of the
Boundary Scan Chain while new preload data is shifted in.
0x8
ABORT
Shifts data into the Arm Debug Port Abort Register.
0xA
DPACC
Shifts data into and out of the Arm DP Access Register.
0xB
APACC
Shifts data into and out of the Arm AC Access Register.
0xE
IDCODE
Loads manufacturing information defined by the IEEE Standard 1149.1 into
the IDCODE chain and shifts it out.
0xF
BYPASS
Connects TDI to TDO through a single Shift Register chain.
All Others
Reserved
Defaults to the BYPASS instruction to ensure that TDI is always connected to
TDO.