8 years, 8 months ago.

Getting system clock results in 96000000Hz for a 48Mhz IC?

Hi,

I'm trying to just do some diagnostics and confirm what speed the internal clock is running at on my ST Nucleo F070RB.

I added a line of code which outputs the clockspeed but it reports back at 96000000Hz or 96Mhz but is incorrect. (It's a 48Mhz CPU).

I was wondering as to why this is and how to find out the actual speed the board is running at. (I've removed the 8Mhz clock so I know it's not using that).

Thanks - Ryan Walmsley

1 Answer

8 years, 8 months ago.

Print SystemCoreClock. To be sure you can call SystemCoreClockUpdate() first, but it should be correct without that.

Hi Erik,

The 96Mhz output was from printing the System Core Clock.

I've added the command you've suggested before printing this and got the same output.

posted by Ryan Walmsley 11 Mar 2016

Actually strangely enough when I test another one of the same boards I'm getting 48MHz....

posted by Ryan Walmsley 11 Mar 2016

Hi Erik,

Can you help on advising on how to set the core clock speed using the internal clock?

posted by Ryan Walmsley 12 Mar 2016

The Nucleo ones automatically switch to internal clock when there isn't an external one. Maybe thats a difference between your two boards? That one has internal and other one external clock? Although of course it still should not give 96MHz clock speed.

posted by Erik - 12 Mar 2016

Yeah it does seem to switch as it *works* but after about a minute of running the program crashes.

It seems to be that the internal clock isn't running at the speed it should but I can't figure out how to set the frequency manually.

posted by Ryan Walmsley 12 Mar 2016

You can always change the clock registers after boot. Or remove your mbed lib, import mbed-dev, go to targets/cmsis/stm/your target, and there is a system.c file which does the clock setup.

posted by Erik - 13 Mar 2016