work around silicon erratum in SUPC/VREG

This commit is contained in:
Alex Maestas 2023-12-17 17:40:19 +00:00
parent 89e86fe629
commit 68f3865227

View file

@ -35,6 +35,10 @@ void _watch_init(void) {
// Use switching regulator for lower power consumption. // Use switching regulator for lower power consumption.
SUPC->VREG.bit.SEL = 1; SUPC->VREG.bit.SEL = 1;
// work around a silicon erratum that causes the microcontroller to lock up on leaving standby:
// request that the voltage regulator run in standby, and also that it switch to PL0.
SUPC->VREG.bit.RUNSTDBY = 1;
SUPC->VREG.bit.STDBYPL0 = 1;
while(!SUPC->STATUS.bit.VREGRDY); // wait for voltage regulator to become ready while(!SUPC->STATUS.bit.VREGRDY); // wait for voltage regulator to become ready
// check the battery voltage... // check the battery voltage...