SISTEMI EMBEDDED AA 2012/2013 JTAG CIRCUITRY JTAG DEBUG MODULE JTAG-UART PERIPHERAL

Similar documents
9. IEEE (JTAG) Boundary-Scan Testing for Stratix II and Stratix II GX Devices

8. JTAG Boundary-Scan Testing in MAX V Devices

SECTION 11 JTAG PORT

IEEE JTAG Boundary Scan Standard

Boundary Scan Implementation

Boundary Scan. Sungho Kang. Yonsei University

A Research Paper on Designing a TAP(Test Access Port)

Boundary-scan test for structural fault detection

P1149.1A Extensions to IEEE-STD

Chapter 7 Debugging Support

Board-level testing and IEEE1149.x Boundary Scan standard. Artur Jutman

BOUNDARY-SCAN: AN INTRODUCTION. by James Stanbridge, Sales Manager of JTAG Technologies

Section 33. Programming and Diagnostics

ORCA Series Boundary Scan

Aeroflex Colorado Springs Application Note

Figure 6 1 shows a block diagram of the UART core. shift register. shift register

Connecting Spansion SPI Serial Flash to Configure Altera FPGAs

Guidelines for Developing a Nios II HAL Device Driver

Configuring Cyclone FPGAs

JTAG TAP CONTROLLER PROGRAMMING USING FPGA BOARD

Standard File Pointers

Boundary-Scan Tutorial

Section II. Software Settings

UNIT IV-2. The I/O library functions can be classified into two broad categories:

Is Now Part of To learn more about ON Semiconductor, please visit our website at

microsparc-iiep TM Introduction to JTAG Boundary Scan

9. PIO Core. Core Overview. Functional Description

BOUNDARY-SCAN DFT & LAYOUT PRINCIPLES at BOARD LEVEL

Mixed Signal IC Testing. Mixed Signal DFT. IEEE Std 蘇朝琴國立交通大學電機工程學系. Mixed Signal IC Testing. IEEE Std. 1149

Development of a Boundary Scan Test controller creation tool

DOMAIN TECHNOLOGIES INC. Users Guide Version 2.0 SB-USB2. Emulator

UNIX input and output

SCANSTA111. SCANSTA111 Enhanced SCAN Bridge Multidrop Addressable IEEE (JTAG) Port. Literature Number: SNLS060J

Chip & Board Testability Assessment Checklist

CSI 402 Lecture 2 Working with Files (Text and Binary)

Laboratory Exercise 5

SCANSTA111 Enhanced SCAN bridge Multidrop Addressable IEEE (JTAG) Port

SISTEMI EMBEDDED. (Software) Exceptions and (Hardware) Interrupts. Federico Baronti Last version:

Actel BSDL Files Format Description

Boundary Scan Tutorial. A tutorial prepared by Dr R G Ben Bennetts, DFT Consultant. Tel: Welcome!!

Programming in the MAXQ environment

AGM CPLD AGM CPLD DATASHEET

9. Configuration, Design Security, and Remote System Upgrades in Stratix V Devices

NIOS CPU Based Embedded Computer System on Programmable Chip

Accessing Files in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts

ENG120. Misc. Topics

Harry Bleeker Peter van den Eijnden Frans de Jong

Chapter 8 Test Standards. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

System Testability Using Standard Logic

Revision: 11/30/ E Main Suite D Pullman, WA (509) Voice and Fax

Naked C Lecture 6. File Operations and System Calls

Guidelines for Developing a Nios II HAL Device Driver

PROGRAMMAZIONE I A.A. 2017/2018

SECTION 2 SIGNAL DESCRIPTION

Platform Flash In-System Programmable Configuration PROMs

Boundary Scan. Sungho Kang. Yonsei University

Platform Flash In-System Programmable Configuration PROMs

Standard C Library Functions

Lecture 28 IEEE JTAG Boundary Scan Standard

Files and Directories

13. Configuring Stratix & Stratix GX Devices

WEB-BASED APPLET FOR TEACHING BOUNDARY SCAN STANDARD IEEE

9. Configuration, Design Security, and Remote System Upgrades in Arria II Devices

SISTEMI EMBEDDED AA 2012/2013. SOPC Nios II Interval Timer Core

Practical Hardware Debugging: Quick Notes On How to Simulate Altera s Nios II Multiprocessor Systems Using Mentor Graphics ModelSim

Physical Files and Logical Files. Opening Files. Chap 2. Fundamental File Processing Operations. File Structures. Physical file.

NIOS CPU Based Embedded Computer System on Programmable Chip

ALTERA FPGAs Architecture & Design

Using Proprietary Lattice ISP Devices

The Boundary - Scan Handbook

Basics of board-level testing and IEEE1149.x Boundary Scan standard

Universität Dortmund. IO and Peripheral Interfaces

CHAPTER 1 Introduction of the tnano Board CHAPTER 2 tnano Board Architecture CHAPTER 3 Using the tnano Board... 8

Input / Output Functions

CS240: Programming in C

Digital Integrated Circuits

NIOS CPU Based Embedded Computer System on Programmable Chip

SCANSTA112 Designers Reference

JTAG and I 2 C on ELMB

Systems Programming. 08. Standard I/O Library. Alexander Holupirek

TAP Expander Blackhawk Emulator Expansion Pod. Document Part Number: REV B

FastFLASH XC9500XL High-Performance CPLD Family

10. SOPC Builder Component Development Walkthrough

What Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System

DESIGN OF IEEE TAP CONTROLLER IP CORE

4. Configuring Cyclone II Devices

Goals of this Lecture

Application Note # Design For Boundary-Scan Testing and In-System Programming Guidelines. September 18, 2003

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C Basics And Concepts Input And Output

Simulating Nios II Embedded Processor Designs

I/O Management! Goals of this Lecture!

I/O Management! Goals of this Lecture!

File (1A) Young Won Lim 11/25/16

CSCI 4974 / 6974 Hardware Reverse Engineering. Lecture 12: Non-invasive attacks

AN4353 Application note

NIOS Character. Last updated 7/16/18

10. Configuration, Design Security, and Remote System Upgrades in Stratix IV Devices

V SS (GND) RESET. Backplane Data Memories (8,192 channels) Local Connection Memory (4,096 locations) Backplane Connection Memory (8,192 locations)

Version 1.6 Page 2 of 25 SMT351 User Manual

Transcription:

SISTEMI EMBEDDED AA 2012/2013 JTAG CIRCUITRY JTAG DEBUG MODULE JTAG-UART PERIPHERAL

Joint Test Action Group (JTAG) (1) Established in 1985 to develop a method to test populated PCBs A way to access IC pins organized in a boundary-scan The method was standardized in 1990 as IEEE 1149.1 (Standard Test Access Port and Boundary-Scan Architecture) A 1994 addendum defined the Boundary Scan Description Language (BSDL)

Joint Test Action Group (JTAG) (2) Today, JTAG is widely used also as communication means to access IC sub-blocks: For debugging purposes in processors For programming purposes in processors, CPLDs, FPGAs JTAG acts as a communication interface to serially read/write internal registers

JTAG interface Test Acces Port (TAP) TRST (Test Reset) optional JTAG Adapter TMS (Test Mode Select) TCK (Test Clock) TDI (Test Data In) TDO (Test Data Out) TRST TMS TCK DEV 1 TRST TMS TCK DEV 2 TDI TDO TDI TDO

JTAG signals (1) TDI (Test Data In): Serial input pin for instructions as well as (test and programming) data. Bits are shifted in on the rising edge of TCK. TDO (Test Data In): Serial data output pin for instructions as well as (test and programming) data. Bits are shifted out on the falling edge of TCK. This pin is tri-stated if bits are not being shifted out of the device. TMS (Test Mode Select): Input pin that provides the control signal to determine the transitions of the TAP controller state machine. Transitions within the state machine occur at the rising edge of TCK (TMS is evaluated on the rising edge of TCK). Therefore, TMS must be set up before the rising edge of TCK.

JTAG signals (2) TCK (Test Clock input): The clock input to the BST circuitry. Some operations occur at the rising edge, while others occur at the falling edge. TRST (Test Reset input): Active-low input to asynchronously reset the boundary-scan circuit. (TRST is optional according to IEEE Std. 1149.1). This pin should be driven low when not in boundary scan operation and for non-jtag users the pin should be permanently tied to GND.

JTAG circuitry (in Altera devices) Internal registers: ISP: In-System Programmability ICP: In-Circuit Reconfigurability...

Boundary Scan Cell (BSC) (1) SDO PDI BSC PDO Control signals SDI

Boundary Scan Cell (BSC) (2) MODE 0 Functional mode 1 Test mode PDI SHIFTDR SDO 0 1 PDO 0 1 D Q D Q CLOCKDR UPDATEDR SDI Each BSC can: Capture data on its parallel input PDI Update data on its parallel output PDO Serially shift SDI to SDO Behave transparently PDO = PDI

Internal logic Boundary Scan Cell (BSC) (3) 1 3-bit BSC for each (bidirectional) I/O of a Cyclone FPGA PDI: OUTJ, OEJ, PIN_IN PDO: PIN_OUT, PIN_OE, INJ

TAP controller SELECT Finite State Machine (FSM) with 16 states CAPTURE SHIFT / PAUSE UPDATE

Standard instructions Instruction Mandatory Extest Bypass Sample/Preload Optional Intest Idcode Usercode Runbist Clamp HighZ Selected Data Register / (Mode) Boundary scan (Test mode) Bypass (1-bit bypass register between TDI and TDO) Boundary scan (Functional mode) Boundary scan (Test mode) IDCODE register USERCODE register Result register Bypass (I/O hold to the state defined by the boundary scan register) Bypass (I/O in Hi-Z)

Sample/Preload instructions Capture phase Shift and Update phases

Extest/Intest instruction Capture phase Shift and Update phases

JTAG Debug Module (1) Provides on-chip emulation to control the processor remotely from a host PC. Software debugging tools communicate with the JTAG debug module and make it possible to: Download programs to memory Start and stop execution Set breakpoints and watchpoints Analyze registers and memory Collect real-time execution trace data

JTAG Debug Module (2) Piece of hardware (implemented with FPGA logic and memory resources) placed between the JTAG circuitry and the processor The JTAG debug module takes control of the processor by asserting a hardware break or inserting a break instruction in the program memory to be executed A break causes the software routine located at the brake address to be executed The break address is chosen when the processor is generated

JTAG-UART Core Allows characters to be serially transmitted between a Nios processor and a host PC using the JTAG circuitry present in the FPGA and a download cable such as USB-Blaster Hides the complexity of the JTAG circuitry Is supported by HAL system library Character-mode generic device model (Unix-like routines: open, read, write, ) C standard I/O functions (printf, getchar, )

JTAG-UART Core block diagram

Host-Nios II processor connection

Hardware configuration (1) Read/Write FIFO settings: Buffer depth = 2 N B, N = 3 15 (default: 64; N=6) IRQ threshold (default: 8) IRQ is asserted when the number of remaining bytes in the Read FIFO, which can still be written (filled) by the JTAG circuitry, equals the IRQ read_threshold IRQ is asserted when the number of remaining bytes in the Write FIFO, which can still be read (emptied) by the JTAG circuitry, equals the IRQ write_thresold Construct using registers instead of memory blocks 1 B consumes roughly 11 logic elements (LEs)

Hardware configuration (2) Simulation settings: These settings control the generation of the JTAG UART core simulation model Fixed input stream loaded in the Read FIFO at reset Macros for the ModelSim simulator to generate Interactive Windows To display the content of the Write FIFO To also write the Read FIFO instead of the fixed input stream They do not affect the hardware generation

Register map (1) Data and Control registers Data register 31

Control register Register map (2) 31 AC is set after an application on the host PC has polled the JTAG UART core via the JTAG interface Once set, the AC bit remains set until it is explicitly cleared via the Avalon interface. Writing 1 to AC clears it Embedded software can examine the AC bit to determine if a connection exists to a host PC

Interrupt behaviour JTAG can generate an interrupt when the Read FIFO is almost full (read_thresold) or the Write FIFO is almost empty (write_threshold) The write interrupt is cleared by writing characters to fill the write FIFO beyond the write_threshold The read interrupt is cleared by reading characters from the read FIFO The read interrupt condition is also set if there is at least one character in the read FIFO and no more characters are expected

Software programming model ANSI C (Standard Library) streams (using file pointer) fopen(), fread(), fwrite(), fclose(), fprintf()... Eg. FILE *fp; fp=fopen( ); fread(...,fp); HAL (Unix-like functions) HAL (using file descriptor) open(), read(), write(), close(), ioctl(),... Eg. int fd; fd = open( ); read(fd, ); Device Driver altera_avalon_jtag_uart.c altera_avalon_jtag_uart.h altera_avalon_jtag_uart_regs.h system.h JTAG UART Core DATA REGISTER CONTROL REGISTER

File descriptor/pointer File descriptors (integer) are used by low-level I/O functions: open, read, write, close,... File pointers manage streams using high-level functions (buffered operations): Unformatted I/O: fgetc, fputc Formatted I/O: fprintf, fscanf, Eg. stdin, stdout, stderr are specific streams which do not require open and close operations and for which are defined printf, getchar, scanf, functions are defined

Blocking and Non blocking (1) A blocking read waits until the required bytes are available To allow the read function to immediately return if no data are available the file descriptor must be opened with NONBLOCK flag fd = open("/dev/<your device name>", O_NONBLOCK O_RDWR);

Blocking and Non blocking (2) When using a file pointer, we need to retrieve the underlying file descriptor int fd = fileno(fp); int flags = fcntl(fd, F_GETFL); fcntl(fd, F_SETFL, flags O_NONBLOCK); These header file must be included: #include <unistd.h> #include <fcntl.h> When no data are available to read, EOF is returned by the read function

Putting into practice (1) Write a program that displays the ASCII code of a character received from the JTAG UART stdin, stdout, stderr streams must be disconnected from JTAG UART device (BSP Editor) Note that printf is no longer available! Use a file pointer to access the JTAG UART device fgetc reads a character from the stream fprintf sends formatted strings to the Host PC Use nios2-terminal to connect to the processor The Nios II console on Eclipse must be turned off!

Putting into practice (2) Write a program that displays the ASCII code of a character received from the JTAG UART See the effect of blocking read; for example inserting some other operations in the main loop, such as reading the DE2 slider switches and updating the Red LEDs status accordingly Try to use the non-blocking flag

References Altera IEEE 1149.1 JTAG Boundary-Scan Testing, AN39 ver. 6.0, June 2005 Altera, Nios II Processor Reference Handbook, n2cpu_nii5v1.pdf Processor Architecture JTAG Debug Module Altera Embedded Peripherals User Guide, ug_embedded_ip.pdf 6. JTAG UART Core Altera Nios II Software Developer s Handbook, n2sw_nii5v2.pdf Chapter 6. Developing Programs Using the Hardware Abstraction Layer Chapter 14. HAL API Reference