From 4969ced52de186af99d5a15db1bc38233ca4a3e1 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 15 Jan 2025 17:40:42 +0100 Subject: [PATCH] fix(h7): missing regulator state in STOP mode Fixes #117. Signed-off-by: Frederic Pillon --- src/low_power.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/low_power.c b/src/low_power.c index fd422c1..2ca0b60 100644 --- a/src/low_power.c +++ b/src/low_power.c @@ -495,8 +495,17 @@ void LowPower_stop(serial_t *obj) // STM32L4+ must keep SRAM3 content when entering STOP2 lowpower mode HAL_PWREx_EnableSRAM3ContentRetention(); #endif /* PWR_CR1_RRSTP */ - // STM32L4xx supports STOP2 mode which halves consumption + // STM32L4xx and STM32H7xx supports STOP2 mode which halves consumption +#if defined(STM32H7xx) +#if defined(PWR_LOWPOWERREGULATOR_ON) + HAL_PWREx_EnterSTOP2Mode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); +#else + HAL_PWREx_EnterSTOP2Mode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI); +#endif + HAL_PWREx_EnterSTOP2Mode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); +#else HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI); +#endif } else #endif {