summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Maestas <git@se30.xyz>2023-12-17 17:40:19 +0000
committerAlex Maestas <git@se30.xyz>2023-12-17 17:40:19 +0000
commit68f38652273bd6356e35dfcec0949f6783009dcf (patch)
tree2373208f5982fddb5a4bae27bfede77571cba046
parent89e86fe6294948df0ca8aade93e9893f317dd5fc (diff)
downloadSensor-Watch-68f38652273bd6356e35dfcec0949f6783009dcf.tar.gz
Sensor-Watch-68f38652273bd6356e35dfcec0949f6783009dcf.tar.bz2
Sensor-Watch-68f38652273bd6356e35dfcec0949f6783009dcf.zip
work around silicon erratum in SUPC/VREG
-rw-r--r--watch-library/hardware/watch/watch_private.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/watch-library/hardware/watch/watch_private.c b/watch-library/hardware/watch/watch_private.c
index 4cae3ccb..20f4ee54 100644
--- a/watch-library/hardware/watch/watch_private.c
+++ b/watch-library/hardware/watch/watch_private.c
@@ -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...