summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroland <roland@van-straten.org>2018-12-27 18:04:00 +0100
committerDamien George <damien.p.george@gmail.com>2018-12-30 01:11:25 +1100
commit4d8504425a1b43a9b90a9a3b7a596e919b8cdb67 (patch)
tree61403fdfc8d13b8d47daa915ada32b2e43a63282
parentf334816df0b20f1d77973ebd98342c681b1b8bf5 (diff)
stm32/modmachine: Fix reset_cause to correctly give DEEPSLEEP on L4 MCU.
Before this fix it returned SOFT_RESET after waking from a deepsleep (standby).
-rw-r--r--ports/stm32/modmachine.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 7c8104b13..06c07812c 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -105,6 +105,12 @@ void machine_init(void) {
reset_cause = PYB_RESET_DEEPSLEEP;
PWR->CPUCR |= PWR_CPUCR_CSSF;
} else
+ #elif defined(STM32L4)
+ if (PWR->SR1 & PWR_SR1_SBF) {
+ // came out of standby
+ reset_cause = PYB_RESET_DEEPSLEEP;
+ PWR->SCR |= PWR_SCR_CSBF;
+ } else
#endif
{
// get reset cause from RCC flags