Problem halting and reprogramming LPC-2148

I have two LPC-2148 boards, two ARM-USB-OCD programmers with JTAG cables and two computers with Eclipse Ganymede and the whole toolchain installed.

None of these combinations work, but they did 8 days ago.

This is my config file (armusbocd.cfg), same as the one shipped with the chain:

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2

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

#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 <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30

#target_script 0 reset oocd_flash2138.script
working_area 0 0x40000000 0x40000 nobackup

#flash configuration
flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v2 12000 calc_checksum

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger

And this is my OpenOCD output:

Open On-Chip Debugger 1.0 (2008-10-04-10:00) svn:exported
$URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $
Info:    options.c:50 configuration_output_handler(): jtag_speed: 2, 2
Info:    options.c:50 configuration_output_handler(): Open On-Chip Debugger 1.0 (2008-10-04-10:00) svn:exported
Info:    jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4)
Info:    jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4)
Error:   armv4_5.h:114 armv4_5_mode_to_number(): invalid mode value encountered
Error:   arm7_9_common.c:1102 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
User:    target.c:436 target_process_reset(): Timed out waiting for halt after reset
Error:   armv4_5.h:114 armv4_5_mode_to_number(): invalid mode value encountered
Error:   arm7_9_common.c:1102 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
Error:   armv4_5.h:114 armv4_5_mode_to_number(): invalid mode value encountered
Error:   arm7_9_common.c:1102 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure

Anyone able to tell me what changed in my setup or what I am doing wrong?

I’m probably wasting your time here Thomas, but… do you have known good code in either of the boards?

The reason I ask is that I recently had a typo (bad address) in a startup.s file that caused my 2148 to be stuck in abort mode after reset. I could not re-flash (or even read memory) with openocd. The only way I was able to fix the problem was to re-flash using the serial port utility.

The actual error messages you posted are completely different than what I saw.

Yes, the software in one of the boards is known to be okay. I did not change my startup.s. I suspect my problem to be a driver problem, but I seem unable to find a way to solve it; none of the drivers or the tools from the toolchain has ever been updated, they have worked fine for over four months, but “out of nothing” it stopped functioning.

Your .cfg file is exactly the same as mine, and those first two lines of output (before the error) are exactly the same as what I see here.

At that point, running openocd-ftd2xx stand-alone, I don’t get any more output from openocd until I open a telnet connection to it. Are the results you show from openocd by itself, or under control of Eclipse / gdb?

I am using eclipse, which loads a series of commands into gdb after executing the openocd script mentioned hereabove. The commands fed to gdb are like this:

target remote localhost:3333
monitor sleep 500
monitor poll
monitor flash probe 0
monitor flash erase_sector 0 0 4
monitor flash write_image main.bin 0x0
monitor reset run
monitor sleep 1000
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file main.out
thbreak main
continue