From 1d7ad7dc31b2685bf794eaa2db722bf2a9669f56 Mon Sep 17 00:00:00 2001 From: Oliver Walter Date: Tue, 21 May 2024 22:17:03 +0200 Subject: [PATCH] fixed bug not going to standby correctly --- Application/BSP/BSP_POWER.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Application/BSP/BSP_POWER.c b/Application/BSP/BSP_POWER.c index 907f902..438a73e 100644 --- a/Application/BSP/BSP_POWER.c +++ b/Application/BSP/BSP_POWER.c @@ -52,6 +52,9 @@ void BSP_POWER_WakeUp() { */ void BSP_POWER_EnterStandby() { + // stop the sytem interrupts + __disable_irq(); + // We need to disable all Periperals to minimize parasitic currents HAL_I2C_DeInit(&hi2c1); HAL_I2C_MspDeInit(&hi2c1); @@ -108,6 +111,13 @@ void BSP_POWER_EnterStandby() { /* Enter the Standby mode */ HAL_PWR_EnterSTANDBYMode(); + while (1) + { + // if we are here, something went wrong + NVIC_SystemReset(); + Error_Handler(); + } + } uint32_t sec_without_k15 = 0;