Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

OpenOCD Troubleshooting: JTAG Tap Unexpected

From eLinux.org
Jump to: navigation, search


You run OpenOCD with a board with a JTAG interface and see an error like this:

Info : JTAG tap: s3c2410.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Warn : JTAG tap: s3c2410.cpu       UNEXPECTED: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Error: JTAG tap: s3c2410.cpu  expected 1 of 1: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)
Error: Trying to use configured scan chain anyway...
Warn : Bypassing JTAG setup events due to errors

When OpenOCD tries to initialize JTAG, it tries to detect the test access port (TAP) ID of each device in the JTAG chain. The tap ID is set by the manufacturer. OpenOCD's config files contain expected tap values for each board. You may encounter this error either because OpenOCD has failed to read the tap ID correctly, or because the expected value in a config file is incorrect or outdated.

Look at the "tap/device found" and "UNEXPECTED" values in OpenOCD's output. If you see a value of 0x00000000 or 0x000000ff, OpenOCD has failed to read the tap ID. If you see any other value, some other error has occurred, and the error is most likely an incorrect value in a config file.


Info : JTAG tap: omap3530.jrc tap/device found: 0x000000ff (mfg: 0x07f, part: 0x0000, ver: 0x0)
Warn : JTAG tap: omap3530.jrc       UNEXPECTED: 0x000000ff (mfg: 0x07f, part: 0x0000, ver: 0x0)
Error: JTAG tap: omap3530.jrc  expected 1 of 1: 0x0b7ae02f (mfg: 0x017, part: 0xb7ae, ver: 0x0)
Error: Trying to use configured scan chain anyway...
Error: couldn't read enough bytes from FT2232 device (0 < 2)

In this example, OpenOCD has found an ID of 0x000000ff, an invalid tap ID. For this output you would refer to the Failed to Read Tap ID section below. For the example at the top of the page, OpenOCD has detected an ID of 0x0032409d, and you would start with the Incorrect Value in Config File section.





Failed to Read Tap ID

If you see a tap ID found with a value of 0x00000000 or 0x000000ff, OpenOCD has failed to read the tap ID.


Step 1: Check JTAG Connection

In particular, make sure the JTAG ribbon cable is secured, and is not connected backwards. A loose or misaligned connection will cause the tap ID to read incorrectly. WARNING: a misaligned connection may damage the pins on the JTAG header! If you are unsure whether the cable is connected backwards, consult the manual before testing.


Step 2: Check for Updated Config Files

The config files distributed with your version of OpenOCD may not reflect recent revisions made by the manufacturer. TinCanTools maintains a page with updated config files for use with guides on this wiki. Check for config files on the OpenOCD Config Files page.

If you are using an older version of OpenOCD (0.4.0 or earlier), check for updated config files in version 0.5.0. Direct link to OpenOCD 0.5.0: http://prdownload.berlios.de/openocd/openocd-0.5.0.zip


Note for Beagleboard/Beagleboard XM Users

The Beagleboard and Beagleboard XM have an issue that may prevent the JTAG chain from initializing correctly. You may be able to correct this issue by running the init and reset init commands on OpenOCD startup.

With the Flyswatter2 and the Beagleboard XM, run OpenOCD as follows:

openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard_xm.cfg -c init -c "reset init"

With the Beagleboard:

openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard.cfg -c init -c "reset init"

The Beagleboard sometimes has additional issues. For more information, see Beagleboard Troubleshooting: JTAG Tap Unexpected 0x000000ff.





Incorrect Value in Config File

If OpenOCD finds an unexpected tap ID other than 0 (0x00000000) or 0x000000ff the issue is most likely an incorrect expected value in a config file. The example at the beginning of this article occurs when running OpenOCD with the Hammer and the hammer.cfg file provided with OpenOCD 0.4.0:

Info : JTAG tap: s3c2410.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Warn : JTAG tap: s3c2410.cpu       UNEXPECTED: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Error: JTAG tap: s3c2410.cpu  expected 1 of 1: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)

OpenOCD has found a valid tap ID - 0x0032409d - but it doesn't match the expected value - 0xffffffff. For OpenOCD to initialize JTAG correctly you will need to change the expected ID in the config file to match the actual ID.


Step 1: Check for Updated Config Files

The config files distributed with your version of OpenOCD may not reflect recent revisions made by the manufacturer. TinCanTools maintains a page with updated config files for use with guides on this wiki. Check for config files on the OpenOCD Config Files page.

If you are using an older version of OpenOCD (0.4.0 or earlier), check for updated config files in version 0.5.0. Direct link to OpenOCD 0.5.0: http://prdownload.berlios.de/openocd/openocd-0.5.0.zip

If the no new config file is available or the new file fails to correct the issue, proceed to Step 2.


Step 2: Note the Unexpected Value

The first two lines above list the tap ID detected by OpenOCD. Take note of the 32-bit hexadecimal value (the one with 0x followed by 8 digits) in the first two lines, and the expected value in the third line.

Info : JTAG tap: s3c2410.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Warn : JTAG tap: s3c2410.cpu       UNEXPECTED: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)
Error: JTAG tap: s3c2410.cpu  expected 1 of 1: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)

The found tap ID is 0x0032409d and the expected tap ID is 0xffffffff. You will need these values in step 3.


Step 3: Find the Config File for your Board

Find the config file for your board. This file usually has the same name as your board and is located in a folder called board/. For example, if you were using OpenOCD with the Flyswatter and the Hammer, and you started OpenOCD like this:

openocd -s /home/myusername/openocd/tcl -f interface/flyswatter.cfg -f board/hammer.cfg

The config file for your board is hammer.cfg, and you can find it in /home/myusername/openocd/tcl/board. If you aren't setting OpenOCD's search directory with the -s flag you may have to look in multiple places to find the board config file OpenOCD actually uses. See OpenOCD Config File Paths.


Setting CPUTAPID for the Hammer in WordPad

Step 4: Edit the Config File

Open the config file in a text editor. Find a line that calls the config file for your processor. It should look like this:

source [find target/name_of_the_target.cfg]

For the Hammer, the target file is samsung_s3c2410.cfg, so this line reads:

source [find target/samsung_s3c2410.cfg]

Immediately above this line, add a new line that reads:

set CPUTAPID 0x[TapID]

...where 0x[TapID is value found in Step 1. (Don't actually type "0xTapID." Type the hexadecimal value you found above.) For the Hammer, the file should now read like this:

# Target Configuration for the TinCanTools S3C2410 Based Hammer Module
# http://www.tincantools.com

set CPUTAPID 0x0032409d
source [find target/samsung_s3c2410.cfg]

$_TARGETNAME configure -event reset-init {
      ....

Save the file and close it.


Step 5: Verify that OpenOCD finds the Tap Correctly

Run OpenOCD again. It should print a line indicating that it has found the tap correctly:

Info : JTAG tap: s3c2410.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)