Did I toast my LPC2148?

I tried programming a hex file into my board but am now getting flash program errors.

> halt
requesting target halt...
> Target 0 halted
target halted in Thumb state due to debug request, current mode: System
cpsr: 0xa00000df pc: 0x00001434
> flash write_image U:\Devel\ARM\LPC2148\USB\hid\examples\serial.hex
failed writing image U:\Devel\ARM\LPC2148\USB\hid\examples\serial.hex: flash program error
wrote 0 byte from file U:\Devel\ARM\LPC2148\USB\hid\examples\serial.hex in 0s 546875us (0.000000 kb/s)

I have tried several hex files with the same results.

Now I only get the red LED on, instead of red, yellow and green LEDs all on when I plug the USB cable into it.

Did I toast my header board?

8-Dale

What program are you using to flash the chip? Are you using a COM port or JTAG (or something else)?

brennen:
What program are you using to flash the chip? Are you using a COM port or JTAG (or something else)?

I am using OpenOCD with JTAG.

8-Dale

You could always try loading the image using the LPC2000 flash utility over a serial port (if you have the supporting hardware on your board). I don’t really use OpenOCD, but there are a lot of people on here that do. You could also try the OpenOCD forum if you don’t get response here.

brennen:
You could always try loading the image using the LPC2000 flash utility over a serial port (if you have the supporting hardware on your board).

I don't have the serial port wired up to my board at present, which is why I wanted to program using JTAG. I need to get a level shifter like the one SFE sells.

8-Dale

Make sure that the flash sectors you are writing to are unprotected and erased.

Also run openocd at debug level 3 to get more information about how the write fails.

You can give the command

debug_level 3

just before the flash write_image command, or start openocd with a -d 3 flag.

regards

Magnus

mlu:
Make sure that the flash sectors you are writing to are unprotected and erased.

OK, I did some more poking around and am not sure I have the flash banks setup properly for OpenOCD.

Here is some info I got:

> debug_level 3
> flash banks
#0: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
#1: cfi at 0x80000000, size 0x00400000, buswidth 2, chipwidth 2
> flash info 0
#0: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x2000kB) erase state unknown, protected
        #1: 0x00002000 (0x2000kB) erase state unknown, protected
        #2: 0x00004000 (0x2000kB) erase state unknown, protected
        #3: 0x00006000 (0x2000kB) erase state unknown, protected
        #4: 0x00008000 (0x2000kB) erase state unknown, protected
        #5: 0x0000a000 (0x2000kB) erase state unknown, protected
        #6: 0x0000c000 (0x2000kB) erase state unknown, protected
        #7: 0x0000e000 (0x2000kB) erase state unknown, protected
        #8: 0x00010000 (0x10000kB) erase state unknown, protected
        #9: 0x00020000 (0x10000kB) erase state unknown, protected
        #10: 0x00030000 (0x2000kB) erase state unknown, protected
        #11: 0x00032000 (0x2000kB) erase state unknown, protected
        #12: 0x00034000 (0x2000kB) erase state unknown, protected
        #13: 0x00036000 (0x2000kB) erase state unknown, protected
        #14: 0x00038000 (0x2000kB) erase state unknown, protected
        #15: 0x0003a000 (0x2000kB) erase state unknown, protected
        #16: 0x0003c000 (0x2000kB) erase state unknown, protected
        #17: 0x0003e000 (0x2000kB) erase state unknown, protected
lpc2000 flash driver variant: 1, clk: 14765
> flash info 1
#1: cfi at 0x80000000, size 0x00400000, buswidth 2, chipwidth 2

cfi information:

mfr: 0x0000, id:0x0000
qry: '', pri_id: 0x0000, pri_addr: 0x0000, alt_id: 0x0000, alt_addr: 0x0000
Vcc min: 0.0, Vcc max: 0.0, Vpp min: 0.0, Vpp max: 0.0
typ. word write timeout: 1, typ. buf write timeout: 1, typ. block erase timeout: 1, typ. chip erase timeout: 1
max. word write timeout: 1, max. buf write timeout: 1, max. block erase timeout: 1, max. chip erase timeout: 1
size: 0x1, interface desc: 0, max buffer write size: 0

> flash protect 0 0 17 off
cleared protection for sectors 0 through 17 on flash bank 0
> flash erase 0 0 17
erased sectors 0 through 17 on flash bank 0 in 0s 609375us
> flash info 0
#0: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x2000kB) erase state unknown, protected
        #1: 0x00002000 (0x2000kB) erase state unknown, protected
        #2: 0x00004000 (0x2000kB) erase state unknown, protected
        #3: 0x00006000 (0x2000kB) erase state unknown, protected
        #4: 0x00008000 (0x2000kB) erase state unknown, protected
        #5: 0x0000a000 (0x2000kB) erase state unknown, protected
        #6: 0x0000c000 (0x2000kB) erase state unknown, protected
        #7: 0x0000e000 (0x2000kB) erase state unknown, protected
        #8: 0x00010000 (0x10000kB) erase state unknown, protected
        #9: 0x00020000 (0x10000kB) erase state unknown, protected
        #10: 0x00030000 (0x2000kB) erase state unknown, protected
        #11: 0x00032000 (0x2000kB) erase state unknown, protected
        #12: 0x00034000 (0x2000kB) erase state unknown, protected
        #13: 0x00036000 (0x2000kB) erase state unknown, protected
        #14: 0x00038000 (0x2000kB) erase state unknown, protected
        #15: 0x0003a000 (0x2000kB) erase state unknown, protected
        #16: 0x0003c000 (0x2000kB) erase state unknown, protected
        #17: 0x0003e000 (0x2000kB) erase state unknown, protected
lpc2000 flash driver variant: 1, clk: 14765
> flash write_image U:\Devel\ARM\LPC2148\USB\hid\examples\custom.hex 0 hex
failed writing image U:\Devel\ARM\LPC2148\USB\hid\examples\custom.hex: flash program error
wrote 0 byte from file U:\Devel\ARM\LPC2148\USB\hid\examples\custom.hex in 0s 390625us (0.000000 kb/s)
>

I have the [LPC2148 Header Board. What am I doing wrong? I must go reread my LPC2148 datasheet.

8-Dale](http://www.sparkfun.com/commerce/product_info.php?products_id=676)

Can you copy ur flash programming openocd.cfg file and script file.

I am also using LPC2148 header board and i can erase and program different application using OLIMEX ARM-USB-OCD JTAG and by using OpenOCD debugger.

Karun

karunanithy:
Can you copy ur flash programming openocd.cfg file and script file.

OK, here it is. I have blanked out the port numbers.
#daemon configuration
telnet_port XXXX
gdb_port YYYY

#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG TINY A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0004
jtag_speed 3

#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 <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

working_area 0 0x40000000 0x40000 nobackup

#flash configuration
#flash bank lpc2000 <base> <size> 0 0 <target#> <variant>
flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
flash bank cfi 0x80000000 0x400000 2 2 0

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

karunanithy:
I am also using LPC2148 header board and i can erase and program different application using OLIMEX ARM-USB-OCD JTAG and by using OpenOCD debugger.

This is good news. Now maybe I can figure out what is wrong, or if I have bricked my board.

8-Dale

Hai, i think you missed to call the flash script file

working_area 0 0x40000000 0x40000 nobackup

#-------------------Call here ur script file-----------

target_script 0 reset .\prj\openocd_flash.script

#flash configuration

#flash bank lpc2000 0 0 <target#>

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum

flash bank cfi 0x80000000 0x400000 2 2 0

karunanithy:
Hai, i think you missed to call the flash script file

working_area 0 0x40000000 0x40000 nobackup

#-------------------Call here ur script file-----------

target_script 0 reset .\prj\openocd_flash.script

Hmmmmm, I am definitely not understanding something here. I do not see any scripts like that in my OpenOCD installation folder. I will have to dig deeper into OpenOCD and see if I can find more info on this script and what I should have in it.

I just copied a configuration file for the LPC2138 to a new name and have been using that.

8-Dale

Here i copied my script file. You can just replace the main.bin with your one. Also you can find the sample file inthe follwoing link

http://openfacts.berlios.de/index-en.ph … p+Debugger

The following command wills be executed on

reset (because of run_and_init in the config-file)

- wait for target halt

- erase memory

- flash content of file main.bin into target-memory

- shutdown openocd

created by Martin Thomas

http://www.siwawi.arubi.uni-kl.de/avr_p … m_projects

based on information from Dominic Rath

arm7_9 dcc_downloads enable

wait_halt

sleep 10

poll

flash probe 0

#flash erase 0 0 0

erase all banks:

flash erase 0 0 16

flash write 0 test.bin 0x0

reset run

sleep 10

shutdown

karunanithy:
Here i copied my script file. You can just replace the main.bin with your one.

Does this script get executed each time the target is reset? Why do you erase flash and write test.bin before shutting OpenOCD down?

I still don’t get any green or yellow lights on my LPC2148 header board. I am starting to think I bricked it and it is worthless now.

8-Dale

This script file is used to burn your binary file into flash when you run your openocd flash programming batch file.

I am still trying to find out if I have messed up my LPC2148 Header Board or not. I can only get the red power LED on, with no green or yellow LED on. I can not program it using JTAG.

Is it worthless now?

8-Dale