diff --git a/lib/stm32/f2/rcc.c b/lib/stm32/f2/rcc.c index b662cebb..d01dbcc0 100644 --- a/lib/stm32/f2/rcc.c +++ b/lib/stm32/f2/rcc.c @@ -355,6 +355,10 @@ void rcc_clock_setup_hse_3v3(const struct rcc_clock_scale *clock) rcc_set_ppre1(clock->ppre1); rcc_set_ppre2(clock->ppre2); + /* Disable PLL oscillator before changing its configuration. */ + rcc_osc_off(RCC_PLL); + + /* Configure the PLL oscillator. */ rcc_set_main_pll_hse(clock->pllm, clock->plln, clock->pllp, clock->pllq); diff --git a/lib/stm32/f4/rcc.c b/lib/stm32/f4/rcc.c index 5dd775d5..7e3c0da3 100644 --- a/lib/stm32/f4/rcc.c +++ b/lib/stm32/f4/rcc.c @@ -709,6 +709,10 @@ void rcc_clock_setup_hse_3v3(const struct rcc_clock_scale *clock) rcc_set_ppre1(clock->ppre1); rcc_set_ppre2(clock->ppre2); + /* Disable PLL oscillator before changing its configuration. */ + rcc_osc_off(RCC_PLL); + + /* Configure the PLL oscillator. */ rcc_set_main_pll_hse(clock->pllm, clock->plln, clock->pllp, clock->pllq, clock->pllr); diff --git a/lib/stm32/f7/rcc.c b/lib/stm32/f7/rcc.c index ea6dcd50..186109a5 100644 --- a/lib/stm32/f7/rcc.c +++ b/lib/stm32/f7/rcc.c @@ -392,6 +392,10 @@ void rcc_clock_setup_hse(const struct rcc_clock_scale *clock, uint32_t hse_mhz) rcc_set_ppre1(clock->ppre1); rcc_set_ppre2(clock->ppre2); + /* Disable PLL oscillator before changing its configuration. */ + rcc_osc_off(RCC_PLL); + + /* Configure the PLL oscillator. */ rcc_set_main_pll_hse(pllm, clock->plln, clock->pllp, clock->pllq); diff --git a/lib/stm32/l1/rcc.c b/lib/stm32/l1/rcc.c index e9f7bd68..41cf1999 100644 --- a/lib/stm32/l1/rcc.c +++ b/lib/stm32/l1/rcc.c @@ -535,6 +535,10 @@ void rcc_clock_setup_pll(const struct rcc_clock_scale *clock) flash_prefetch_enable(); flash_set_ws(clock->flash_waitstates); + /* Disable PLL oscillator before changing its configuration. */ + rcc_osc_off(RCC_PLL); + + /* Configure the PLL oscillator. */ rcc_set_pll_configuration(clock->pll_source, clock->pll_mul, clock->pll_div);