Flash-programming a LPC-E2294 board

Hello friends,

I just got a Olimex LPC-E2294 board with a Parallel Port JTAG to start learning ARM7 programming.

After a research I decided to work with Openocd, YAGARTO and Eclipse. Firstly, modifying an example, I debugged a blink lcd backlight example.

Now, my problem is: How to program the internal flash with this example?

The most useful reference that I’ve found was http://www.siwawi.arubi.uni-kl.de/avr_p … lpc2000int.

But still there is a problem because nothing happens when I execute openocd_go_flash.cmd. Only the info message is displayed and the application start to listen 4444 and 3333 TCP ports.

I think that the flash script is ignored because if I change the file name there is no error messages.

Follow the slightly modified files from Martin Thomas web site.

openocd_lpc2294_flash_wiggler.cfg

telnet_port 4444

gdb_port 3333

#interface

interface parport

parport_port 0x378

parport_cable wiggler

jtag_speed 0

#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

#target arm7tdmi

target arm7tdmi little run_and_init 0 arm7tdmi-s_r4

run_and_halt_time 0 30

flash-options modified to LPC2294

target_script 0 reset openocd_lpc2294_flash.script

working_area 0 0x40000000 0x4000 nobackup

LPC2138 @ 12MHz / 0x7D000 from 500*1024 (not 512!)

#flash bank lpc2000 0x0 0x7D000 0 0 lpc2000_v2 0 12000 calc_checksum # used to lpc2138. Below to lpc2294

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

And the (probably ignored) flash script:

openocd_lpc2294_flash.script

arm7_9 dcc_downloads enable

wait_halt

sleep 10

poll

flash probe 0

flash erase 0 0 0

flash write 0 main.bin 0x0

reset run

sleep 10

shutdown

Anybody can point me the error? Where I’m making a mistake?

Thanks in advance!

News about this issue.

I was using 2007re141 version of Openocd.

Then, I decided to install 2007re204 and the result changed.

With the same files, after execute the command I got this message from openocd:

Error: lpc2000.c:384 lpc2000_flash_bank_command(): unknown LPC2000 variant

Error: flash.c:180 handle_flash_bank_command(): ‘lpc2000’ driver rejected flash bank at 0x00000000

Error: jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAG chain (578) doesn’t match configuration (1)

Error: jtag.c:1302 jtag_examine_chain(): check the config file and ensure proper JTAG communication (connections, speed, …)

Error: jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway…

Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too

Well, it’s diferente but the script file still is not read (probably). And the “flash bank” is ok according to openocd web site.

I’m still with no ideas. :frowning:

All I wanna do is program the flash of lpc2294 with JTAG wiggler.

Problem solved later add after “jtag_device 4 0x1 0xf 0xe” line in CFG file this two lines:

jtag_nsrst_delay 333

jtag_ntrst_delay 333

Actually, the insertion of each on separated make the test succesfull. But, I will keep both following the example which I used.

Now, the result is:

Info: target.c:227 target_init_handler(): executing reset script ‘openocd_lpc2294_flash.script’

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): target state: halted

Info: configuration.c:50 configuration_output_handler(): target halted in ARM state due to debug request, current mode: Supervisor

Info: configuration.c:50 configuration_output_handler(): cpsr: 0x800000d3 pc: 0x40000004

Info: configuration.c:50 configuration_output_handler(): flash ‘lpc2000’ found at 0x00000000

Info: configuration.c:50 configuration_output_handler(): erased sectors 0 through 0 on flash bank 0 in 0s 468750us

Info: configuration.c:50 configuration_output_handler(): wrote file main.bin to flash bank 0 at offset 0x00000000 in 0s 203125us

Yes, much better, I know! :wink:

Thanks all. I hope this notes help somebody someday.

:shock: I’ve got a very similar problem with this controller.

I’m using Amontec JTAG Key instead of wiggler but get the same error messages like eduardogarcia :

Error: lpc2000.c:384 lpc2000_flash_bank_command(): unknown LPC2000 variant
Error: flash.c:180 handle_flash_bank_command(): ‘lpc2000’ driver rejected flash bank at 0x00000000

Theres no way to send some ‘flash’ commands via telnet. I always got the message

> flash banks
Command banks not found

The entries in cfg script you described didn’t change anything

jtag_nsrst_delay 333

jtag_ntrst_delay 333

Here’s the cfg-file :

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

#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_nsrst_delay 500
jtag_ntrst_delay 500 

#target configuration
daemon_startup reset

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

#working_area
working_area 0 0x40000000 0x40000 nobackup

#flash configuration flash bank lpc2000 0 0
flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 10000  calc_checksum
#flash bank cfi 0x80000000 0x400000 2 2 0


#target_script specifies the flash programming script file
target_script 0 reset lpc2xxxflash.script

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

Does anyone have a working version for LPC2294 and AMONTEG JTAG-Key ?

Falcon,

I had a very similar problem, even though I used an Olimex JTAG Tiny. The problem is definitely in the config file. I had to try many different things. I use Windows Vista, Olimex LPC-E2214-RB board, WinARM, openocd, Eclipse IDE.

Use the actual frequency of the crystal instead of 10000. In my case it’s 14.7456 MHz (14746, rounded). Also, try moving the target_script line to above working area and flash bank. Good luck.

Config:

telnet_port 4444

gdb_port 3333

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0004

jtag_speed 20

reset_config trst_and_srst separate

jtag_device 4 0x1 0xf 0xe

jtag_nsrst_delay 333

jtag_ntrst_delay 333

daemon_startup reset

target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4

run_and_halt_time 0 30

target_script 0 reset oocd_flash2294.script

working_area 0 0x40000000 0x4000 nobackup

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

Cheers and don’t give up,

Gil DePaula