![]() |
NATIONAL INSTITUTE FOR NUCLEAR
AND HIGH ENERGY PHYSICS
DEPARTMENT OF ELECTRONIC TECHNOLOGY P.O.box 41882, NL 1009 DB AMSTERDAM |
| LPT_JTAG | Hard- and software to drive JTAG compatible ports
version: may 20 1998 |
The LPT_JTAG software is a program written in QBASIC. It takes a datafile
as an input, generates a few output files and drives the LPT port. A special
(home made) cable from the PC's LPT-port to the JTAG port is required.
Check for most recent version: http://www.nikhef.nl/user/d01/lpt_jtag/
General Commands Example Example 2 Software Hardware TAP controller
The LPT_JTAG software is a small program written in QBASIC. It takes
a datafile as an input and generates a few output files. A special cable
from the PC's LPT-port to the JTAG port is required.
Please note that in this version of the
Basic program, the cable specification has changed. This is done to minimize
(remove) the cross-talk between TDO and TCK. Especially TCK is very sensitive
to noise. At NIKHEF we use long cables and RS 485 translators to access
self programmed JTAG ports. In the past we had problems with cross-talk
from TDO to TCK. If you are using this stuff already, you have to swap
pins 2 and 8 on the D25 connector. Use this connector
specification with software of May 1 1998 or later.
The program takes the <name>.idt input file from the data subdirectory and checks the syntax. <name>.log is generated, containing the original statements and the expanded loops. Endless loops will run until a key is hit. Endless loops are defined by omitting the number of loops. The logging is limited to showing the complete sequence once. The data read back is recorded 4 times in the <name>.log file. The data received is represented in binary format. Loops cannot be nested. When the input data is entered in hexadecimal format it is converted into a multiple of 4 bits. Hexadecimal data should start with '0X' or '$'. A comment starts with ';', the rest of the line is ignored by the parser. There is no difference between upper and lower case. The <name>.odt file just holds the data send and received in binary format. The <name>.err file lists the syntax errors with the corresponding line numbers in the source file (<name>.idt). If multiple input files are run after another, the line numbers are not reset.
| TMS0 | reset TMS (default) |
| TMS1 | set TMS |
| RST0 | reset TRST (default) |
| RST1 | set TRST |
| PEN0 | disable programming mode (default) |
| PEN1 | enable programming mode (some AMD devices) |
| TRG0 | reset trigger signal (no TCK generation) (default) |
| TRG1 | set trigger signal (no TCK generation) |
| UNI0 | reset signal UNI (no TCK generation) |
| UNI1 | set signal UNI (no TCK generation) |
| LOOP | start an endless loop |
| LOOP n | start n loops |
| ENDL | end of the loop |
| WAIT | execution pauses until keyboard input |
| WAIT n | execution pauses n seconds |
| IDAT 01010[+] | binary input data (01010 generates 5 TCKs), see IDAT |
| IDAT $24F[+]
IDAT 0X24f |
hexadecimal data (24F generates 12 TCKs) |
| BYP0 | normal operation (default) |
| BYP1 | enable bypass (TI device) |
| TCKN n | generate n TCKs |
| SADD a | send decimal address a via shadow protocol (TI) |
| SADD $a
SADD 0Xa |
send hexadecimal address a via shadow protocol (TI) |
| ; | start of comment text (untill end of line) |
| VSYS | generates a stimulus file for the v-system simulator, see VSYS |
| ESYS | end vector generation, see VSYS |
| TMON1 | switch on tap monitor (default). |
| TMON0 | switch off tap monitor |
| LOG1 | switch on logging of data read back on screen (default) |
| LOG0 | switch off logging |
| ECHO | the rest of the line is echoed to screen |
| ? | Interactively asks for a parameter |
| ! | Inserts the parameter defined at "?" |
With the last data bit transmitted, also TMS must be set, see IDAT.
The line numbers are incremented while the program is running. This useful when a number of input files are run after another.
The software is written QBASIC because this gives easy access to the
LPT port and because I am not a software expert. lpt_jtag.bas can be run
in a DOS-window in Windows. Using lpt_jtag.pif the program can conveniently
be started via an icon. Adjusting the file properties, the proper default
subdirectory (location of the program) should be defined. The Basic program
searches for input files in the subdirectory data. The output files
are stored in the same subdirectory. You must correct the path definition
in the beginning of the program. This is where it says: dir$="D:\HENKG\JTAG\DATA".
For a specific use at NIKHEF, the <name>.log file can be converted
to a file set into the subdirectory data\vme\. This option becomes
available at the end of a series of input files. It is not likely this
is of any use outside our institute.
TMS
TMS is used to step through the TAP-controller.
I choose to do this on a low level (instead of go from idle to shift_dr)
to have full control over my programmed JTAG ports.
RST
RST is (hardly ever) used to reset the TAP-controller. I advise you
not to use it if possible.
PEN
Program enable is foreseen to be used with MACH devices. The program
enable pin on these chips enables the JTAG port to load a new functionallity
(to re-program them).
TRG
TRG can be used as a trigger to the oscilloscope when debugging the
system under test. It is not used in the connector on the board under test.
UNI
UNI is used at NIKHEF to generate test pulses to our boards. A sort
of general purpose signal. Much like TRG.
LOOP
LOOP creates a loop as in Basic. The ENDL defines the end of the sequence
to be looped through. Without parameters it is an endless loop, untill
a keyboard input is seen (Enter). A parameter defines the number of loops
(decimal). Loops cannot be nested. The rest of the line, containing the
loop statement, is ignored. So, don't put anything else then a comment
there. In an endless loop the generation of <name>.ODT and <name>.LOG
is paused after three loops and continued when the loop is left.
WAIT
WAIT stops execution of the <name>.idt file untill user input (Space).
When a parameter is used, it defines the number of seconds to pause (decimal).
IDAT
The IDAT command sends data to the device under test and reads back the results from the device. When hexadecimal data is specified, always a multiple of 4 bits are generated. With the last bit transmitted, TMS is set high according to the 1149 specifications. The last bit is shifted when the TAP controller goes from shift to exit1, either in instruction or data mode. For long registers, a single data string might not be very convenient. For this reason multiple idat commands can be given. The concatenation character '+' prevents the automatic TMS generation here.
So the command:
idat $ab; load the 8 bit register 2 (bits 11:4)
When in the VSYS mode some commands are ignored: PEN0, PEN1, TRG0, TRG1,
BYP0, BYP1 and WAIT. Loops are expanded in the usual way and endless loops
will generate (large) files, until stopped manually. The file generated
is named <name>.do, the usual extension for a simulator macro file.
The ESYS command ends the generation. Multiple VSYS-ESYS sequences may
be used to build the macro.
TMON
The TMON command switches the tap monitor on and off. When a command
line is fully executed and echoed in the .log file, the current TAP-state
is added to the .log file in the same line between < > brackets.
Example:
tms1,tms1,tms0,tms0; idle to shift_ir
idat 1111 1111 1111+;
TDC4,5,6: bypass
idat 1111+; Control
chip: bypass
idat 0011+; Majority
chip: control
idat 1111; Read out
chip: bypass
tms0,tms1,tms1,tms1,tms0,tms0; shift_ir to shift_dr
idat 000+; TDCs: bypass
idat 0+; Control chip:
bypass
echo even channels pulsed,
threshold = 48
log1
idat 0010 0000+; Majority:
control, enable driver
echo 0010 0100 expected
log0,wait
idat 0; Read out: bypass
tms0,tms1,tms1,tms0; shift_dr to idle
?,!
The question mark "?" asks the user to input a parameter. This either
decimal or hexadecimal. At NIKHEF we use it to define the address of the
card on the bus to be accessed. The exclamation mark "!" is used to pass
the parameter to the chain.
Example:
|
|
||
|
|
signal | usage |
|
|
STRB | - |
|
|
D0 | P_Ena * |
|
|
D1 | TDO (output) |
|
|
D2 | TMS |
|
|
D3 | UNI |
|
|
D4 | _BYPASS (TI) |
|
|
D5 | _TRST |
|
|
D6 | TCK * |
|
|
D7 | Trigger |
|
|
_ACK | - |
|
|
BUSY | - |
|
|
P_END | - |
|
|
SEL | - |
|
|
AUTO_F | - |
|
|
_ERROR | TDI (input) |
|
|
_INIT | - |
|
|
SEL_INP | - |
|
|
GND | GND |
| The TDO (output of the PC) connects to the TDI of the device under test. | ||
At NIKHEF we defined a 10 pin header to connect the LPT cable.
|
|
|
| 1 | TCK |
|
|
_BYPASS (TI devices) |
|
|
TMS |
|
|
GND |
|
|
TDI (input of device under test) |
|
|
Vcc |
|
|
TDO (input of PC) |
|
|
GND |
|
|
_TRST |
|
|
P_ENA |
Since you can never find the TAP controller's state diagram when you
need it, here it is.