Flash LPC2138 with Olimex JTAG.

I have an ARM-USB-OCD from Olimex. I’ve configured eclipse+OpenOCD to use with LPC2138 controller, but i still use ISP and FlashMagic utility to program my chip.

I want to flash my controller using JTAG from Olimex. Is it possible? Where can I see solution?

Thanks.

I’ve used this tutorial to configure my debugger http://www.siwawi.arubi.uni-kl.de/avr_p … index.html

I’ve an error while programming lpc2138.

Error: flash.c:103 flash_driver_write(): error writing to flash at address 0x00000000 at offset 0x000000

00 (-902).

Can anyone help?

My config:

#
# Flash LPC2138 memory using openocd 
# and a FTDI FT2232-based JTAG-interface
#
# created by Martin Thomas 
# based on information from Dominic Rath
#

#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 10
jtag_nsrst_delay 100
jtag_ntrst_delay 100

#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
#jtag_device 5 0x1 0x1 0x1e

#target configuration
daemon_startup reset

#target  
#target arm7tdmi    
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
run_and_halt_time 0 30

# flash-options LPC2138
target_script 0 reset lpc2138_flash.script
working_area 0 0x40000000 0x4000 nobackup
# LPC2138 @ 12MHz / 0x7D000 from 500*1024 (not 512!)
## up to version SVN188: 
#flash bank lpc2000 0x0 0x7D000 0 0 lpc2000_v2 0 12000 calc_checksum
## from Version SVN189: 
#flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 12000 calc_checksum
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

And script:

arm7_9 dcc_downloads enable
wait_halt
sleep 10
poll
flash probe 0


# erase first bank only:
#flash erase 0 0 0
# erase all banks:
#flash erase 0 0 26
# if flash erase is not longer available in your OpenOCD-version use
# flash erase_sector

#flash write 0 main.elf 0x0
flash write_image erase main.elf 0
# flash write is deprecated and my not be available in your OpenOCD-version, update to: 
# flash write_binary 0 main.bin 0x0
# flash write_binary is deprecated and my not be available in your OpenOCD-version, update to:
# flash write_bank 0 main.bin 0x00
# also check flash write_image which can be uses together with flash auto_erase on
reset run
sleep 10
shutdown

And a full log:

Open On-Chip Debugger (2008-06-19 19:00) svn: 717
URL: http://svn.berlios.de/svnroot/repos/openocd/trunk
Info:    options.c:50 configuration_output_handler(): jtag_speed: 10, 10
Info:    options.c:50 configuration_output_handler(): Open On-Chip Debugger (2008-06-19 19:00) svn: 717
Info:    jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f
0, Version: 0x4)
Info:    jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f
0, Version: 0x4)
Info:    target.c:237 target_init_handler(): executing reset script 'lpc2138_flash.script'
Info:    options.c:50 configuration_output_handler(): dcc downloads are enabled
User:    target.c:957 target_arch_state(): target state: halted
User:    armv4_5.c:307 armv4_5_arch_state(): target halted in Thumb state due to debug request, current mo
de: System
cpsr: 0x800000ff pc: 0x00000182
Info:    options.c:50 configuration_output_handler(): flash 'lpc2000' found at 0x00000000
Info:    options.c:50 configuration_output_handler(): auto erase enabled
Info:    flash.c:1019 flash_write(): Padding image section 0 with 0 bytes
Warning: lpc2000.c:611 lpc2000_write(): lpc2000 returned 9
Error:   flash.c:103 flash_driver_write(): error writing to flash at address 0x00000000 at offset 0x000000
00 (-902)
Info:    jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f
0, Version: 0x4)
Warning: arm7_9_common.c:743 arm7_9_poll(): DBGACK set, but the target did not end up in the halted stated
 1
User:    target.c:436 target_process_reset(): Timed out waiting for halt after reset