Skip to content

Commit 43fbe8e

Browse files
author
Marti Bolivar
committed
[LTD toup] clock_control: stm32: fix a PLL init corner case
Commit 58c8d15 ("clock control:stm32: provide STM32Cube LL based driver") added PLL initialization which disables the PLL before configuring it. This works if the system clock source is not the PLL (which is the usual case for Zephyr booting out of chip reset). However, if the SYSCLK source *is* the PLL, this halts execution. To support this use case, switch the SYSCLK source to the always-present HSI before disabling the PLL. Signed-off-by: Marti Bolivar <[email protected]>
1 parent 6a59a94 commit 43fbe8e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/clock_control/stm32_ll_clock.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,14 @@ static int stm32_clock_control_init(struct device *dev)
190190
/* configure PLL input settings */
191191
config_pll_init(&s_PLLInitStruct);
192192

193-
/* Disable PLL before configuration */
193+
/*
194+
* Switch to HSI and disable the PLL before configuration.
195+
*
196+
* Don't use s_ClkInitStruct.AHBCLKDivider as the AHB
197+
* prescaler here. In this configuration, that's the value to
198+
* use when the SYSCLK source is the PLL, not HSI.
199+
*/
200+
stm32_clock_switch_to_hsi(LL_RCC_SYSCLK_DIV_1);
194201
LL_RCC_PLL_Disable();
195202

196203
#ifdef CONFIG_CLOCK_STM32_PLL_Q_DIVISOR

0 commit comments

Comments
 (0)