Is my JTAG connection right? (use usbprog USB JTAG adapter)

Hi,

I assembled a USB JTAG adapter for OpenOCD named usbprog,

according to this site:

http://www.embedded-projects.net/index.php?page_id=177

and connected it to my AT91SAM7S32 mini development board.

Here is the JTAG connection:

ATMEGA32L(5V)        <---->         AT91SAM7S32 DEV BOARD(3.3V)
-----------------------------------------------------------------------------
PB5(MOSI)   --5V to 3.3V level converter-->    TDI
PB0                  ---->                     TMS
PB7(SCK)            ---->                      TCK
PB6(MISO)            <----                     TDO
PD0                  ---->                     SRST(connect to NRST of AT91SAM7S32)

Is this connection right? Because when I power up the AT91SAM7S32 development board and connect it

to usbprog(now as openocd debuger), then run “openocd” command, the following message will occur:

Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
usb_set_debug: Setting debugging level to 10 (on)
usb_os_init: Found USB VFS at /proc/bus/usb
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 016 on 003
skipping descriptor 0x0
skipped 1 class/vendor specific endpoint descriptors
Descriptor data still left
usb_os_find_devices: Found 002 on 003
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 001 on 002
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
Info:    usbprog.c:222 usbprog_init(): USB JTAG Interface ready!
Error:   jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAG chain (15) doesn't match configuration (1)
Error:   jtag.c:1302 jtag_examine_chain(): check the config file and ensure proper JTAG communication (connections, speed, ...)
Error:   jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway...
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x3f
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x3f
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x3f
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x22
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x3f
Error:   jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x3f
Error:   jtag.c:1448 jtag_init(): Could not validate JTAG chain, exit

And about this line: “…number of discovered devices in JTAG chain (15) doesn’t match configuration (1)”,

the number in brace(… JTAG chain (xx)…) varied every time.

Here is my openocd.cfg file:

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface usbprog
jtag_speed 2

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config srst_only

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup reset
target arm7tdmi little run_and_init 0 arm7tdmi
run_and_halt_time 0 30

#flash configuration
#at91sam7 options
target_script 0 reset openocd_at91sam7s_flash.script
working_area 0 0x00200000 0x4000 nobackup
flash bank at91sam7 0 0 0 0 0

I do not konw whether:

1)my JTAG connection is wrong?

2)the config file of openocd have some problem?

3)there are many potential problem can cause this error message?

Thank you.

Best Regards,

S.G.

How stupid I am!

My JTAG connection was wrong, the following is correct:

ATMEGA32L(5V)        <---->         AT91SAM7S32 DEV BOARD(3.3V)
-----------------------------------------------------------------------------
PB6(MISO)   --5V to 3.3V level converter-->    TDI
PB0                  ---->                     TMS
PB7(SCK)            ---->                      TCK
PB5(MOSI)            <----                     TDO
PD0                  ---->                     SRST(connect to NRST of AT91SAM7S32)