]> git.earman.xyz Git - sensor-watch.git/commitdiff
work around silicon erratum in SUPC/VREG
authorAlex Maestas <git@se30.xyz>
Sun, 17 Dec 2023 17:40:19 +0000 (17:40 +0000)
committerAlex Maestas <git@se30.xyz>
Sun, 17 Dec 2023 17:40:19 +0000 (17:40 +0000)
watch-library/hardware/watch/watch_private.c

index 4cae3ccbb06abd0d58bd71496265d8975e1dde8e..20f4ee5409b3ce748c7fa0f96a9408d4567a6875 100644 (file)
@@ -35,6 +35,10 @@ void _watch_init(void) {
 
     // Use switching regulator for lower power consumption.
     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
 
     // check the battery voltage...