Skip to content

Conversation

@FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Jan 7, 2020

When configuring the PLL > 80MHz, an intermediate step is needed
with AHB prescaler set to 2 before setting the actual value.
In case the actual value is AHB prescaler 1, it must be set, though.

This will fix zephyrproject-rtos/zephyr#21715

Signed-off-by: Francois Ramu [email protected]

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update patch list section in package readme file.
Also please provide ST internal tracking number

@FRASTM FRASTM changed the title stm32cube: stm32g431: wrong clock setup stm32cube: stm32g4xx: wrong clock setup Jan 7, 2020
@FRASTM
Copy link
Collaborator Author

FRASTM commented Jan 7, 2020

stm32cube/stm32g4xx/README file updated

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]>
@erwango erwango added DNM and removed DNM labels Jan 9, 2020
@erwango erwango requested review from galak and jhedberg January 10, 2020 12:58
@jhedberg jhedberg merged commit 566f4eb into zephyrproject-rtos:master Jan 10, 2020
@martinjaeger
Copy link
Member

Just found that this PR fixed the LED blinky issue, but causes a wrong setting of SysCoreClock variable (75 MHz instead of actual 150 MHz frequency for the Nucleo STM32G431). This leads to wrong UART baud rate settings (that's how we discovered it) and possibly other issues...

In case of PLL frequency >80 MHz, the following call

status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);

sets also SysCoreClock to hclk, which is the preliminary lower AHB frequency, pllfreq / 2:

LL_SetSystemCoreClock(hclk_frequency);

However, the call

LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider);

afterwards only sets the AHB prescaler to final value, but does not update the SysCoreClock anymore.

@FRASTM can you please have a look? Thanks!

Can we try to get this fixed before Zephyr release 2.2 merge window closes? Otherwise the STM32G4 is hardly useable.

(posting here, as I can't open an issue in this repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nucleo_g431rb: Blinky too slow / wrong clock setup?

4 participants