# Flash-programming a LPC-E2294 board

**URL:** <https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385>\
**Category:** MicroMod\
**Tags:** arm-lpc\
**Created:** [September 26, 2007, 1:49pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385 "2007-09-26T13:49:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduardogarcia](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@eduardogarcia](https://community.sparkfun.com/u/eduardogarcia)\
**Post date:** [September 26, 2007, 1:49pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385/1 "2007-09-26T13:49:52Z")

</div>

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](http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html#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!

---

<div class="post-metadata">

**Author:** ![eduardogarcia](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@eduardogarcia](https://community.sparkfun.com/u/eduardogarcia)\
**Post date:** [September 26, 2007, 8:23pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385/2 "2007-09-26T20:23:49Z")

</div>

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. ☹

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

---

<div class="post-metadata">

**Author:** ![eduardogarcia](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@eduardogarcia](https://community.sparkfun.com/u/eduardogarcia)\
**Post date:** [September 26, 2007, 8:58pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385/3 "2007-09-26T20:58:22Z")

</div>

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! 😉

Thanks all. I hope this notes help somebody someday.

---

<div class="post-metadata">

**Author:** ![Falcon](https://avatars.discourse-cdn.com/v4/letter/f/49beb7/32.png) [@Falcon](https://community.sparkfun.com/u/Falcon)\
**Post date:** [October 18, 2007, 2:25pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385/4 "2007-10-18T14:25:30Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![gdepaula](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@gdepaula](https://community.sparkfun.com/u/gdepaula)\
**Post date:** [August 1, 2008, 1:35pm UTC](https://community.sparkfun.com/t/flash-programming-a-lpc-e2294-board/5385/5 "2008-08-01T13:35:39Z")

</div>

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
