summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/stm32/clock-stm32h7.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/stm32/clock-stm32h7.c b/chip/stm32/clock-stm32h7.c
index 72f904c4ed..696105b4f1 100644
--- a/chip/stm32/clock-stm32h7.c
+++ b/chip/stm32/clock-stm32h7.c
@@ -478,6 +478,15 @@ void __idle(void)
if (DEEP_SLEEP_ALLOWED &&
next_delay > LPTIM_PERIOD_US + STOP_MODE_LATENCY) {
+ /*
+ * Sleep time MUST be smaller than watchdog period.
+ * Otherwise watchdog will wake us from deep sleep
+ * which is not what we want. Please note that this
+ * assert won't fire if we are already part way through
+ * the watchdog period.
+ */
+ ASSERT(next_delay < CONFIG_WATCHDOG_PERIOD_MS * MSEC);
+
/* deep-sleep in STOP mode */
idle_dsleep_cnt++;