I'm trying to program LPC1224 using the reinvokeisp mode from user code but I'still have no answer to a sync character '?'.
void ReinvokeISP(void)
{
/* disable WatchDog */
LPC_WWDT->MOD = 0;
__disable_irq();
/* make sure 32-bit Timer 1 is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 10) | (1 << 10);
/* make sure GPIO clock is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 29) | (1 << 30) | (1 << 31); //0x00040;
/* make sure IO configuration clock is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 16); //0x10000;
// AHB clock divider must 1:1
LPC_SYSCON->SYSAHBCLKDIV = 1;
// disabele PLL
LPC_SYSCON->MAINCLKSEL = 0;// enable IRQ oscillator
LPC_SYSCON->MAINCLKUEN = 0x01;// update MLCK clock source
LPC_SYSCON->MAINCLKUEN = 0x00;// toggle update register
LPC_SYSCON->MAINCLKUEN = 0x01;
while (!(LPC_SYSCON->MAINCLKUEN & 0x01))// wait until updated
;
// the cortex M0 needs to synchronize the CPU cache
__ISB();
LPC_GPIO0->DIR |= (1<<12); //set GPIO0_12 DIR out
LPC_GPIO0->CLR = (1<<12);
command[0] = IAP_CMD_REINVOKE;
// reset the stack pointer to point to the top of the stack minus 32 byte for IAP
// for LPC11Cxx where top of RAM (8kB) is 0x1000_2000: MSP = (0x1000_20000 - 0x20 = 0x1000_1FE0)
/* Set stack pointer to ROM value (reset default) */
__set_MSP(*((uint32_t *) 0x1FFF0000));
iap_entry(command, output);
}
Please help, I spent many days with no success.
Thanks.
Hi Alberto Savazzi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I was wondering if you can upload the demo, then I can run the demo on the board to replicate the issue.
I'm looking forward to your reply.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi jeremyzhou,
thank you for your help. Below you can find the link to get the little demo.