Hi.
I'm starting to use the LPC824 on a custom board, after I used a development board for some time.
It happens however that I could program the microcontroller only once! The first try it programmed without any problem. After that it doesn't seem to be entering ISP mode anymore.
It seems like a standard CRP behaviour (I can no longer access the chip neither by ISP nor by SWDIO with an LPC Link2 I have). But I didn't change the "startup_LPC82x.s" and I already checked that the CRP is not activated:
"
IF :LNOT::DEF:NO_CRP
AREA |.ARM.__at_0x02FC|, CODE, READONLY
DCD 0xFFFFFFFF
ENDIF
AREA |.text|, CODE, READONLY
"
Can there be other reason why the chip is not entering ISP mode?
I'm using deep-power-down mode, but I couldn't find anywhere in the documentation something that relates deep-power-down with a problem in ISP.
Here is my main.c, if there is someone who can help me:
"
while(1) {
// System initialization
SYS_Init();
UART_Init();
// Debug UART initialization
uart_dbg = UART_GetUart(UART_DEBUG);
UART_ConfigureUART(uart_dbg, B115200, FALSE);
UART_EchoOn(uart_dbg);
// Read the device UID and store it for future use
SYS_ReadUID(UID);
// Identifies itself on the debug UART
sprintf(str, "\r\n\r\nI'm alive!\r\n");
UART_SendText(uart_dbg, str);
sprintf(str, "Dev UID:\"%08X:%08X:%08X:%08X\"\r\n", UID[0], UID[1], UID[2], UID[3]);
UART_SendText(uart_dbg, str);
sprintf(str, "Reset Type: %02X\r\n", SYS_GetResetStatus());
UART_SendText(uart_dbg, str);
// Clears the reset status register if wake-up was not from POR (Power-On Reset)
if(SYS_GetResetStatus() != 0) {
SYS_ClearResetStatus();
}
sprintf(str, "Time since first boot: %lu\r\n", SYS_GetTimeSinceStart());
UART_SendText(uart_dbg, str);
// Configures the watchdog and BOD blocks to be powered-down during deep-power-down mode
LPC_SYSCON->PDSLEEPCFG = (1 << 3) | (1 << 6);
// Configures the wake-up configuration register to have all blocks powered-up upon wake-up
LPC_SYSCON->PDAWAKECFG = 0;
// Enables the self-wake-up timer interrupt wake-up
LPC_SYSCON->STARTERP1 = (1 << 15);
//Waits while the Debug UART is still transmitting
while(UART_CheckTransmitIdle(uart_dbg) == 0);
// Configures self wake-up timer to wake-up SLEEP_TIME seconds before next cycle
SYS_SetSelfWakeTimer(SLEEP_TIME);
// Enters deep-power-down
SYS_DeepPowerDown();
}
}
Thank you,
Pedro.