#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);
}