# Problem halting and reprogramming LPC-2148

**URL:** <https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875>\
**Category:** MicroMod\
**Tags:** arm-lpc\
**Created:** [July 14, 2009, 2:50pm UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875 "2009-07-14T14:50:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasocd](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@thomasocd](https://community.sparkfun.com/u/thomasocd)\
**Post date:** [July 14, 2009, 2:50pm UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875/1 "2009-07-14T14:50:10Z")

</div>

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:

```auto
#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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![hsutherl](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@hsutherl](https://community.sparkfun.com/u/hsutherl)\
**Post date:** [July 17, 2009, 12:15am UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875/2 "2009-07-17T00:15:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thomasocd](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@thomasocd](https://community.sparkfun.com/u/thomasocd)\
**Post date:** [July 17, 2009, 6:58am UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875/3 "2009-07-17T06:58:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hsutherl](https://avatars.discourse-cdn.com/v4/letter/h/ee7513/32.png) [@hsutherl](https://community.sparkfun.com/u/hsutherl)\
**Post date:** [July 17, 2009, 10:49pm UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875/4 "2009-07-17T22:49:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![thomasocd](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@thomasocd](https://community.sparkfun.com/u/thomasocd)\
**Post date:** [July 20, 2009, 2:46pm UTC](https://community.sparkfun.com/t/problem-halting-and-reprogramming-lpc-2148/11875/5 "2009-07-20T14:46:51Z")

</div>

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:

```auto
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

```
