Skip to content

Commit 8c3c4de

Browse files
committed
drivers: clock_control: fix PLL input frequency
Updated the PLL input frequency calculation to include division by the HSI clock divider. Enable HSI divider using LL_RCC_HSI_EnableDivider(). Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
1 parent 3ce9f14 commit 8c3c4de

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/clock_control/clock_stm32_ll_common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,13 @@ static void set_up_fixed_clock_sources(void)
662662
}
663663
}
664664
#if STM32_HSI_DIV_ENABLED
665+
#if defined(CONFIG_SOC_SERIES_STM32L0X)
666+
if (LL_RCC_IsActiveFlag_HSIDIV()) {
667+
LL_RCC_HSI_EnableDivider();
668+
}
669+
#else
665670
LL_RCC_SetHSIDiv(hsi_divider(STM32_HSI_DIVISOR));
671+
#endif
666672
#endif
667673
}
668674

drivers/clock_control/clock_stm32l0_l1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ __unused
4949
uint32_t get_pllsrc_frequency(void)
5050
{
5151
if (IS_ENABLED(STM32_PLL_SRC_HSI)) {
52-
return STM32_HSI_FREQ;
52+
return ((STM32_HSI_FREQ) / (STM32_HSI_DIVISOR));
5353
} else if (IS_ENABLED(STM32_PLL_SRC_HSE)) {
5454
return STM32_HSE_FREQ;
5555
}

0 commit comments

Comments
 (0)