#LPC4337 hangs after repeated short-term drops
After a reset, the processor stops reading the PMC_PD0_SLEEP0_MODE register. In the test program for the OM13070 evaluation board hovering is determined by the red color of the LED after reset. To restore normal operation after a failure, you must simultaneously turn off VREG and VBAT - resetting or turn off only VREG will not unlock. It seems like PMC_PD0_SLEEP0_MODE clocking is lost. Below is the text of the program - the whole program is Reset_Handler
void Reset_Handler(void)
{
CREG_CREG0 = (1 << 0) // Enable 1 kHz output
| (1 << 1) // Enable 32 kHz output
| (0 << 2) // Clear 32 kHz oscillator reset
| (0 << 3) // Powered 32 kHz oscillator
| (1 << 5) // Disable USB0 PHY
| (3 << 6 // Disable RTC_ALARM pin according to errata
| (2 << 8) // level 2 (typ: assertion - 2.95 V, de-assertion - 3.03 V)
| (3 << 10) // level 3 (typ: assertion - 2.2 V, de-assertion - 2.28 V)
| (3 << 12); // Disable SAMPLE pin according to errata
on_red_led();
uint32_t dummy = PMC_PD0_SLEEP0_MODE;
off_red_led();
on_green_led();
while (1);
}
After adding a delay, there are no freezes
void Reset_Handler(void)
{
CREG_CREG0 = (1 << 0) // Enable 1 kHz output
| (1 << 1) // Enable 32 kHz output
| (0 << 2) // Clear 32 kHz oscillator reset
| (0 << 3) // Powered 32 kHz oscillator
| (1 << 5) // Disable USB0 PHY
| (3 << 6 // Disable RTC_ALARM pin according to errata
| (2 << 8) // level 2 (typ: assertion - 2.95 V, de-assertion - 3.03 V)
| (3 << 10) // level 3 (typ: assertion - 2.2 V, de-assertion - 2.28 V)
| (3 << 12); // Disable SAMPLE pin according to errata
on_red_led();
for (uint32_t i = 1000000; i; i--)
;
uint32_t dummy = PMC_PD0_SLEEP0_MODE;
off_red_led();
on_green_led();
while (1);
}
Hello Alex,
Did you replace the ResetISR code for this one or are you calling this code after the reset intialization?
Best Regards,
Alexis Andalon
Hello Alex,
In the LPCOpen example (link here) before enabling the clocks there's some sentences need it for the correct functionality, for example, the RGU->RESET_CTRL0/1 are the first registers that are written, and this enables/disables if some reset peripherals, the clearing of the pending interrupts or the allocation of the VTOR.
There's also a function (Board_SetupClocking) where the CREG0 is called, maybe you could try the configuration you need to this one.
Let me know if this helps you.
Best Regards,
Alexis Andalon
My device uses Deep Sleep mode. Therefore, according to Reset.3 Errata Sheet, I check the value in PD0_SLEEP0_MODE before initializing the peripherals. Since Errata Sheet does not indicate which configuration must be performed before checking PD0_SLEEP0_MODE, I only completed the installation of CREG0.Hello Alexis,
Best Regards,
Alex Humeniuk
Hello Alex,
Do you have some problem using the ResetHandler found in the LPCOpen?
Best Regards,
Alexis Andalon
Hello Alexis,
My test differs from the example in LPCOpen by the lack of a clocking setting. Why can't I use the default clocking settings when checking the Reset.3 problem.
Best Regards,
Alex Humeniuk