diff --git a/drivers/clock_control/Kconfig.stm32 b/drivers/clock_control/Kconfig.stm32 index 759cff710ee..45ee2150a21 100644 --- a/drivers/clock_control/Kconfig.stm32 +++ b/drivers/clock_control/Kconfig.stm32 @@ -65,7 +65,7 @@ config CLOCK_STM32_HSE_CLOCK config CLOCK_STM32_MSI_RANGE int "MSI frequency range" - depends on CLOCK_STM32_SYSCLK_SRC_MSI + depends on CLOCK_STM32_SYSCLK_SRC_MSI || CLOCK_STM32_PLL_SRC_MSI default 8 help Frequency range of MSI when MSI range is provided in RCC_CR register diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index 0817bff1cef..79bdf187368 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -329,6 +329,12 @@ static int stm32_clock_control_init(struct device *dev) #ifdef CONFIG_CLOCK_STM32_PLL_SRC_MSI + /* Set MSI Range */ + LL_RCC_MSI_EnableRangeSelection(); + LL_RCC_MSI_SetRange(CONFIG_CLOCK_STM32_MSI_RANGE + << RCC_CR_MSIRANGE_Pos); + LL_RCC_MSI_SetCalibTrimming(0); + #ifdef CONFIG_CLOCK_STM32_MSI_PLL_MODE /* Enable MSI hardware auto calibration */ LL_RCC_MSI_EnablePLLMode();