From 3103fc8c3823ff7abb5b973bda2b9fdb8ab70f99 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Mon, 12 Jul 2021 10:49:42 +0200 Subject: [PATCH] soc: arm: stm32l0: set voltage scaling to range1 Default Voltage scaling range selection (range2) doesn't allow to configure Max frequency switch to range1 to match any frequency Signed-off-by: Alexandre Bourdiol --- soc/arm/st_stm32/stm32l0/soc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/soc/arm/st_stm32/stm32l0/soc.c b/soc/arm/st_stm32/stm32l0/soc.c index cfc23ede375..d19c5fc7600 100644 --- a/soc/arm/st_stm32/stm32l0/soc.c +++ b/soc/arm/st_stm32/stm32l0/soc.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include /** * @brief Perform basic hardware initialization at boot. @@ -43,6 +45,13 @@ static int stm32l0_init(const struct device *arg) /* At reset, system core clock is set to 2.1 MHz from MSI */ SystemCoreClock = 2097152; + /* Default Voltage scaling range selection (range2) + * doesn't allow to configure Max frequency + * switch to range1 to match any frequency + */ + LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + return 0; }