Content originally posted in LPCWare by Miendar on Fri Jan 17 03:27:14 MST 2014
Hi,
To exit to ISP bootloader, I'm using advice from Ex-Zero by using Application Interrupt and Reset Control Register (AIRCR).
In my project, I use a soft under VB to communicate with the LPC11C14. I use following messages to write instructions in RAM at 0x1000 0300 (RAM aera used by FlashMagic to write temporary instructions) and to execute it (GO command):
Dim write_unlock() As Byte = {&H2B, &H0, &H50, &H0, &H5A, &H5A, &HDE, &H4}
Dim write_address() As Byte = {&H23, &H15, &H50, &H0, &H0, &H3, &H0, &H10}
Dim write_prg_data() As Byte = {&H21, &H50, &H1F, &H1, &H0, &H4, &H0, &H0}
Dim write_code_1() As Byte = {&H0, &H1, &H4A, &H2, &H4B, &HDA, &H60, &HC0}
Dim write_code_2() As Byte = {&H10, &H46, &H4, &H0, &HFA, &H5, &H0, &HED}
Dim write_code_3() As Byte = {&H0, &H0, &HE0, &H0, &H0, &H0, &H0, &H0}
Dim go() As Byte = {&H23, &H70, &H50, &H1, &H0, &H3, &H0, &H10}
Dim start() As Byte = {&H2F, &H51, &H1F, &H1, &H1, &HFE, &HDE, &H4}
For information (from Ex-zero post):
void Own_Reset(void)
{
SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
300: 4a01 ldr r2, [pc, #4] ; (308 )
302: 4b02 ldr r3, [pc, #8] ; (30c )
304: 60da str r2, [r3, #12]
SCB_AIRCR_SYSRESETREQ_Msk);
}
306: 4770 bx lr
308: 05fa0004 .word 0x05fa0004
30c: e000ed00 .word 0xe000ed00
the compiled code is:
const char system_reset[]={0x01,0x4a,0x02,0x4b,0xda,0x60,0xc0,0x46,0x04,0x00,0xfa,0x05,0x00,0xed,0x00,0xe0};
I hope it can help someone someday !