LPC23xx Flash writing

Has any one had any luck in writing to the flash of the LPC23xx chips with the JTAGKey?

(i’m actually using the LPC2366 chip w/12Mhz external clock)

I’m using MacOS X on Intel now (fast!) and I had thought I was writing the images succesfully to flash (also very fast!).

here’s my openocd.cfg:

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 15

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

#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 attach
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 0x4000 nobackup

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

and here’s the commands I use to do the flashing with:

halt
flash protect 0 0 14 off
flash erase 0 0 14
flash write 0 <binFile> 0
flash protect 0 0 14 on
reset run

(I actually use an expect script to do this)

I get no errors from either OpenOCD or the above command. So it seens that i worked fine, but did not.

Guess I’m stuck in using the lpc21isp for a while :frowning:

luis…

ps: oh ya, i’m at head of tree

with a tiny amount of time on my hands, i dug further:

when i use OpenOCD write to the flash and used the debugger to dump @0x0000, this is what I get:

0x0     <_vectors>:     0xe59f4018      0xe59f5010      0xe5946000      0xe0056006
0x10 <_vectors+16>:     0xe5846000      0xe51ff004      0x7fffe040      0xffffbfff
0x20  <Undef_Addr>:     0x3fff8000      0x00000000      0x00000000      0x00000000
0x30    <FIQ_Addr>:     0x00000000      0x00000000      0x00000000      0x00000000
0x40 <FIQ_Addr+16>:     0xffffffff      0xffffffff      0xffffffff      0xffffffff

when i use lpc21isp to do the write, this what i see:

0x0     <_vectors>:     0xea00007e      0xe59ff014      0xe59ff014      0xe59ff014
0x10 <_vectors+16>:     0xe59ff014      0xb4c05e06      0xe51ff120      0xe59ff00c
0x20  <Undef_Addr>:     0x00001298      0x00000488      0x000012ac      0x0000138c
0x30    <FIQ_Addr>:     0x00001474      0xffffffff      0xffffffff      0xffffffff

doing a od -t x4 file.bin, this is the contents:

0000000          ea00007e        e59ff014        e59ff014        e59ff014
0000020          e59ff014        e1a00000        e51ff120        e59ff00c
0000040          00001298        00000488        000012ac        0000138c
0000060          00001474        ffffffff        ffffffff        ffffffff

very similar to the file.hex file:

:100000007E0000EA14F09FE514F09FE514F09FE5F0
:1000100014F09FE50000A0E120F11FE50CF09FE542
:100020009812000088040000AC1200008C1300003D
:1000300074140000FFFFFFFFFFFFFFFFFFFFFFFF44

i do see that build code determines that the system is little endian.

could it be OpenOCD getting confused with my platform when doing the flashing?

as it is debugging seems to work correctly as stepping through the code and it doesn’t burp

(except for the occasional errors like: Error: arm7_9_common.c:1845 arm7_9_read_memory(): JTAG error while reading cpsr then OpenOCD exists.)

Anyone successfully in writing to flash on the LPC23xx chipset?