Lib to switch the clock speed of the ST Nucleo to 84MHz. The internal RC oscillator is multiplied with the PLL.
Dependents: Nucleo_spi_master_20MHz Nucleo_vs_Arduino_Speed_Test DMA_I2S_Test MPU9150AHRS ... more
Not needed with actual mbed lib
You don't need this lib to speed up the cpu clock. The actual mbed lib is using 84 MHz cpu speed out of the box.
The ST Nucleo board is running on 16 MHz out of the box. To speed up the cpu to the maximum speed we have to change the clock setting. Simply add
#include "ST_F401_84MHZ.h" F401_init84 myinit(0);
in front of your program. This should be the first line in main to ensure the frequency is changed before other objects are initialised.
This frequency is generated out of the internal RC oscillator. The frequency is not so stable like a crystal ! My board is fluctuate +- 40KHz at 84MHz at room temperature.
If you need a more precise timing source, you have to add a external crystal.
You need : X3 8MHz crystal , C33 and C34 18pF 0603 , R35 and R37 0R 0603 or you can simply use wire to short this two resistor pads. A call of SystemClock_Config_84MHz_external(); will config the pll to generate 84MHz out of the 8MHz crystal oscillator.
Add
#include "ST_F401_84MHZ.h" F401_init84 myinit(1);
in front of your code to use the external 8MHz crystal.
If you want to use a different crystal or frequency : the STM32CubeMX tool is your friend :-)
external crystal value
The mbed lib is using HSE_VALUE defined in the file stm32f4xx_hal_config.h to calculate SystemCoreClock, which is used for all timings : baudrate or wait() ...
This value is the frequency of the external crystal.
It is defined to 25MHz at the moment I have asked to change it to 8MHz default.
You can set the variable SystemCoreClock to 84000000 to patch this .
If you use the internal oscillator the calculated value is ok
The value was changed to 8 MHz.
History
DeInit PLL before setting new parameter
2014-04-08, by dreschpe [Tue, 08 Apr 2014 20:00:49 +0000] rev 6
DeInit PLL before setting new parameter
- change from function to c++ object to ensure early startup ; - add docu
2014-03-08, by dreschpe [Sat, 08 Mar 2014 15:03:38 +0000] rev 5
- change from function to c++ object to ensure early startup ; - add docu
docu
2014-03-07, by dreschpe [Fri, 07 Mar 2014 21:23:07 +0000] rev 4
docu
call SystemCoreClockUpdate() to correct timing functions
2014-03-07, by dreschpe [Fri, 07 Mar 2014 20:21:31 +0000] rev 3
call SystemCoreClockUpdate() to correct timing functions
Add external crystal X3 mode
2014-03-05, by dreschpe [Wed, 05 Mar 2014 22:19:14 +0000] rev 2
Add external crystal X3 mode
Lib to change the clock speed of the ST Nucleo F401 to 84 MHz
2014-03-05, by dreschpe [Wed, 05 Mar 2014 19:53:14 +0000] rev 1
Lib to change the clock speed of the ST Nucleo F401 to 84 MHz
Rev 1.0
2014-03-05, by dreschpe [Wed, 05 Mar 2014 19:38:06 +0000] rev 0
Rev 1.0