OpenOCD not discovers devices in the JTAGchain correctly

Hi,

I worked some time with OpenOCD and then I made a break of some weeks. Now I receive these error messages when I start debugger:

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Error: jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAGchain (578) 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…
Info: server.c:67 add_connection(): accepted ‘telnet’ connection from 0

The configuration file is as follows:

#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 5
#use combined on interfaces or targets that can’t set TRST/SRST separately
#reset_config trst_and_srst srst_pulls_trst
reset_config trst_and_srst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
jtag_nsrst_delay 333
jtag_ntrst_delay 333
#target configuration
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30
daemon_startup reset
#target
#target arm7tdmi
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30
working_area 0 0x40000000 0x40000 nobackup
#flash configuration
#flash bank lpc2000 0x0 0x20000 0 0 lpc2000_v2 0 12000 calc_checksum
flash bank lpc2000 0x0 0x20000 0 0 0 lpc2000_v2 12000 calc_checksum

As can be seen, the OpenOCD accepts connection to the telnet, but when I start debug from Eclipse (Yagarto IDE and toolchain) the connection can’t be established.

Can someone help me? Can this be damage in the target PCB? The target have program in the flash and works correctly without debugger.

Thanks in advance!

Marcho

OpenOCD always (almost) accepts telnet connections, even if the JTAG connection is not working.

In your case there is a JTAG problem. It can be the hardware, it can be the cabling, it can be misconfigured jumpers on the board or it can be the jtag device configuration in OpenOCD.

Regards,

Magnus

Thanks Magnus,

The PCB is jumper less. Some time ago (after installing of the OpenOCD 2.04) OpenOCD started giving an error message that the configuration does not match and I saw that it finds in jtag chain IDCODE=0xC (sorry, but now I can’t reproduce it!) and then: “trying to validate configured JTAG chain anyway…”. Then all worked as usual. For a time (after installing of the OpenOCD 2.31) the situation became as I described in the previous post.

I use ARM-JTAG from Olimex. Can it be damaged?

Can you give me any idea?

Regards,

Marcho

you have two target lines:

target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4

you only require one - also the arm7tdmi-s_r4 is not required any more.

target arm7tdmi little run_and_halt 0

I think the lpc needs the following for the trst, srst config.

reset_config trst_and_srst srst_pulls_trst

Are you sure your wiggler interface has a trst connection?

If this still fails, could you provide the debug log, so we can see all the messages?

Cheers

Spen

Hi all!

Hapy New Year!

Hi Spen,

I checked all wires on the PCB related to JTAG and they seem to be ok.

I tried with another Wigler (again from Olimex) and the results was the same.

Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
Error: jtag.c:1442 jtag_init(): trying to validate configured JTAG chain anyway…
Error: embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0x00000000)
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Error: armv4_5.c:186 armv4_5_mode_to_number(): invalid mode value encountered
Error: arm7_9_common.c:1083 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
Error: target.c:1215 handle_target(): couldn’t poll target. It’s due for a reset.
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Info: server.c:67 add_connection(): accepted ‘telnet’ connection from 0
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Info: server.c:67 add_connection(): accepted ‘gdb’ connection from 0
Warning: gdb_server.c:270 gdb_get_packet(): acknowledgment received, but no packet pending
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Info: server.c:362 server_loop(): dropped ‘gdb’ connection
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Info: server.c:67 add_connection(): accepted ‘gdb’ connection from 0
Warning: gdb_server.c:270 gdb_get_packet(): acknowledgment received, but no packet pending
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Info: server.c:362 server_loop(): dropped ‘gdb’ connection
Info: server.c:362 server_loop(): dropped ‘telnet’ connection

I tried also without arm7tdmi-s_r4 in the target - the result was:

Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
Error: jtag.c:1442 jtag_init(): trying to validate configured JTAG chain anyway…
Error: embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0x00000000)
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Info: server.c:67 add_connection(): accepted ‘telnet’ connection from 0
Warning: arm7_9_common.c:753 arm7_9_assert_reset(): srst resets test logic, too
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Info: server.c:67 add_connection(): accepted ‘gdb’ connection from 0
Warning: gdb_server.c:270 gdb_get_packet(): acknowledgment received, but no packet pending
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Info: server.c:345 server_loop(): rejected ‘gdb’ connection, no more connections allowed
Info: server.c:362 server_loop(): dropped ‘gdb’ connection
Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted
Info: server.c:67 add_connection(): accepted ‘gdb’ connection from 0
Warning: gdb_server.c:270 gdb_get_packet(): acknowledgment received, but no packet pending
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Info: server.c:362 server_loop(): dropped ‘gdb’ connectionInfo: server.c:362 server_loop(): dropped ‘telnet’ connection

Now accept gdb connection after manually entered reset from telnet.

Any ideas?

Thank You in asvance!

Best Regards

can you show us the exact config script you are using.

at this point do not attempt to connect with gdb - you have to get the target connection correct first.

Can you enable a debug log, openocd -d3 and post the output.

Cheers

Spen

Hi Spen,

I don’t know how to append a file here, so…

The config script is:

#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 0
#use combined on interfaces or targets that can’t set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#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
#target arm7tdmi
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
#target arm7tdmi little run_and_halt 0
run_and_halt_time 0 30
working_area 0 0x40000000 0x4000 nobackup
#flash configuration
#flash bank lpc2000 0 0 <target#>
flash bank lpc2000 0x0 0x20000 0 0 0 lpc2000_v2 12000 calc_checksum

and the result is:

Debug: jtag.c:1409 jtag_init(): -
Debug: parport.c:403 parport_init(): requesting privileges for parallel port 0x378…
Debug: parport.c:413 parport_init(): …privileges granted
Debug: parport.c:236 parport_reset(): trst: 0, srst: 0
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
Error: jtag.c:1442 jtag_init(): trying to validate configured JTAG chain anyway…
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: openocd.c:114 main(): jtag init complete
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST released
Debug: jtag.c:1197 jtag_reset_callback(): -
Error: embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0x00000000)
Debug: arm7_9_common.c:715 arm7_9_assert_reset(): target->state: unknown
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: SRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: SRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST asserted
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: parport.c:236 parport_reset(): trst: 1, srst: 1
Debug: parport.c:236 parport_reset(): trst: 1, srst: 1
Debug: arm7_9_common.c:781 arm7_9_deassert_reset(): target->state: reset
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: SRST released
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: parport.c:236 parport_reset(): trst: 0, srst: 0
Debug: openocd.c:118 main(): target init complete
Debug: openocd.c:122 main(): flash init complete
Debug: openocd.c:126 main(): NAND init complete
Debug: openocd.c:130 main(): pld init complete
Debug: gdb_server.c:1807 gdb_init(): gdb service for target arm7tdmi at port 3333
Debug: arm7_9_common.c:937 arm7_9_halt(): target->state: reset
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 1
Debug: jtag.c:295 jtag_call_event_callbacks(): jtag event: TRST released
Debug: jtag.c:1197 jtag_reset_callback(): -
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 4
Debug: embeddedice.c:220 embeddedice_read_reg_w_check(): 1

The last 8 lines repeat cyclic.

Best Regards

Marcho

Nothing in your log really matters after:

Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.

Since there is no JTAG communication all the other error events occur because of it.

You may want to try changing

jtag_speed 0

to a higher value, since 0 is for maximum speed. You communication errors could just be because the clock is too fast for your setup. For my normal setup I usually need it at 3 or higher.

–Dave

Hi Dave,

I tested with speeds 3, 5, 6, 7, 8, 12 but the state is the same.

The same I tested on another PCB and the result was the same.

Regards,

Marcho

markoni:
Hi Dave,

I tested with speeds 3, 5, 6, 7, 8, 12 but the state is the same.

The same I tested on another PCB and the result was the same.

Regards,

Marcho

I am sorry that did not help, Marcho. That is one common cause of JTAG communication failure, and I have seen it myself a few times. Your configuration script is very similar to the one that I use with the Olimex wiggler clone, so I can not offer any suggestions there. I suppose that it could be something wrong with the parallel port in your PC, but at this point it may require probing with an oscilloscope to figure out what is wrong?

–Dave

Thanks Dave!

Regards,

Marcho

You could try changing the parallel port mode in the bios.

Some pc use emulated parallel ports, SPP or EPP may be worth a try.

Spen

Hi Spen,

The parallel port is set in the BIOS as ECP+EPP. The other possibilities are Normal and Bidirectional.

Should I change this setting?

Regards,

Marcho

Worth a go, try Normal (SPP) first.

Regards

Spen

Hi Spen,

Sorry, nothing! With Normal and Bidirectional.

One note - in the one target the loaded software uses Power Down mode, but other target is clean.

Any other ideas?

I think that all problems are from openOCD re204 and next, but I am not fully sure. Probably should try with an earlier version?

Regards,

Marcho