Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

Speed up the board to 84MHz

05 Mar 2014
26 Mar 2014

You can access the 8 MHz crystal of the ST-LINK portion of the Nucleo card via the MCO signal, and by making the SB50 solder bridge under the STM32F401, and SB16 on the ST-LINK end.

You should use the BYPASS mode for HSE, as it's a square wave, and doesn't need the oscillator function (inverter to HSE_OUT) to be functioning.

29 Apr 2014

Have a look at build 83 for mbed core: it includes some corrections for clocks :)

29 Apr 2014

Peter, you say I need to change the clock speed prior to initializing other objects. So I can not change the clock speed dynamically?

09 May 2014

If you change the clock speed dynamically, you have to look for peripherals using this clock. If you look in the datasheet , there are different ways to supply. The actual mbed lib is using the PLL to generate a 84MHz clock for the CPU. This clock is also used for peripherals. If you want the use a dynamic CPU speed you have to change the divider for the peripherals or you use a different clock source for the peripherals, which is static. (The baudrate divider are calculated at the time you create the object) Different clocks are possible, but not supported by the mbed libs.

09 May 2014

Thanks for the clarification. This is very helpful.

06 Jun 2014

What's the current status of this issue? I've got an F103 on the way and would like to know what clock speed I can expect out of the box.

06 Jun 2014

I don't know exactly which frequency it runs on, but this should be fixed. Quickly looking at source code I think it runs at 72MHz when an external clock is available (either with crystal which isn't populated by default afaik, or an 8MHz clock from the debugger part), otherwise at 64MHz from internal oscillator (dunno why there is a difference).

But when you get it simply get latest mbed library, get serial via usb running, and print the value of SystemCoreClock.

06 Jun 2014

Thanks so much for the quick reply. I'll let you know the result on Monday when the hardware arrives.

07 Jun 2014

I confirmed that SystemCoreClock shows 84MHz with the mbed version 84.

10 Jun 2014

The F103RB, it reports a 64Mhz core clock without external xtal installed. Now to get ethernet working. Time to dig back in to Wiznet drivers.

27 Jun 2014

Hi Peter,

I am running at 84 MHz with the STM32F401 Nucleo board "out-of-the-box". Maybe the mbed library default has been changed to set the clock automagically. I tried your internal clock setting library which "worked" but didn't make any change since I was already at 84 MHz. My question to you, is there an easy way to set the clock speed using the internal source PLL using you library? Or do I have to use STMCubeMX and figure out all of the internal register settings to run at, say 48 MHz, for example?

27 Jun 2014

I can answer my own question. I changed the M component in your library to 32 from 16 and was able to run the STM32F401 at 42 MHz. But the clock speeds are complicated and it's not so simple as just scaling this one parameter, since there are various constraints on the many different clock speeds required by the STM32F401s various processes. So the best thing to do is use the STM32CubeMX tool to find out how to configure the M, N, O, and P scalars to get the speed I want. Then I can set these scalars in Peter's library, or add some function to achieve particular system clock speeds. This can be very useful for timing studies against other processors running at other (not 84 MHz) speeds.

27 Jun 2014

32 for M is a little problematic, ST recommends you put the PLL comparison frequency at between 1 and 2 MHz

I've just built fitting tools to pick optimal valid settings for M, N, O, P and Q. ST has some pretty sorry clocking configurations, so hitting specific frequencies on timer outputs (256 KHz) can require clocking the chip at slower rates, or using magic crystal values.