Jtag Test
Jtag Test
Jtag Test
www.jtagtest.com Version 1.05 Copyright 2006 2011 SECONS Ltd., www.secons.com Page 1 of 29
Table of Contents
Installing JTAG Test.............................................................................................................................4 Installing JTAGTest on Linux..........................................................................................................4 Installing BSDL Library files.......................................................................................................... 5 What are BSDL files?................................................................................................................. 5 Using JTAGTest....................................................................................................................................7 BSDL Library scan.......................................................................................................................... 7 Assigning BSDL file for each device.............................................................................................. 8 Loading additional BSDL files........................................................................................................ 8 Setting JTAG Options......................................................................................................................9 Scripting language..............................................................................................................................10 JTAG Functions............................................................................................................................. 10 CheckVCCIO............................................................................................................................10 DetectChain...............................................................................................................................10 IRScan.......................................................................................................................................10 DRScan..................................................................................................................................... 10 User interface functions.................................................................................................................10 SetTaskProgress........................................................................................................................ 10 SetTaskInfo............................................................................................................................... 10 SetActionProgress.....................................................................................................................10 SetActionInfo............................................................................................................................10 SetStatus....................................................................................................................................10 SetTestTitle................................................................................................................................10 MessageBox..............................................................................................................................10 System functions............................................................................................................................12 Sleep..........................................................................................................................................12 String functions..............................................................................................................................12 chr..............................................................................................................................................12 ord............................................................................................................................................. 12 strval..........................................................................................................................................13 strmatch.....................................................................................................................................13 rtrim...........................................................................................................................................14 ltrim...........................................................................................................................................14 trim............................................................................................................................................15 File object...................................................................................................................................... 16 open(string filename,numeric flags)..............................................................................................16 string read(numeric ReadLen)....................................................................................................... 16 numeric read(numeric ReadLen,Array buff)................................................................................. 16 numeric write(string str)................................................................................................................ 16 numeric write(Array arr,numeric arrlen)....................................................................................... 16 numeric lseek(numeric offset,numeric whence)............................................................................16 numeric size()................................................................................................................................ 17 string fgets(numeric maxchars)..................................................................................................... 17 numeric fputs(string str).................................................................................................................17 Running SVF/XSVF/JAM/STAPL Files............................................................................................18 Lattice Extended Serial Vector Format (.SVF) File.......................................................................18 Page 2 of 29
JTAGTest User Manual PIO SVF extension........................................................................................................................ 19 Standard Test and Programming (STAPL) Player.................................................................... 19 Boundary Scan....................................................................................................................................20 Boundary scan test mode selection...............................................................................................21 Package (chip) View...................................................................................................................... 22 Pin map file assignment.................................................................................................................22 Package mappings..........................................................................................................................23 Waveform recording / viewing...................................................................................................... 24 JTAG IR/DR Scan.............................................................................................................................. 25 IEEE 1149.1 JTAG chain configuration group..............................................................................25 TCK Control.................................................................................................................................. 26 IR Scan...........................................................................................................................................26 DR Scan......................................................................................................................................... 26 Test Reset.......................................................................................................................................26 JTAG IR/DR Scan example: Reading out Xilinx Spartan-3A DNA............................................. 27 JTAG IR/DR Scan example: Debugging Lattice MachXO design................................................29
Page 3 of 29
After launching the application main window should appear. This window may have slightly different appearance compared to JTAGTest running on Microsoft Windows. This is caused by several bugs in Wine.
Page 4 of 29
If the application does not recognize correctly JTAG-USB ViaTAP interface, please consult ViaTAP hardware manual for information on how to fix the permissions for ViaTAP USB device /dev entries.
We provide BSDL library for most of the common ICs used nowadays. This self-extractable bundle can be downloaded from http://www.jtagtest.com/download.
JTAGTest User Manual IC name Package (TQFP100, CS48, etc) JTAG bus speed Port mapping Boundary scan cells description
BSDL File(s) can be automatically assigned to a part present in JTAG chain based on IDCODE. IDCODE is a unique 32bit number assigned to each part (or die). Please note that IDCODE does not specify package, voltage, temperature or speed grade. If different BSDL files are present for one part IDCODE, you will need to select suitable variant manually.
Page 6 of 29
Using JTAGTest
You can run JTAG Test from Start menu or by executing the JTAGTest.exe file from program's directory.
If the ViaTAP JTAG Interface is connected, tested board is powered up and JTAG chain is setup correctly, icon list of present devices should appear. You can click on the device to select it and then perform intended actions on the selected device.
Page 7 of 29
JTAGTest User Manual JTAG chain can be re-scanned anytime by clicking on Re-scan chain button. This re-scan operation cause loosing of any changes you have made to the chain. Some buttons require properly set-up chain (i.e. selected BSDL models/files). They are inactive unless all requirements are met.
Page 8 of 29
Page 9 of 29
Scripting language
JTAGTest provides scripting language compatible with ECMA-262. Important: Scripting functionality of JTAGTest is in development phase and information given in this chapter is for beta testers only.
JTAG Functions CheckVCCIO DetectChain IRScan DRScan User interface functions SetTaskProgress SetTaskInfo SetActionProgress SetActionInfo SetStatus SetTestTitle MessageBox
Displays a modal dialog box that contains a system icon, a set of buttons, and a brief applicationspecific message, such as status or error information. The message box returns an integer value that indicates which button the user clicked.
numeric Message(string text, string title, numeric flags);
Page 10 of 29
text
A string that contains the message to be displayed. If the string consists of more than one line, you can separate the lines using a carriage return and/or linefeed character between each line. A string that contains the dialog box title. Compatible with Microsoft Windows API function MessageBox flags parameter
title flags
Return value
Return value is compatible with return value of Microsoft Windows API function MessageBox.
Description
The MessageBox() function is fully compatible with Microsoft Window API function MessageBox. It's definition can be found at MSDN library (http://msdn.microsoft.com/enus/library/ms645505.aspx).
Page 11 of 29
Parameters
milisecond
Description
The sleep() function shall cause the calling script to be suspended from execution until the number of realtime miliseconds specified by the argument milisecond has elapsed. The suspension time may be longer than requested due to the scheduling of other activity by the system.
Parameters
charcode
Return value
A numeric expression representing character code, for the character. The valid range for numb is 0 through 255.
The chr() function converts an integer numeric value into an ASCII character by returning the character value, if any, whose ordinal number is equal to the value of its argument. Note that it is an error if the argument is not within the range 0..255. This function complements to chr() function.
ord
Returns the ASCII value of the first character of a string.
Numeric ord(string char);
Page 12 of 29
char
Return value
The string to get an ASCII value from. First character from string is used.
Returns the ASCII value of the first character of a string as an numeric integer.
Description
The ord() function returns the ASCII value of the first character of a string as an numeric integer. This function complements to chr() function.
strval
Converts numeric value to string.
string strval ( numeric var [, numeric base [, numeric digits ] ] );
Parameters
A numeric expression representing value to be converted to a string Base of numeric expression var. If not specified, default value is 10. Minimum number of digits to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. If not specified, default value is 1.
Return value
strmatch
Compares two strings using wildcards.
numeric strmatch(string str, string regstr);
Parameters
str regstr
Simple string, which is compared to regstr. String to which str is compared to. This string can containg wildcards (*,?)
Page 13 of 29
The strmatch() function compares its search string regstr, which can contain wildcard characters, against the input string expression str. The asterisk (*) substitutes as a wildcard character for any zero or more characters, and the question mark (?) substitutes as a wildcard character for any one character.
rtrim
Strip whitespace (or other characters) from the end of a string.
String rtrim(string str, [string charlist]);
Parameters
str charlist
Return value
The input string Defines characters that will be stripped. If not specified, tab and whitespace are stripped.
Returns a string with whitespace (or other characters) stripped from the end of str.
Description
The rtrim() function strip whitespace (or other characters) from the end of a string. It removes characters from the end of the string str until it find character, that is not included in charlist.
Example
rtrim('tech rtrim('tech ') //would return 'tech' ', ' '); //would return 'tech'
rtrim('123000', '0'); //would return '123' rtrim('Tech123123', '123'); //would return 'Tech' rtrim('123Tech123', '123'); //would return '123Tech' rtrim('Techxyxzyyy', 'xyz'); //would return 'Tech' rtrim('Tech6372', '0123456789'); //would return 'Tech'
ltrim
Strip whitespace (or other characters) from the beginning of a string.
String ltrim(string str, [string charlist]);
Page 14 of 29
str charlist
Return value
The input string Defines characters that will be stripped. If not specified, tab and whitespace are stripped.
Returns a string with whitespace (or other characters) stripped from the beginning of str.
Description
The ltrim() function strip whitespace (or other characters) from the beginning of a string. It removes characters from the beginning of the string str until it find character, that is not included in charlist.
Example
ltrim(' ltrim(' tech'); //would return 'tech' tech', ' '); //would return 'tech'
ltrim('000123', '0'); //would return '123' ltrim('123123Tech', '123'); //would return 'Tech' ltrim('123123Tech123', '123'); //would return 'Tech123' ltrim('xyxzyyyTech', 'xyz'); //would return 'Tech' ltrim('6372Tech', '0123456789'); //would return 'Tech'
trim
Strip whitespace (or other characters) from the beginning and end of a string.
String trim(string str, [string charlist]);
Parameters
str charlist
Return value
The input string Defines characters that will be stripped. If not specified, tab and whitespace are stripped.
Returns a string with whitespace (or other characters) stripped from the beginning and end of str.
Description
The trim() function strip whitespace (or other characters) from the beginning and end of a string. It removes characters from the beginning and end of the string str until it find character, that is not included in charlist. Page 15 of 29
File object
Page 16 of 29
numeric size()
Page 17 of 29
Xilinx ISE (Xilinx iMPACT) Altera Quartus Programmer Actel Libero IDE Lattice Semiconductor ispLEVER Cypress ISR Atmel .jed to SVF converter
SVF File is executed by clicking on Run SVF from JTAG Test main screen.
Example:
LOOP 85 ; SIR 8 TDI IDLE TDI TDO ENDLOOP ; (52); 10 TCK (0) (1); 1.00E+000 SEC;
RUNTEST SDR 1
Page 18 of 29
Page 19 of 29
Boundary Scan
Boundary Scan function is available after you have selected a part in JTAG chain (by selecting IC's icon), BSDL file for the selected part is available and correct package BSDL model is selected. When you click on Boundary scan button the following window appears:
Top area of this window displays the part information, and the test options. Main area contains list of available pins/ports. In order to perform single-shot scan, click on Perform scan button. To view ports state in real time, click on Realtime scan button. Please note, in single-shot mode (Perform scan button), you always see state of pins BEFORE performing the boundary scan operation. The pin states are captured before scan operation (on capture-DR state) and updated after shifting all data in and out (update-DR state).
Page 20 of 29
Page 21 of 29
Import script for Cadsoft Eagle CAD is also provided (available on our website). When you load pin map file for your design, user pin/net names appear in the third column and chip Page 22 of 29
JTAGTest User Manual view window if displayed. User pin names are also used for waveform recoding function.
Package mappings
JTAGTest will assign package layout based on PHYSICAL_PIN_MAP attribute. If the attribute is set to some generic layout name (e.g. DIE), JTAGTest has no way how to assign correct package. In such case, please modify the BSD file: entity RINGO_DEVICE is generic (PHYSICAL_PIN_MAP : string := "RINGO"); Example of change: entity RINGO_DEVICE is generic (PHYSICAL_PIN_MAP : string := "BGA400");
Page 23 of 29
After you selected all desired signals, check the Record waveform at the top of the boundary scan window and click on Real-time scan. When you stop the scan, the View waveform button becomes functional and allows you to display another window with captured waveform:
Page 24 of 29
Caution: Use this function very carefully as incorrect usage may destroy your target device! This function does not check entered values as BSDL files do not provide any information regarding instructions/registers logic! Scan data within IR/DR TDI and TDO boxes is expressed as hexadecimal. The scan data cannot specify a data string that is larger than the specified bit length. Most Significant Bit (MSB) zeroes in the hex string are not considered when determining if the string is too large. The bit order for scan data follows the convention that the least significant bit (rightmost bit) is the first bit scanned into the hardware for TDI scan data and is the first bit scanned out for TDO data. This bit ordering is consistent with the IEEE 1149.1 convention. Digits can be grouped by 8 bits (i.e. 00 01 02 03 04 is the same as 0 1 2 3 4 or 01 02 03 04 or 1 02 3 04).
Page 25 of 29
TCK Control
This function is used to issue TCK clocks in defined state (usually used for flash programming or other operations that require external JTAG clocking).
IR Scan
This function performs IR scan operation on JTAG chain. TDI input allows selection from list of opcodes defined in BSDL file (if BSDL file is assigned to the device). You may choose from list, enter instruction name (i.e. IDCODE) or enter hexadecimal representation of the instruction (i.e. 01 0B). DR Length must be always adjusted after performing IR scan.
DR Scan
This function performs DR scan operation on JTAG chain. You must enter hexadecimal representation of the data register (i.e. 01 23 45 67). If you do not enter any value, all zero bits will be shifted to DR.
Test Reset
This function will put JTAG TAPs into TEST_RESET state.
Page 26 of 29
BSCAN_SPARTAN3A BSCAN_SPARTAN3A_inst ( .CAPTURE(CAPTURE), // CAPTURE output from TAP controller .DRCK1(DRCK1), // Data register output for USER1 functions .DRCK2(DRCK2), // Data register output for USER2 functions .RESET(RESET), // Reset output from TAP controller .SEL1(SEL1), // USER1 active output .SEL2(SEL2), // USER2 active output .SHIFT(SHIFT), // SHIFT output from TAP controller .TDI(TDI), // TDI output from TAP controller .UPDATE(UPDATE), // UPDATE output from TAP controller .TDO1(TDO1), // Data input for USER1 function .TDO2(TDO2) // Data input for USER2 function ); endmodule
Configure the target Spartan-3A device, run JTAGTest, assign BSDL file to the device and run JTAG IR/DR Scan and configure active device:
And then DR Scan, which reads out the device DNA 56-bit number (marked red):
Page 28 of 29
// Internal oscillator, running 18-26 MHz OSCC OScInst (.OSC(clk)); // Increment counter always @(posedge clk) begin counter = counter + 1; end // JTAG Signals wire JTCK; wire JUPDATE; wire JSHIFT; // JTAGD port instance JTAGD JTAGInst ( .JTCK(JTCK), .JTDO1(countersample[0]), // IPA JTAG bit .JUPDATE(JUPDATE), .JSHIFT(JSHIFT) ); // Main JTAG task, implementing IPA JTAG register always @(posedge JTCK) begin if (JSHIFT) begin countersample[59:0] <= countersample[60:1]; end else begin countersample <= counter; end end endmodule
Program the FPGA with the above top module and run IR/DR Scan from JTAGTest main menu. Perform IPA IR scan, set length of DR to 61 bits and click on DR Scan. TDO should show current counter value. When you click again on the DR Scan button, TDO should show higher value (counter increments).
Page 29 of 29