summaryrefslogtreecommitdiff
path: root/chip/stm32/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/system.c')
-rw-r--r--chip/stm32/system.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index 7e0c0acb0c..e89c024d12 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -7,6 +7,7 @@
#include "console.h"
#include "cpu.h"
+#include "gpio.h"
#include "registers.h"
#include "system.h"
#include "task.h"
@@ -111,6 +112,14 @@ static void check_reset_cause(void)
/* Hibernated and subsequently awakened */
flags |= RESET_FLAG_HIBERNATE;
+ if (pwr_status & 0x00000001) {
+ flags |= RESET_FLAG_WAKE_PIN;
+
+ if (gpio_get_level(GPIO_BCHGR_VACG) == 0)
+ /* WKUP=1 but not waken by WKUP pin. Must be RTC. */
+ flags |= RESET_FLAG_RTC_ALARM;
+ }
+
if (!flags && (raw_cause & 0xfe000000))
flags |= RESET_FLAG_OTHER;