LPC2148 + Olimex ARM-USB-TINY woes...

Hey guys…

I have been playing around with a 2148 and olimex interface, as the description says, for a little while now.

The other day I was programming, had just set some PLL parameters and some time later when debugging the code, the chip seemed to stop processing… When trying to reload the code to flash, several error messages appeared… I disconnected the chip from the interface and tried again… only to receive the following errors…(i am using openOCD and eclipse)

Info : clock speed 1500 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: lpc2148.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Embedded ICE version 0
Error: unknown EmbeddedICE version (comms ctrl: 0x00000000)
Info : lpc2148.cpu: hardware has 2 breakpoint/watchpoint units

However it still seems to connect to the chip… but i cannot seem to halt the cpu to load/erase the flash or perform any other tasks…

if i try to halt via telnet i receive the following:

Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
in procedure 'halt'

and “scan_chain” returns this

   TapName             Enabled  IdCode     Expected   IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
 0 lpc2148.cpu            Y     0x00000000 0x3f0f0f0f     4 0x01  0x0f
                                           0x4f1f0f0f

Does anybody have any ideas of what may be happening?? Many thanks in advance, but this is killing me!!! :frowning:

ok so if i disconnect the board i get exact same result…

could it be the Olimex ARM-USB-TINY???

It could be the USB-Tiny. But if you have the ability, reprogram via serial port to a known well-behaved configuration. It is possible to accidentally (or on purpose) have your start-up code disable the JTAG interface.

Easier said than done :frowning: I’d have to get the arm USB OCD for that wouldn’t I?

Is there any reason why the lPc would just die?

[You may already know all this - apologies if so.]

The LPC2148 has a built in bootloader that tries to establish communication on RXD0 & TXD0 (P0.1 & P0.0) if P0.14 is held low during reset. AN10356 [here is really about in-application programming, but does give some background on the built-in command handler.

The software most commonly used to perform this task is[Flash Magic.

So if your board has a level-shifter on those pins, you can use Flash Magic to reprogram the chip via the serial port on your PC. Or if your board has a USB-serial converter there, you can re-program via USB. This bootloader runs before your user program, so it can be used no matter what code you have in the part. Whereas the JTAG pins won’t work if your code re-configures the pins as GPIO, for example.

What board are you using?](http://www.flashmagictool.com/)](http://www.nxp.com/technical-support-portal/50809/45994/application-notes)

eeeek… im using a crappy thing i bought off ebay “the0.net”… I purchased it before I knew what was what…

hmm pretty sure it doesn’t have anything fancy like a USB-Serial converter :frowning:

dont think board has a level shifter… just straight from the header interface to the pins…

I cant give it a go… thanks for the tips… ill let you know how i go

Ah. One of the bargain sites I frequent used to carry a header board from the0. Similar to the Olimex [header board that Sparkfun sells. As you say, the pins go straight to the header. So you’d have to buy a [level shifter or [USB inteface just to connect to the pins. Not an easy decision - might be a waste of time and money since the 2148 might be completely dead, or the USB-Tiny might be the problem, or…

I actually have the Olimex version of the 2148 header board. My DMM reads just under 1 volt DC at each of the xtal pins when I supply power. (My DMM tops out around 500KHz and has no hope of seeing the 12MHz clock.) If you have a DMM and see something significantly different from 1 VDC at the crystal pins, that would be an indication that your 2148 has really died.](SparkFun USB to Serial Breakout - FT232RL - BOB-12731 - SparkFun Electronics)](SparkFun RS232 Shifter Board Kit - PRT-00133 - SparkFun Electronics)](Header board for LPC2148 - DEV-00676 - SparkFun Electronics)

thanks for the advice mate!

my board reads approx 0.9V at each pin…

i purchased a arm-usb-tiny-h and a olimex h2148… it seems that my the0 board is dead…

i tried using the adaptive clocking feature to see if it could hopefully pick up the board, no such luck however :frowning:

i wonder why the board isn’t functioning correctly, it is only a few months old…

ule_1 could you please post your openocd configuration file here? ive been having trouble flashing the olimex lpch2148 with openocd. i suspect it has to do with the new version of openocd 0.6, i have tried with some different files around the internet but none of them worked. Lots of syntax (it seems) errors appear.

im working under ubuntu 12.04 with a jlink jtag debugger. i can succesfully communicate with the jlink via the openocd telnet port, but the flashing thing havent worked so far.

thanks in advance!

i used the olimex-jtag-tiny.cfg file and the lpc2148 config file that was in the openocd /target directory

ule_1 Thank you very much for your response. I think its working now :smiley:

For reference I will post here my cfg file: (Im using a SEGGER Jlink with OLIMEX lpch2148 board)

# config.cfg
# Daemon Config
telnet_port 4444
tcl_port 6666

# Interface: SEGGER Jlink
interface jlink

# Board: OLIMEX LPCH2148
source [find target/lpc2148.cfg]

With this file I run openocd: sudo openocd -f config.cfg

and this is the output generated:

Open On-Chip Debugger 0.6.0-dev-00599-ga21affa (2012-06-08-05:31)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Adapter driver 'jlink' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
init_targets
Warning - assuming default core clock 12MHz! Flashing may fail if actual core clock is different.
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
1500 kHz
Info : J-Link initialization started / target CPU reset initiated
Info : J-Link ARM V8 compiled Dec  1 2009 11:42:48
Info : J-Link caps 0xb9ff7bbf
Info : J-Link hw version 80000
Info : J-Link hw type J-Link
Info : J-Link max mem block 9576
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0x0
Info : Vref = 3.300 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 0 TRST = 0
Info : J-Link JTAG Interface ready
Info : clock speed 1500 kHz
Info : JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
Info : Embedded ICE version 4
Info : lpc2148.cpu: hardware has 2 breakpoint/watchpoint units

Now, on the other console I connected to the telnet port

telnet localhost 4444

and this is what I did:

Open On-Chip Debugger
> flash banks
#0 : lpc2148.flash (lpc2000) at 0x00000000, size 0x0007d000, buswidth 0, chipwidth 0
> halt
target state: halted
target halted in Thumb state due to debug-request, current mode: System
cpsr: 0x8000003f pc: 0x0000220e
> flash write_bank 0 helloWorldARM.o 0
Verification will fail since checksum in image (0x00000001) to be written to flash is different from calculated vector checksum (0x588a38b2).
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
wrote 124326 bytes from file helloWorldARM.o to flash bank 0 at offset 0x00000000 in 10.918998s (11.119 KiB/s)

So I think it worked well. Now I have to test if the program was correctly flashed.

I will post another reply here if I have trouble.

Thanks again mate!