-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: clock_control: stm32 ll common: fix RCC pll disable #83062
base: main
Are you sure you want to change the base?
drivers: clock_control: stm32 ll common: fix RCC pll disable #83062
Conversation
Hello @bbyers-UBCO, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bbyers-UBCO !
Please fix the compliance issues reported by ci here.
/* Disable PLL */ | ||
LL_RCC_PLL_Disable(); | ||
while (LL_RCC_PLL_IsReady() != 0U) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix indentation (we're using 8 char tabs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Also added the LL_RCC_PLL2_IsReady() check as @FRASTM mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing that
LGTM after formatting the code
Probably that control loop should also apply anywhere a PLL is being disabled by LL_RCC_PLL1_Disable() or LL_RCC_PLL2_Disable() before any access to the PLL config register.
The clock_stm32_ll_common.c function set_up_plls calls LL_RCC_PLL_Disable(); and it was not waiting for the disable to complete before trying to configure the pll sysclock which creates a race condition for pll configuration. The wait for re-enabling the RCC pll is already there, it was just missing the wait for the disable before configuration. Also added the wait for PLL2. Signed-off-by: Benjamin Curtis Byers <[email protected]>
b070786
to
9294bae
Compare
The clock_stm32_ll_common.c function set_up_plls calls LL_RCC_PLL_Disable(); and it was not waiting for the disable to complete before trying to configure the pll sysclock which creates a race condition for pll configuration. The wait for re-enabling the RCC pll is already there, it was just missing the wait for the disable before configuration.