Training JTAG Interface
For most embedded CPU architecture implementations, the JTAG port is used by the debugger to interface the chip for debugging one or more cores.
The normal user will probably not need to know details of the JTAG implementation unless there is a need
to debug several daisy-chained JTAG TAP controllers or to access special test functions or configurations
via JTAG that are not implemented in the debugger software.
JTAG is the name used for the IEEE 1149.1 standard entitled Standard Test Access Port
and Boundary-Scan Architecture for test access ports (TAP) used for testing printed circuit boards (PCB) using boundary scan.
JTAG is the acronym for Joint Test Action Group, the name of the group of people that developed the IEEE 1149.1 standard.
The functionality usually offered by JTAG is Debug Access and Boundary Scan:
Debug Access is used by debugger tools to access the internals of a chip making its resources and functionality available and modifiable,
e.g. registers, memories and the system state.
Boundary Scan is used by hardware test tools to test the physical connection of a device,
e.g. on a PCB.
Although the TAP (Test Access Port) access itself is generic for all architectures, the functionality implemented behind JTAG is different for each device.
The following chapter explains all necessities for accessing a JTAG TAP. For a complete description of JTAG see the IEEE 1149.1 standard.
JTAG is defined as a serial communication protocol and a state machine accessible via a TAP.
The DTAB (Debug and Test Access Block) is implemented on the target chip as a “passive” device that never sends data without request.
The DTAB mainly consists of the following
The TAP (Test Access Port) with its physical connections (signals) to the external world.
The TAP Controller (a 16-state state machine).
One IR (Instruction Register) and several DRs (Data Registers).
The Debug Bus for communication with the on-chip debug logic.
The TAP defines the interface between the DTAB and the debug tool.
The JTAG Port is the physical connector on the PCB where the debug cable is plugged.
The IEEE standard defines the following TAP signals,
used for the serial communication and driving the TAP controller (JTAG state machine):
The TMS and TDI line are sampled by the DTAP on each rising edge on the TCK line.
The TDO line changes its value after a falling edge on the TCK line.
Instruction and Data Registers
The functionality of the DTAB is accessible via different instructions stuffed into the Instruction Register.
By loading an instruction, the corresponding Data Register is selected for access,
providing and/or accepting data according to the selected instruction.
Only a few instructions are defined by the IEEE standard, and only a few of them are mandatory,
the BYPASS instruction (mandatory) for use in daisy-chained multi-core configurations
IDCODE instruction (not mandatory) for identifying a device
Unused instruction codes can be freely implemented by the device manufacturer.
The width of the IR is not specified by the JTAG standard but needs to be the same for all instructions of a specific device.
Since the DR is selected according to the loaded instruction the DR width is variable.
The following schematic shows the connection of the input signals
with the DTAB and the selection of the Data Register depending on the content of the Instruction Register:
The IEEE standard defines a 16-state state machine called the TAP controller to control several actions:
Each state of the TAP controller can be reached by a sequence of bits transmitted via the TMS line depending on the current state.
Normally a DR or IR shift access starts from the pause parking position,
changes to one of the shift states where data is transmitted and ends up in the pause parking position again.
Pause parking position: state the TAP controller holds while waiting for the next shift operation.
The following states of the TAP controller are of importance:
Test Logic Reset
sets the Instruction Register to its reset value (IDCODE or BYPASS).
This state can be reached from any other state by shifting five times “1” on TMS.
Some CPUs do also reset the DTAB and/or the on-chip debug logic when this state is entered.
As a result an active debug connection might get lost, if this state is driven by a PRACTICE script or a custom application.
Run-Test/ Idle and Select DR-Scan are used by most debuggers as pause parking position.
In the Shift-IR state the debug tool shifts an instruction into the Instruction Register.
The instruction is activated once the TAP controller reaches the Update-IR state.
In the Shift-DR state the debug tool shifts data to/from the Data Register selected by the currently loaded instruction.
The debug tool communicates with the DTAB by reading and/or writing IRs and DRs.
The debug tool first drives the TAP Controller to the Shift-IR state to write the appropriate instruction to IR.
Then it drives to the Shift-DR state where the DR can be read or written.
Once the Update-DR state is reached, the processing of DR is started, e.g. the data contained in DR is forwarded to the on-chip debug system.
The following example shows how the chip ID code is read on a TriCore processor
(IR: 8 bits, IDCODE DR: 32 bits)
Reading or writing the IR or DR is performed bitwise from LSB to MSB. With every bit shifted into the TAP controller via TDI,
the contents of DR is rightshifted one bit, providing the LSB on TDO.
Shifting in a Daisy-chained Multi-TAP Solution
The TAP controllers of all DTABs are synchronized.
So when transmitting data in Shift-IR and Shift-DR states this means that the Instruction- and Data Registers are chained, too.
Communication with all DTABs simultaneously is not possible
since the connected debuggers all have different tasks to do and so have an individual communication with their core.
Instead only one debugger at a time communicates with one single DTAB,
by loading the Instruction Registers of all other DTABs with the BYPASS instruction (“ignore” mode).
Loading the BYPASS instruction into the Instruction Register will switch the Bypass Register into the Data Register path:
• The JTAG standard defines the BYPASS instruction to consist of “1”s only.
In case the width of the Instruction Register (IR-width) is 4 bit, the JTAG instruction is 0xf,
in case IR-width is 7 bit, the BYPASS instruction is 0x7f.
• The Bypass Register must be a 1-bit register and is preloaded with “0” in the Capture-DR state.
So depending on the position of the DTAB to be addressed,
the Instruction-/Data-Registers of the other DTABs have to be filled with BYPASS instructions, respectively “bypass” bits.
On the following pages an example chip is used, which provides a chain of three DTABs (one TAP each):
The picture below shows the Instruction/Data Registers if TAP1 is accessed.
Remember that shifting is performed from LSB to MSB, so in case of an IR shift,
the BYPASS instruction(s) of the TAP(s) after the addressed TAP are shifted in first.
Accordingly these bits are called IR_PRE bits.
The BYPASS instructions of the TAP(s) before are shifted in last so these bits are called IR_POST.
The same applies to the DR path with DR_PRE and DR_POST.
On embedded designs with several TAPs the signals can be chained on board level, so only one common debug connector is required.
This saves space and costs. In case the TAPs are already connected on-chip this also saves pins.
In case a single debugger hardware handles access to all cores under debug,
advanced debug features such as the synchronous multi-core start can be implemented more performant.
The tool must be able to address its core within the TAP chain (multi-TAP capable),
and it must be able to share the JTAG port with other tools.
Because all IRs need to be accessed for shifting instructions,
the complete TAP chain can only be as fast as the slowest TAP thus reducing performance of faster TAPs.
This is especially the case in designs with a return clock (RTCK), e.g. DTABs from ARM.
The connection of the JTAG signals as well as the on-board or on-chip routing must be handled with care to avoid electrical interference,
e.g. by interference of reflections at the end of branch lines.
For handling a multi-TAP system, needs to know only few details about the chain:
• IR_POST is the sum of the IR-width of all TAPs between the TDI pin of the debug connector and the addressed TAP.
• IR_PRE is the sum of the IR-width of all TAPs between the addressed TAP and the TDO pin of the debug connector.
• DR_POST usually is the sum of the bypass registers of all TAPs between the TDI pin of the debug connector and the addressed TAP.
• DR_PRE usually is the sum of the bypass registers of all TAPs between the addressed TAP and the TDO pin of the debug connector.
• TAP State is the neutral parking position where a host instance hands over control of the JTAG chain to another host instance or another debug tool.
The following code are available for the neutral parking position:
Training JTAG Interface的更多相关文章
- HappyJTAG2 - JTAG AND SPI AVR8 interface EMBEDDED JTAG ! EMBEDDED SPI !
New version released ! V2.45 (Check version list for details) This construction is based on HappyJTA ...
- ST40 自制 JTAG 适配器
// 文章首发于 https://zhuanlan.zhihu.com/p/28762429 // 但是不知道为什么搜索引擎还没有收录,便在博客再次发布. 0. 引言 意法半导体生产的 SH4 架构的 ...
- JTAG 引脚自动识别 JTAG Finder, JTAG Pinout Tool, JTAG Pin Finder, JTAG pinout detector, JTAGULATOR, Easy-JTAG, JTAG Enumeration
JTAG Finder Figuring out the JTAG Pinouts on a Device is usually the most time-consuming and frustra ...
- ARM JTAG 信号 RTCK 应该如何处理?
用户在调试内嵌可综合内核的 CPU 如 ARM7TDMI-S 时,需要通过打开仿真器的自适应时钟功能. 此时,ARM仿真器根据 RTCK 时钟信号的频率,产生可用于 CPU 内核当前时钟主频的最快的 ...
- Serial Wire Debug (SWD) Interface -- PSoc5
PSoC 5 supports programming through the serial wire debug (SWD) interface. There are two signals in ...
- JTAG Simplified
JTAG Simplified So the other day, I explored the JTAG bus interface which is frequently found in CPL ...
- JTAG – A technical overview and Timing
This document provides you with interesting background information about the technology that underpi ...
- Implementation of Serial Wire JTAG flash programming in ARM Cortex M3 Processors
Implementation of Serial Wire JTAG flash programming in ARM Cortex M3 Processors The goal of the pro ...
- Turtelizer 2 provide JTAG Flash programming and debugging of ARM based boards via USB
http://www.ethernut.de/en/hardware/turtelizer/ Introducing Turtelizer 2 Overview Turtelizer 2 had be ...
随机推荐
- Memcached命令:简单获取缓存value用法
Memcached:命令用法1.cmd 输入telnet ip 端口 进入memcached服务端窗口比如:xxx.Token_T1435622096xxx为key获取此key的memcached ...
- Wordpress页脚
<?php /** * The template for displaying the footer */ ?> <?php if ( apply_filters( 'show_fl ...
- 第八集:魔法阵 NTT求循环卷积
题目来源:http://www.fjutacm.com/Problem.jsp?pid=3283 题意:给两串长度为n的数组a和b,视为环,a和b可以在任意位置开始互相匹配得到这个函数的值,求这个函数 ...
- linux(CentOS7)中安装erlang(20.3)以及rabbitmq(3.7.9)的步骤以及一些注意事项
首先下载安装包,之后先安装erlang,安装erlang需要很多依赖,所以一步步来: 首先 wxWidgets会报错,这个不是必须的,可以不安装,不影响 然后需要安装一些必须的依赖: yum inst ...
- Quartus II 安装教程—FPGA入门教程【钛白Logic】
Quartus II 工具安装一般分为两个部分,首先是开发工具本身的安装,其次就是器件库的安装,我们可以根据我们的需要选择相应的器件库来安装,这里我们使用Cyclone IV的FPGA,即安装Cycl ...
- redis从入门到踩坑
背景 Redis在互联网项目的使用也是非常普遍的,作为最常用的NO-SQL数据库,对Redis的了解已经成为了后端开发的必备技能.小编对Redis的使用时间不长,但是项目中确两次踩中了Redis的坑, ...
- Petrozavodsk WinterTraining 2015
PetrozavodskWinterTraining2015 A - Three Servers 题目描述:有\(n\)个数,将这\(n\)个数分成\(3\)堆,使得\(3\)堆中和的最大值减最小值最 ...
- 013_Mac OS X下应该如何卸载软件和安装应用软件
一.Mac OS X下应该如何卸载软件 Mac OS X的软件安装方式有很多种,而软件卸载的情况也很不同.在Mac OS X拆除软件往往不是把软件拉到废止篓里那么简单.通常情况下要具体问题具体分析.无 ...
- 如何使用windows的计划任务?计划任务?
我们经常有一些程序想要过了几小时来运行:比如定时关机 或者说希望能够每天的几点执行一个什么程序: 这些所有的操作都需要用到windows的任务计划:或者叫计划任务:反正都一样 下面小编将指导大家创建一 ...
- Java IO流杂谈
创建文件和删除文件(File类) import java.io.File; import java.io.IOException; public class T2 { public static vo ...