Cannot unprotect/erase flash: ARM_USB_OCD + Olimex LPC2103

I am unable to turn off flash sector protection on the Olimex LPC2103 dev board.

openocd config:

#Target configuration file for openOCD.
#Using with Olimex Dev Board for LPC-2103 

if { [info exists CHIPNAME] } {	
   set _CHIPNAME $CHIPNAME
} else {
   set _CHIPNAME lpc2103
}

if { [info exists ENDIAN] } {
   set _ENDIAN $ENDIAN
} else {
   set _ENDIAN little
}

if { [info exists CPUTAPID ] } {
   set _CPUTAPID $CPUTAPID
} else {
   set _CPUTAPID 0x4f1f0f0f 
}

jtag_khz 500

reset_config trst_and_srst

# reset delays
jtag_nsrst_delay 200
jtag_ntrst_delay 200

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]

target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4

# 8kB of internal SRAM
$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x2000 -work-area-backup 0

# 32kB of internal Flash, core clocked with 14.7456MHz crystal
flash bank lpc2000 0x0 0x8000 0 0 0 lpc2000_v2 14746 calc_checksum

openOCD startup:

  • Open On-Chip Debugger 0.2.0 (2009-07-18-09:50) Release

    $URL: http://svn.berlios.de/svnroot/repos/ope … /openocd.c $

    For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS

    500 kHz

    jtag_nsrst_delay: 200

    jtag_ntrst_delay: 200

    Info : JTAG tap: lpc2103.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)

    Info : JTAG Tap/device matched

    target state: halted

    target halted in ARM state due to breakpoint, current mode: Supervisor

    cpsr: 0x400000d3 pc: 0x40000070

    Info : accepting ‘telnet’ connection from 0


  • Telnet session to openOCD server:

  • Open On-Chip Debugger

    flash probe 0

    flash ‘lpc2000’ found at 0x00000000

    flash info 0

    #0 : lpc2000 at 0x00000000, size 0x00008000, buswidth 0, chipwidth 0

    0: 0x00000000 (0x1000 4kB) protected

    1: 0x00001000 (0x1000 4kB) protected

    2: 0x00002000 (0x1000 4kB) protected

    3: 0x00003000 (0x1000 4kB) protected

    4: 0x00004000 (0x1000 4kB) protected

    5: 0x00005000 (0x1000 4kB) protected

    6: 0x00006000 (0x1000 4kB) protected

    7: 0x00007000 (0x1000 4kB) protected

    lpc2000 flash driver variant: 2, clk: 14746

    flash protect 0 0 7 off

    cleared protection for sectors 0 through 7 on flash bank 0

    flash info 0

    #0 : lpc2000 at 0x00000000, size 0x00008000, buswidth 0, chipwidth 0

    0: 0x00000000 (0x1000 4kB) protected

    1: 0x00001000 (0x1000 4kB) protected

    2: 0x00002000 (0x1000 4kB) protected

    3: 0x00003000 (0x1000 4kB) protected

    4: 0x00004000 (0x1000 4kB) protected

    5: 0x00005000 (0x1000 4kB) protected

    6: 0x00006000 (0x1000 4kB) protected

    7: 0x00007000 (0x1000 4kB) protected

    lpc2000 flash driver variant: 2, clk: 14746

    flash erase_sector 0 0 7

    erased sectors 0 through 7 on flash bank 0 in 0.550792s

    flash erase_check 0

    successfully checked erase state

    0: 0x00000000 (0x1000 4kB) not erased

    1: 0x00001000 (0x1000 4kB) erased

    2: 0x00002000 (0x1000 4kB) erased

    3: 0x00003000 (0x1000 4kB) erased

    4: 0x00004000 (0x1000 4kB) erased

    5: 0x00005000 (0x1000 4kB) erased

    6: 0x00006000 (0x1000 4kB) erased

    7: 0x00007000 (0x1000 4kB) erased

  • WTF? Anyone know how to unlock the flash on the LPC2103?

    Cheers,

    cesium

    Hmmm.

    Do you think this is a reset issue?

    I’m reading ARM Application Note 31 and it’s pretty scary.

    Wow, I need some help with this one.

    cesium

    Actually I was able to erase the flash at some point in my testing,

    even though openOCD says that the sectors are protected.

    There is no longer a valid user program so the memory map of the

    device will follow the reset memory map with the boot block interrupt

    vectors mapped to 0x0000 0000.

    That’s what I’m seeing when I do a mdw!

    openOCD thinks that sector 0 is not being erased because it sees them too!

    So, perhaps the flash is erasing just fine.

    Now, I’ll move on to writing to flash.

    cesium

    I had about the same problem with a LPC2478. Complaining about the protected sector and giving verify errors. It turned out to be the level of P2.10 : when low the ISP mode is entered. Took a while before I found that.

    nb: the KEIL Ulink could program and verify the first sector! ( program did not run either)

    Dig Kleppe