From 4e23cb027f86f5f9f02865fdfc6d9ff60885162b Mon Sep 17 00:00:00 2001 From: liuxinaliang Date: Fri, 3 Jan 2020 11:17:50 +0800 Subject: [PATCH] [bsp][stm32] fixed a bug that caused system crash by changing the run_mode in low power mode Signed-off-by: liuxinaliang --- bsp/stm32/libraries/HAL_Drivers/drv_pm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pm.c index 84ddf6cd41..8f3890474e 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pm.c @@ -95,11 +95,13 @@ static void run(struct rt_pm *pm, uint8_t mode) { case PM_RUN_MODE_HIGH_SPEED: case PM_RUN_MODE_NORMAL_SPEED: + HAL_PWREx_DisableLowPowerRunMode(); SystemClock_80M(); /* Configure the main internal regulator output voltage (Range1 by default)*/ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); break; case PM_RUN_MODE_MEDIUM_SPEED: + HAL_PWREx_DisableLowPowerRunMode(); SystemClock_24M(); /* Configure the main internal regulator output voltage */ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2);