Skip to content

Commit 62b3317

Browse files
committed
stm32cube: stm32g4xx: 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 62b3317

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

stm32cube/stm32g4xx/README

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ License Link:
3535
https://opensource.org/licenses/BSD-3-Clause
3636

3737
Patch List:
38-
none
38+
39+
*stm32g4xx: wrong clock setup
40+
In case the actual value is AHB prescaler 1, it must be set,
41+
after setting the AHB prescaler to 2.
42+
Impacted files:
43+
drivers/src/stm32g4xx_ll_utils.c
44+
ST Bug tracker ID: 78880

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)