Skip to content

Commit c552f10

Browse files
committed
stm32cube: stm32g431: wrong clock setup
When configuring the PLL > 80MHz, an intermediate step is needed with AHB prescaler set to 2 before setting the actual value. Then the AHB prescaler 1 must be set, though Signed-off-by: Francois Ramu <[email protected]>
1 parent 99d01ff commit c552f10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stm32cube/stm32g4xx/drivers/src/stm32g4xx_ll_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitS
325325
status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
326326

327327
/* Apply definitive AHB prescaler value if necessary */
328-
if((status == SUCCESS) && (hpre != 0U))
328+
if((status == SUCCESS) && (hpre == LL_RCC_SYSCLK_DIV_1))
329329
{
330330
UTILS_ClkInitStruct->AHBCLKDivider = LL_RCC_SYSCLK_DIV_1;
331331
LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider);
@@ -416,7 +416,7 @@ ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypa
416416
status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
417417

418418
/* Apply definitive AHB prescaler value if necessary */
419-
if((status == SUCCESS) && (hpre != 0U))
419+
if((status == SUCCESS) && (hpre == LL_RCC_SYSCLK_DIV_1))
420420
{
421421
UTILS_ClkInitStruct->AHBCLKDivider = LL_RCC_SYSCLK_DIV_1;
422422
LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider);

0 commit comments

Comments
 (0)