Seem to have "lost" my LPC812

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Seem to have "lost" my LPC812

812 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Mon Jan 28 11:25:35 MST 2013
I made a mistake in programming my LPC812 in that I added the following line to the startup code:
    /* Pin Assign 1 bit Configuration */
    /* ACMP_I1 */
    /* SWCLK */
    /* SWDIO */
    /* RESET */
    LPC_SWM->PINENABLE0 = 0xffffffb2UL;
0x1B2 is not the right value it turns out. In the debugger I saw this line lose connection several times and when I inspected the register the power on default was actually 0x183 so I should have been setting it to 0x182 to only change the analog comparator which was the aim. Incidentally the "Switch matrix" tool from NXP generated this wrong code. But that's incidental.

So to correct this I stopped debugging and changed the source then tried to start debugging again but whatever I try I cannot make it connect. I see the red LED on the debugger part of the board flash and the green LED on the LPC812 side momentarily goes off but then lights again. So it's like the CPU is being reset but it restarts and sets that register which disconnects the debugger before the debugger can "catch it".

So it looks like I screwed the SWD link. So how do I get back from here?

I've read other threads that mention "flashmagic" and that involves connecting up UART RX/TX pins to a USB-RS232 and holding a pin low after reset. But is that the only thing I can do. Is there nothing in the Code Red IDE I can do to tell the debugger to give some kind of "hard reset" to stop the debugged CPU from starting?

I'm kind of hoping I can do this without having to wire up UART etc. but I have a sneaking suspicion that it maybe cannot be avoided?

(shame the datasheet does not have some kind of strong warning about the consequences of simply writing the wrong value to the PINENABLE0 register!)

WF1903
0 Kudos
Reply
4 Replies

537 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jan 29 05:27:41 MST 2013

Quote: wrighflyer
Just to report total success :D



Good to hear that :) Nevertheless it is a good idea to think about adding a simple UART connector to all your LPC boards. To build / buy an UART-RS232 or UART-USB converter and just test usage of FlashMagic is a very useful (and soothing) procedure. Unfortunately sometimes even switching to ISP doesn't solve SWD problems, so ISP bootloader is your last hope :)
0 Kudos
Reply

537 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Tue Jan 29 04:55:42 MST 2013
Just to report total success :D

I love this message board - I've used LPC1343 in the past and always got helpful, targetted answers and this LPC812 question just proves once again how useful a support resource this is for LPC micros.

WF1903
0 Kudos
Reply

537 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Tue Jan 29 03:09:15 MST 2013
Brilliant link! And such a simple solution.

Sadly quite a lot of googling before I asked about this didn't hit that one. I guess this thread may help to lift its Google score a bit ;-)

WF1903

PS I do have UM10601 (there's very little other documentation for LPC812 - the board or the chip) and you are right that there's a chapter on the bootloader which I'd even read but I hadn't made the link to the fact that doing this would hold it in code that has not messed with the pin multiplexing so could be controlled by SWD - which was the "missing bit" for me.
0 Kudos
Reply

537 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Jan 28 11:37:45 MST 2013
As described in user manual 10601 :eek:

Pull your ISP pin (PIO0_1) low, reset or recycle your MCU. Then you're in ISP mode and SWD should work as usual :)

See: http://www.support.code-red-tech.com/CodeRedWiki/DebugAccessChip
0 Kudos
Reply