cancel
Showing results for 
Search instead for 
Did you mean: 

register to get the core clock

ouled
Associate
Posted on April 23, 2016 at 16:11

Hello everyone,

i have a big question, i want to know if there is a register to read on the STM32 board to get the core clock value.

there is a command executed from the debugging to get this value wich is SYStem.CLOCK .

So please some help!

thank you and best regards.

#stm32
3 REPLIES 3
mark239955_stm1
Associate II
Posted on April 24, 2016 at 03:12

No, there's no hardware register with that information; the MCU hardware doesn't know how fast it's external clock signal is, it only knows what scaling factor it has applied to that clock.

If the firmware knows how what the clock is then it can store that information.  ST's firmware libraries do this with SystemCoreClock, or whatever they're calling it now.

Posted on April 24, 2016 at 03:37

The forum is really flaky today..

The settings are usually spread across several RCC registers, depending on the STM32 in question, review the Reference Manual.

You have to decode the clock sources, and PLL settings, etc. The SPL has an RCC_GetClocksFreq() type API function to do a decode. The project needs to provide a define for HSE_VALUE that reflects the external clock source on a specific design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
re.wolff9
Senior
Posted on April 24, 2016 at 08:24

On the other hand, the boot firmware figures out the external clock based on the assumption that it's an integer multiple of 1MHz.