Problems with Olimex LPC-2378-STK board+ARM-USB-TINY

Finally I decided to move to ARM architectures, and I have bough a Olimex LPC-2378-STK board and a Olimex ARM-USB-TINY emulator. Recently I received both and here started my problems. I have installed the Eclipse + GNUARM + OpenOCD environment included in the CD provided with Olimex, downloaded a test program from [here, modified the OpenOCD configuration file and I have made a lot of tests, but I can’t get the board to work. Every time I try to program the flash I get this message fro OpenOCD:

Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
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
Warning: embeddedice.c:175 embeddedice_build_reg_cache(): EmbeddedICE version 7 detected, EmbeddedICE handling might be broken
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too
Info:    target.c:232 target_init_handler(): executing reset script 'openocd_flash_lpc2378.script'
Info:    configuration.c:50 configuration_output_handler(): requesting target halt...
Warning: arm7_9_common.c:933 arm7_9_halt(): target was already halted
Info:    configuration.c:50 configuration_output_handler(): target already halted
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(): dcc downloads are enabled
Info:    configuration.c:50 configuration_output_handler(): Command probe not found
Info:    configuration.c:50 configuration_output_handler(): Command erase not found
Info:    configuration.c:50 configuration_output_handler(): Command write not found
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too

The “funny” thing is that even when I unplug the ARM-USB-TINY from the USB Bus, I still get the “Unknown LPC Variant” messages:

Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
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:   ft2232.c:1341 ft2232_init_ftd2xx(): unable to open ftdi device: 2

The config files I’m using are these (from Martin Thomas, slightly modified):

openocd_flash_lpc2378_ftdi.cfg

# Martin Thomas 4/2007

#daemon configuration
telnet_port 4444
gdb_port 3333

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

#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_init 0 arm7tdmi-s_r4
run_and_halt_time 0 30

target_script 0 reset openocd_flash_lpc2378.script
working_area 0 0x40002000 0x4000 nobackup
# LPC2378 @ 12MHz / 0x80000 from 512*1024 
flash bank lpc2000 0x0 0x80000 0 0 lpc2000_v2 0 12000 calc_checksum

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


##### TODO #####
# the current configuration at least somehow works with the LPC2378
# on the Olimex-Board. so please ignore the following comments for now
# "Upon power up or any chip reset, the LPC2300 uses the IRC as the clock source.
# Software may later switch to one of the other available clock sources."
# "The nominal IRC frequency is 4 MHz."
# ---> 4000 statt 12000 ?
# oder gar 14768 weil ISP schon irgendwas gemacht hat?
# oder PLL aus und umschalten auf IRC -> schein nicht richtig zu klappen...
# flash bank lpc2000 0x0 0x80000 0 0 lpc2000_v2 0 4000 calc_checksum

openocd_flash_lpc2378.script

# 
# 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
#
#  PRELIMINARY - first test for LPC2378
#
#
# Martin Thomas 
# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
# based on information from Dominic Rath 
#

halt
sleep 20
wait_halt

# ignore my comments - setup works without the following.
# disable PLL and switch to IRC (4 MHz nom.)
# hmm - should not be needed since IRC is default source after Reset...
# any interaction with the ISP startup??
# doesn't work anyway - something missing
# TODO: read manual.
#mww 0xE01FC080 0x00000000   # PLLCON  = 0
#mww 0xE01FC08C 0x000000AA   # PLLFEED = 0xAA
#mww 0xE01FC08C 0x00000055   # PLLFEED = 0x55
#mww 0xE01FC040 0x00000001   # MEMMAP  = 0x01
#sleep 10

arm7_9 dcc_downloads enable

flash probe 0

# erase complete flash:
#flash erase 0 0 26
# just erase the 3 first sectors of bank 0
flash erase 0 0 5

flash write 0 main.bin 0x0

sleep 30
reset run
sleep 30
shutdown

When I try to flash the program, the ARM-USB-TINY LED blinks a little bit, and the board wakes from reset, but nothing else happens.

I’ve tested a lot of things: changing jtag_speed, changing ft2232_device_desc from “A” to “B”, changing jtag_nsrst_delay and jtag_ntrst_delay, I have reinstalled the dev environment from the ground up following James P. Lynch guide, I have also tested WinARM, and a lot of things I don’t remember now, but always get the same result :(. I’m starting to think maybe something in the board or the emulator is wrong.

Please help! Any suggestion would be really appreciated!](http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/)

Hello

In your …cfg file is the error that

flash bank lpc2000 0x0 0x80000 0 0 lpc2000_v2 0 12000 calc_checksum

should read

flash bank lpc2000 0x0 0x80000 0 0 0 lpc2000_v2 12000 calc_checksum

Thanks a lot alfgru! Great error hunt! But unfortunately it looks like there is another problem. Now it looks like it’s working, but the code doesn’t run. When I run openocd, it gives me this output:

Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Warning: embeddedice.c:175 embeddedice_build_reg_cache(): EmbeddedICE version 7 detected, EmbeddedICE handling might be broken
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too
Info:    target.c:232 target_init_handler(): executing reset script 'openocd_flash_lpc2378.script'
Info:    configuration.c:50 configuration_output_handler(): requesting target halt...
Warning: arm7_9_common.c:933 arm7_9_halt(): target was already halted
Info:    configuration.c:50 configuration_output_handler(): target already halted
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(): dcc downloads are enabled
Info:    configuration.c:50 configuration_output_handler(): flash 'lpc2000' found at 0x00000000
Info:    configuration.c:50 configuration_output_handler(): erased sectors 0 through 5 on flash bank 0 in 0s 62500us
Info:    configuration.c:50 configuration_output_handler(): wrote  3908 byte from file main.bin to flash bank 0 at offset 0x00000000 in 0s 500000us (7.632813 kb/s)
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too

It doesn’t report errors, but when I reset the board, it runs the program pre-programmed by Olimex (the display shows the Olimex logo) so I suppose the internal Flash isn’t even erased!

If I try to debug, the debugger hangs (maybe waiting for the program to reach “main” entry point) and the only thing I see is again the Olimex logo appearing on the display. These are the messages printed in the gdb window:

target remote localhost:3333
0x000053cc in ?? ()
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file main.elf
thbreak main
Hardware assisted breakpoint 1 at 0x206: file main.c, line 98.
continue

Is it possible that OpenOCD reports the chip is Flashed when it is not? Does it verify the flash operation? How can I make this to work?

Thanks in advance.

I’ve done some more tests connecting directly to OpenOCD with telnet. It looks like the Flash is protected, but I had a look at the datasheet and I have not found anything about write protection, only about read protection (CRP), and I think it’s disabled (because register at 0x1FC has not a CRP value). Here are the relevant commands I have sent to OpenOCD:

> flash banks
#0: lpc2000 at 0x00000000, size 0x00080000, buswidth 0, chipwidth 0
> flash probe 0
flash 'lpc2000' found at 0x00000000
> flash erase_check 0
successfully checked erase state
> flash protect_check 0
successfully checked protect state
> flash info 0
#0: lpc2000 at 0x00000000, size 0x00080000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x1000kB) not erased, protected
        #1: 0x00001000 (0x1000kB) not erased, protected
        #2: 0x00002000 (0x1000kB) not erased, protected
        #3: 0x00003000 (0x1000kB) not erased, protected
        #4: 0x00004000 (0x1000kB) not erased, protected
        #5: 0x00005000 (0x1000kB) not erased, protected
        #6: 0x00006000 (0x1000kB) not erased, protected
        #7: 0x00007000 (0x1000kB) not erased, protected
        #8: 0x00008000 (0x8000kB) not erased, protected
        #9: 0x00010000 (0x8000kB) not erased, protected
        #10: 0x00018000 (0x8000kB) not erased, protected
        #11: 0x00020000 (0x8000kB) erased, protected
        #12: 0x00028000 (0x8000kB) erased, protected
        #13: 0x00030000 (0x8000kB) erased, protected
        #14: 0x00038000 (0x8000kB) erased, protected
        #15: 0x00040000 (0x8000kB) erased, protected
        #16: 0x00048000 (0x8000kB) erased, protected
        #17: 0x00050000 (0x8000kB) erased, protected
        #18: 0x00058000 (0x8000kB) erased, protected
        #19: 0x00060000 (0x8000kB) erased, protected
        #20: 0x00068000 (0x8000kB) erased, protected
        #21: 0x00070000 (0x8000kB) erased, protected
        #22: 0x00078000 (0x1000kB) erased, protected
        #23: 0x00079000 (0x1000kB) erased, protected
        #24: 0x0007a000 (0x1000kB) erased, protected
        #25: 0x0007b000 (0x1000kB) erased, protected
        #26: 0x0007c000 (0x1000kB) erased, protected
lpc2000 flash driver variant: 2, clk: 0
> flash protect 0 0 26 off
cleared protection for sectors 0 through 26 on flash bank 0
> flash erase 0 0 26
erased sectors 0 through 26 on flash bank 0 in 0s 62500us
> flash protect_check 0
successfully checked protect state
> flash erase_check 0
successfully checked erase state
> flash info 0
#0: lpc2000 at 0x00000000, size 0x00080000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x1000kB) not erased, protected
        #1: 0x00001000 (0x1000kB) not erased, protected
        #2: 0x00002000 (0x1000kB) not erased, protected
        #3: 0x00003000 (0x1000kB) not erased, protected
        #4: 0x00004000 (0x1000kB) not erased, protected
        #5: 0x00005000 (0x1000kB) not erased, protected
        #6: 0x00006000 (0x1000kB) not erased, protected
        #7: 0x00007000 (0x1000kB) not erased, protected
        #8: 0x00008000 (0x8000kB) not erased, protected
        #9: 0x00010000 (0x8000kB) not erased, protected
        #10: 0x00018000 (0x8000kB) not erased, protected
        #11: 0x00020000 (0x8000kB) erased, protected
        #12: 0x00028000 (0x8000kB) erased, protected
        #13: 0x00030000 (0x8000kB) erased, protected
        #14: 0x00038000 (0x8000kB) erased, protected
        #15: 0x00040000 (0x8000kB) erased, protected
        #16: 0x00048000 (0x8000kB) erased, protected
        #17: 0x00050000 (0x8000kB) erased, protected
        #18: 0x00058000 (0x8000kB) erased, protected
        #19: 0x00060000 (0x8000kB) erased, protected
        #20: 0x00068000 (0x8000kB) erased, protected
        #21: 0x00070000 (0x8000kB) erased, protected
        #22: 0x00078000 (0x1000kB) erased, protected
        #23: 0x00079000 (0x1000kB) erased, protected
        #24: 0x0007a000 (0x1000kB) erased, protected
        #25: 0x0007b000 (0x1000kB) erased, protected
        #26: 0x0007c000 (0x1000kB) erased, protected
lpc2000 flash driver variant: 2, clk: 0
> mdb 0 64
0x00000000: 18 f0 9f e5 18 f0 9f e5
0x00000008: 18 f0 9f e5 18 f0 9f e5
0x00000010: 18 f0 9f e5 58 6f a0 b8
0x00000018: 18 f0 9f e5 18 f0 9f e5
0x00000020: b0 00 00 00 58 69 00 00
0x00000028: 54 69 00 00 5c 69 00 00
0x00000030: 60 69 00 00 00 00 00 00
0x00000038: 10 69 00 00 50 69 00 00
> mdw 0x1fc 1
0x000001fc: e59f0af4

Does OpenOCD correctly implement Flash operations for LPC2378 chips? Am I doing anything wrong?

Thanks in advance.

Well, finally I got it to work. I had to program the Flash using Flash Magic utility and then I could debug without problems. Now I can start working with the board, but it’s a bit annoying to have to plug the serial port, change jumpers in the board and launch Flash Magic every time I want to start a debug session.

Is there a way to flash the chip using the ARM-USB-TINY emulator? LPC2378 User Manual states that it’s possible to flash the chip via JTAG, but is this supported in OpenOCD for this chip?

Hello

I am using also the Olimex LPC2378 STk board and the Olimex ARM-USB-OCD and had similar problems. They disappeared, when I set in the …cfg file the jtag speed to15. Does the Tiny emulator also have a LED? If yes then it should stay green if openocd is started!

Maybe this helps.

Can you post you CFG files ? I just received my ARM-USB-OCD today, and I have exactly the same problem, I can’t seem to update the flash. I’ve been doing it for months now over a serial link, and wanted to get a speed bsost by doing it though JPEG, but so far, no joy.

thanks,

Andy

I am also having this problem. I can flash/verify just fine over serial, but when I use the ARM-USB-TINY, IAR W-ARM causes all kinds of data abort errors, and gdb on eclipse never runs …

Also, although I can flash a program using serial, how do I get it to run? I tried several, but it appears no execution is occurring… just the SD? light and PWR light are steady on, regardless of if I hit the reset button, etc. This happens with the GettingStarted, VirtualCOM, and MassStorage demo, and the last two don’t do any USB communication either… JTAG thinks it’s running, though… ?!

I have the same problem. Did you solve yours ?

No, I haven’t received any response at all. This is really quite a poor development setup…

I`ve readthis topic al couple of times, and after a few days of no response I had to find out it for myself.

When I was reading the script manual of the openocd debugger I found that the script commands erase and write are not longer supported.

That`s why the info messages “Command erase not found” and “Command write not found” appeared.

You can try to replace the erase command by “erase_sector” ith the same arguments.

The write command should be replaced by “write_image” followed up by the filename , the start address, and the type of file (bin/ihex/elf)

for example: ```
flash write_image main.elf 0x0 elf

my script file contains the following and It`s possible to flash my LPC2378 with an amontec JTAG key tiny from an Eclipse workspace.

Debugging is also no problem if I remove the shutdown command at the end of the script.

sciptfile: 

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

PRELIMINARY - first test for LPC2378

Martin Thomas

http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects

based on information from Dominic Rath

halt
sleep 20
wait_halt

ignore my comments - setup works without the following.

disable PLL and switch to IRC (4 MHz nom.)

hmm - should not be needed since IRC is default source after Reset…

any interaction with the ISP startup??

doesn’t work anyway - something missing

TODO: read manual.

#mww 0xE01FC080 0x00000000 # PLLCON = 0
#mww 0xE01FC08C 0x000000AA # PLLFEED = 0xAA
#mww 0xE01FC08C 0x00000055 # PLLFEED = 0x55
#mww 0xE01FC040 0x00000001 # MEMMAP = 0x01
#sleep 10

arm7_9 dcc_downloads enable

flash probe 0

erase complete flash:

#flash erase_sector 0 0 26

just erase the 3 first sectors of bank 0

#flash auto_erase on

flash erase_sector 0 0 5

flash write_image main.elf 0x0 elf

sleep 30
reset run
sleep 30
shutdown

I have had the same problem for a long time and when I saw this post I was really excited thinking finally I will have an answer. But alas nothing had worked for me.

The change that did the trick for me was the clock frequency in the flash bank command. I have configured the PLL to set the clock frequency at 60Mhz but I had

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 10000 calc_checksum.

When I changed this to:

bankcommand.flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 60000 calc_checksum

it works the best. I have observed it successfully programs even if it is set for 14765 but it was very flakey.

So hopefully this turns out to be THE cause of the problem and I accidentally found the fix.

:smiley:

-daa

My configuration:

LPC2294 on a Phytec board; Amontec jtag tiny; Config files very similar to what proposed in earlier posts.

Hi all,

I have the same problem on Windows Vista. I’m using openOCD 204, ARM-USB-TINY. Here’s what I get:

Error: ft2232.c:1341 ft2232_init_ftd2xx(): unable to open ftdi device: 2

Error: ft2232.c:1356 ft2232_init_ftd2xx(): ListDevices: 2

Error: ft2232.c:1358 ft2232_init_ftd2xx(): 0: Olimex OpenOCD JTAG TINY B

Error: ft2232.c:1358 ft2232_init_ftd2xx(): 1: Xš:

This is the part of the config that matters:

#interface

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0004

jtag_speed 20

What is the solution?

Thanks,

Gil

Problem solved with this 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

Thanks,

Gil

Hello everyone,

First, I only have little experience with embedded systems and none with ARM architecture. A week ago I received an Olimex PLC2378-STK and ARM-USB-TINY, but didn’t have much success since then! I am simply trying to program the LED flashing example code, but have problems when writing to the flash memory. Looking at this forum, I thought I would find an answer but couldn’t see someone else with the same problem. Here it is:

When launching “OpenOCD Tiny” from within Eclipse, I get the following warning:

Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Warning: embeddedice.c:175 embeddedice_build_reg_cache(): EmbeddedICE version 7 detected, EmbeddedICE handling might be broken

I decide to ignore that warning and start debugging. It gives me the following. I am not sure what “hardware assisted breakpoint” means:

source .gdbinit
target remote localhost:3333
0x00000214 in GPIOResetInit () at target.c:62
62        IOSET1 = 0x00000000;
monitor soft_reset_halt
Reply contains invalid hex digit 116
Ignoring packet error, continuing...
monitor arm7_9 force_hw_bkpts enable
Ignoring packet error, continuing...
Hardware assisted breakpoint 1 at 0x900: file main.c, line 34.
Reply contains invalid hex digit 116
symbol-file main.out
thbreak main
continue

Still no LED flashing…

The debug ‘initialize commands’ are (I use no ‘run commands’):

target remote localhost:3333
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file main.out
thbreak main
continue

Does someone understand what is going on? I am not even sure the .bin is loaded into the LCP2378…

Any advice would be great help! Thanks!

Matt

Is there anyone that can describe how to use IAR 5.40 with the ARM-USB-TINY through the GDB server?

I have tried any possible cfg, but I still get data abort errors.

I have the Olimex LPC-2378-STK board and it works fine with CrossStudio and with the eclipse toolchain.