Skip to main content
ouled
Visitor II
April 23, 2016
Question

register to get the core clock

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
    This topic has been closed for replies.

    3 replies

    mark239955_stm1
    Visitor II
    April 24, 2016
    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.

    Tesla DeLorean
    Guru
    April 24, 2016
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    re.wolff9
    Senior
    April 24, 2016
    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.