Test program to show cpu running at 84MHz

Dependencies:   ST_401_84MHZ mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "stm32f4xx_hal.h" 
00003 #include "ST_F401_84MHZ.h"
00004  
00005 SPI device(SPI_MOSI, SPI_MISO, SPI_SCK);
00006  
00007 int main() {
00008     int i = 0;
00009     SystemClock_Config_84MHz_internal();                                     // speed up to 84 MHz
00010     HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1);        // output SYSCLOCK to pin PC9 to monitor frequency
00011     device.format(8,0); 
00012     device.frequency(20000000);     // 20 MHz SPI Clock to test the clock setting
00013 
00014     while(1) {
00015         device.write(0x55);
00016         device.write(i++);
00017         device.write(0xE0);
00018         wait_us(50);
00019     } 
00020 }
00021