Skip to main content
MHast.1
Associate II
August 23, 2023
Solved

STM32 clock switching, systick

Hello, I have a simple question: What is the way to update the SysTick configuration after changing the clocks at runtime? I am switching SYSCLK between two modes:

1) RUN mode: HSE 32 MHZ

2) LPRUN mode: MSI 2 MHZ

After changing to (2), the HAL_GetTick() function is running slow and needs reconfiguring. Using STM32WB

This topic has been closed for replies.
TDK
TDKBest answer
August 23, 2023

If you call HAL_RCC_ClockConfig, it is updated automatically.

If you update the clock some other way, you will need to update SystemCoreClock and call HAL_InitTick after the clock has changed.

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer
August 23, 2023

If you call HAL_RCC_ClockConfig, it is updated automatically.

If you update the clock some other way, you will need to update SystemCoreClock and call HAL_InitTick after the clock has changed.

"If you feel a post has answered your question, please click ""Accept as Solution""."