JTAG Access

jtag targets

List JTAG targets or switch between JTAG targets.

Syntax

jtag targets 

List available JTAG targets.

jtag targets <target id>

Select <target id> as active JTAG target.

Options

Option Description
-set Set current target to entry single entry in list. This is useful in comibination with -filter option. An error will be generate if list is empty or contains more than one entry.
-regexp Use regexp for filter matching.
-nocase Use case insensitive filter matching.
-filter <filter-expression> Specify filter expression to control which targets are included in list based on its properties. Filter expressions are similar to Tcl expr syntax. Target properties are references by name, while Tcl variables are accessed using the $ syntax, string must be quoted. Operators ==, !=, <=, >=, <, >, && and || are supported as well as (). There operators behave like Tcl expr operators. String matching operator =~ and !~ match lhs string with rhs pattern using either regexp or string match.
-target-properties Returns a Tcl list of dictionaries containing target properties.
-open Open all targets in list. List can be shorted by specifying target-ids and using filters.
-close Close all targets in list. List can be shorted by specifying target-ids and using filters.
-timeout <sec> Poll until the targets specified by filter option are found on the scan chain, or until timeout. This option is valid only with filter option. The timeout value is in seconds. Default timeout is 3 seconds.

Returns

The return value depends on the options used.

<none>: Jtag targets list when no options are used.

-filter: Filtered jtag targets list.

-target-properties: Tcl list consisting of jtag target properties.

An error is returned when jtag target selection fails.

Example(s)

jtag targets

List all targets.

jtag targets -filter {name == "arm_dap"}

List targets with name "arm_dap".

jtag targets 2

Set target with id 2 as the current target.

jtag targets -set -filter {name =~ "arm*"}

Set current target to target with name starting with "arm".

jtag targets -set -filter {level == 0}

List Jtag cables.

jtag sequence

Create JTAG sequence object.

Syntax

jtag sequence 

Create JTAG sequence object. The jtag sequence command creates a new sequence object. After creation the sequence is empty. The following sequence object commands are available:

sequence state new-state [count]

Move JTAG state machine to <new-state> and then generate <count> JTAG clocks. If <clock> is given and <new-state> is not a looping state (RESET, IDLE, IRSHIFT, IRPAUSE, DRSHIFT or DRPAUSE) then state machine will move towards RESET state.

sequence irshift [options] [bits [data]]
Shift data in IRSHIFT or DRSHIFT state. Data is either given as the last argument or if -tdi option is given then data will be all zeros or all ones depending on the argument given to -tdi. The <bits> and <data> arguments are not used for irshift when the -register option is specified. Available options:
  • -register <name> Select instruction register by name. This option is only supported for irshift.
  • -tdi <value> TDI value to use for all clocks in SHIFT state.
  • -binary Format of <data> is binary, for example data from a file or from binary format.
  • -integer Format of <data> is an integer. The least significant bit of data is shifted first.
  • -bits Format of <data> is a binary text string. The first bit in the string is shifted first.
  • -hex Format of <data> is a hexadecimal text string. The least significant bit of the first byte in the string is shifted first.
  • -capture Capture TDO data during shift and return from sequence run command.
  • -state <new-state>
State to enter after shift is complete. The default is RESET.
sequence delay usec

Generate delay between sequence commands. No JTAG clocks will be generated during the delay. The delay is guaranteed to be at least <usec> microseconds, but can be longer for cables that do not support delays without generating JTAG clocks.

sequence get_pin pin

Get value of <pin>. Supported pins is cable specific.

sequence set_pin pin value

Set value of <pin> to <value>. Supported pins is cable specific.

sequence atomic enable

Set or clear atomic sequences. This is useful to creating sequences that are guaranteed to run with precise timing or fail. Atomic sequences should be as short as possible to minimize the risk of failure.

sequence run [options]
Run JTAG operations in sequence for the currently selected jtag target. This command will return the result from shift commands using -capture option and from get_pin commands. Available options:
  • -binary Format return value(s) as binary. The first bit shifted out is the least significant bit in the first byte returned.
  • -integer Format return values(s) as integer. The first bit shifted out is the least significant bit of the integer.
  • -bits Format return value(s) as binary text string. The first bit shifted out is the first character in the string.
  • -hex Format return value(s) as hexadecimal text string. The first bit shifted out is the least significant bit of the first byte of the in the string.
  • -single Combine all return values as a single piece of data. Without this option the return value is a list with one entry for every shift with -capture and every get_pin.
sequence clear

Remove all commands from sequence.

sequence delete

Delete sequence.

Returns

Jtag sequence object.

Example(s)

set seqname [jtag sequence] $seqname state RESET $seqname drshift -capture -tdi 0 256 set result [$seqname run] $seqname delete

jtag device_properties

Get/set device properties.

Syntax

jtag device_properties idcode

Get JTAG device properties associated with <idcode>.

jtag device_properties key value ...

Set JTAG device properties.

Returns

Jtag device properties for the given idcode, or nothing, if the idcode is unknown.

Example(s)

jtag device_properties 0x4ba00477

Return Tcl dict containing device properties for idcode 0x4ba00477.

jtag device_properties {idcode 0x4ba00477 mask 0xffffffff name dap irlen 4}

Set device properties for idcode 0x4ba00477.

jtag lock

Lock JTAG scan chain.

Syntax

jtag lock [timeout]

Lock JTAG scan chain containing current JTAG target. DESCRIPTION Wait for scan chain lock to be available and then lock it. If <timeout> is specified the wait time is limited to <timeout> milliseconds. The JTAG lock prevents other clients from performing any JTAG shifts or state changes on the scan chain. Other scan chains can be used in parallel. The jtag run_sequence command will ensure that all commands in the sequence are performed in order so the use of jtag lock is only needed when multiple jtag run_sequence commands needs to be done without interruption.

Note(s)

  • A client should avoid locking more than one scan chain since this can cause dead-lock.

Returns

Nothing.

jtag unlock

Unlock JTAG scan chain.

Syntax

jtag unlock 

Unlock JTAG scan chain containing current JTAG target.

Returns

Nothing.

jtag claim

Claim JTAG device.

Syntax

jtag claim <mask>

Set claim mask for current JTAG device. DESCRIPTION This command will attept to set the claim mask for the current JTAG device. If any set bits in <mask> are already set in the

claim mask then this command will return error "already claimed".

The claim mask allow clients to negotiate control over JTAG devices. This is different from jtag lock in that 1) it is specific to a device in the scan chain, and 2) any clients can perform JTAG operations while the claim is in effect.

Note(s)

  • Currently claim is used to disable the hw_server debugger from controlling microprocessors on ARM DAP devices and FPGA devices containing Microblaze processors.

Returns

Nothing.

jtag disclaim

Disclaim JTAG device.

Syntax

jtag disclaim <mask>

Clear claim mask for current JTAG device.

Returns

Nothing.

jtag frequency

Get/set JTAG frequency.

Syntax

jtag frequency 

Get JTAG clock frequency for current scan chain.

jtag frequency -list

Get list of supported JTAG clock frequencies for current scan chain.

jtag frequency <frequency>

Set JTAG clock frequency for current scan chain. This frequency is persistent as long as the hw_server is running, and is reset to the default value when a new hw_server is started.

Returns

Current Jtag frequency, if no arguments are specified, or if Jtag frequency is successfully set. Supported Jtag frequencies, if -list option is used. Error string, if invalid frequency is specified or frequency cannot be set.

jtag skew

Get/set JTAG skew.

Syntax

jtag skew 

Get JTAG clock skew for current scan chain.

jtag skew <clock-skew>

Set JTAG clock skew for current scan chain.

Note(s)

  • Clock skew property is not supported by some Jtag cables.

Returns

Current Jtag clock skew, if no arguments are specified, or if Jtag skew is successfully set. Error string, if invalid skew is specified or skew cannot be set.

jtag servers

List, open or close JTAG servers.

Syntax

jtag servers [options]

List, open, and close JTAG servers. JTAG servers are use to implement support for different types of JTAG cables. An open JTAG server will enumberate or connect to available JTAG ports.

Options

Option Description
-list List opened servers. This is the default if no other option is given.
-format List format of supported server strings.
-open <server> Specifies server to open.
-close <server> Specifies server to close.

Returns

Depends on the options specified

<none>, -list: List of open Jtag servers.

-format: List of supported Jtag servers.

-close: Nothing if the server is closed, or an error string, if invalid server is specified.

Example(s)

jtag servers

List opened servers and number of associated ports.

jtag servers -open xilinx-xvc:localhost:10200

Connect to XVC server on host localhost port 10200

jtag servers -close xilinx-xvc:localhost:10200

Close XVC server for host localhost port 10200