Skip to content

Conversation

@FRASTM
Copy link
Contributor

@FRASTM FRASTM commented Jan 29, 2020

This patch enables the main regulator boost voltage for sys clock highest frequency.

For STM32G4xx series, boost mode when sys clock is higher than 150MHz
For STM32L4Rx or STM32L4Sx series, boost mode when sys clock is higher than 80MHz

Fixes #22245

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

@FRASTM FRASTM requested a review from erwango as a code owner January 29, 2020 15:00
@zephyrbot
Copy link

zephyrbot commented Jan 29, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@FRASTM FRASTM force-pushed the issue-22245 branch 2 times, most recently from 1023ea9 to 2992246 Compare January 29, 2020 15:21
@erwango erwango added the platform: STM32 ST Micro STM32 label Jan 29, 2020
@FRASTM FRASTM force-pushed the issue-22245 branch 2 times, most recently from b6fa354 to cec6c13 Compare January 30, 2020 14:03
@FRASTM
Copy link
Contributor Author

FRASTM commented Jan 30, 2020

power boost does not impact clock control but only valid for stm32g4.

@rosterloh
Copy link
Contributor

Not sure if this is helpful to this issue but I needed to change stm32g4xx_ll_utils.c in the stm32 hal in order to get the correct baud rate.
status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
Needs to be added to line 335. After AHBCLK divider is set back to 1 the system clock variable is not updated so while it's running at the correct speed the functions the request the clock value are returning half the actual value.

@FRASTM FRASTM force-pushed the issue-22245 branch 2 times, most recently from 239215c to cec6c13 Compare January 31, 2020 13:21
@martinjaeger
Copy link
Member

So this PR attempts to fix also #21681, which was not mentioned yet.

I agree with @rosterloh that there is a bug in the STM LL driver, see also his PR. I think that's the root cause of the wrong UART baud rate. As far as I could see, the MCU actually runs at the specified speed, but only SystemCoreClock variable is set wrong in LL drivers. Did quite a lot of debugging looking at the actual register contents.

@FRASTM
Copy link
Contributor Author

FRASTM commented Feb 3, 2020

stm32g4xx: set power boost mode for sys clock greater than 150MHz

@erwango erwango changed the title STM32G4xx: Wrong SystemCoreClock variable STM32G4xx: boost voltage when clock exceeds 150MHz Feb 5, 2020
@erwango erwango requested a review from galak February 5, 2020 12:26
@FRASTM FRASTM changed the title STM32G4xx: boost voltage when clock exceeds 150MHz STM32G4x/STM32L4Rx/STM32L4Sx: boost voltage for highest clock frequencies Feb 5, 2020
@erwango erwango added the bug The issue is a bug, or the PR is fixing a bug label Feb 5, 2020
@erwango erwango changed the title STM32G4x/STM32L4Rx/STM32L4Sx: boost voltage for highest clock frequencies STM32G4x/STM32L4Rx/STM32L4Sx: Fix sys clock frequency and boost voltage for highest clock frequencies Feb 5, 2020
@galak galak added the DNM This PR should not be merged (Do Not Merge) label Feb 5, 2020
@erwango erwango self-requested a review February 12, 2020 10:46
@FRASTM
Copy link
Contributor Author

FRASTM commented Feb 12, 2020

updating west.yml after merge of the zephyrproject-rtos/hal_stm32#37

@erwango erwango removed the DNM This PR should not be merged (Do Not Merge) label Feb 12, 2020
@erwango erwango requested a review from ioannisg February 25, 2020 13:13
Copy link
Member

@MaureenHelm MaureenHelm 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 the PR summary to include which issues it fixes. i.e., "Fixes #NNNN"

Copy link
Member

Choose a reason for hiding this comment

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

MHZ(150) would be easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to MHZ(150)

Copy link
Member

Choose a reason for hiding this comment

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

MHZ(80)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to MHZ(80)

This patch activates the boost mode for the main regulator
when the system frequency above 150MHz for stm32g4xx soc series.
To save power, the boost mode should be disabled below 150MHz.

Signed-off-by: Francois Ramu <[email protected]>
This patch activates the boost mode for the main regulator
when the system frequency above 80MHz for stm32l4Rx/stm32l4Sx
soc series.
To save power, the boost mode should be disabled below 80MHz.

Signed-off-by: Francois Ramu <[email protected]>
This updates the stm32cube drivers to fix the issue on sysclock

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Contributor Author

FRASTM commented Feb 26, 2020

change to MHZ(xxx)
and describe PR : Fixes #22245

@erwango erwango requested a review from MaureenHelm February 26, 2020 16:19
@MaureenHelm MaureenHelm merged commit ff072bc into zephyrproject-rtos:master Feb 26, 2020
@FRASTM FRASTM deleted the issue-22245 branch March 30, 2022 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards area: Modules area: Timer Timer bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STM32G4xx: Wrong SystemCoreClock variable

7 participants