Test program to show cpu running at 84MHz
Dependencies: ST_401_84MHZ mbed
Speed up the CPU to 84MHz to get a SPI clock of 20MHz.
Diff: main.cpp
- Revision:
- 1:aa61af968c8a
- Parent:
- 0:21b36798fd00
- Child:
- 2:d53a7002da28
diff -r 21b36798fd00 -r aa61af968c8a main.cpp --- a/main.cpp Fri Feb 21 12:38:59 2014 +0000 +++ b/main.cpp Wed Mar 05 21:41:36 2014 +0000 @@ -1,9 +1,16 @@ #include "mbed.h" +#include "stm32f4xx_hal.h" +#include "ST_F401_84MHZ.h" SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); int main() { int i = 0; + SystemClock_Config_84MHz_internal(); // speed up to 84 MHz + HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1); // output SYSCLOCK to pin PC9 to monitor frequency + device.format(8,0); + device.frequency(20000000); // 20 MHz SPI Clock to test the clock setting + while(1) { device.write(0x55); device.write(i++);