This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2300 LPC2368 Reinvoke ISP from user code

Hi,

I am trying to get an LPC2368 to reinvoke the ISP from user code, and although there is a good application note for the LPC2100 chips, I can't find anything for the LPC2300 ones.

I have found some code for an LPC2458 (below), but I'm not sure what compiler it's for, (it doesn't compile in uVision MDK-ARM V4.10), and I'm not sure it's even suitable for the LPC2368. I have read that the SP is not writeable in inline assembly... So I'm quite lost.

I've read the UM, and it makes it sound quite simple; one command does it all, but it seems like I still need to use inline assy to run said command.

I was hoping to find a code snippet online; I'd imagine the 'reinvoke-isp' function to be highly re-usable for any LPC2300 application..? But no luck..

If anyone has managed to get it going, I'd really appreciate a pointer (no pun intended), or even a function to copy & paste (I can dream..).

Thanks in advance

Nat

=========================================

LPC2458 Code:

void iap_cmd_reinvoke_isp(void) {
// Ensure fast I/O is supported.
SCS |= 1;

// Disconnect PLL.
PLLCON = 0x00;
PLLFEED = 0xAA;
PLLFEED = 0x55;

// Set IRC as the clock source.
CLKSRCSEL = 0x00;
// CCLK divider = 0 (CCLK = 4MHz)
CCLKCFG = 0x00;

__asm("ldr r0, =spval\n\t" /* Set the stack pointer */
"ldr sp, [r0]\n\t" /* to the end of (SRAM - 32) */
"ldr r0, =iapcommand\n\t" /* Enter ISP mode (via IAP) */
"ldr r2, =iapentry\n\t"
"ldr r2, [r2]\n\t"
"bx r2\n\n"
"spval: .word 0x40007FE0\n\t" /* SRAM - 32 */
"iapentry: .word 0x7FFFFFF1\n\t" /* Address of IAP function (Thumb) */
"iapcommand: .word 57"); /* IAP command 57 (Reinvoke ISP) */
}

0