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.

main.cpp

Committer:
dreschpe
Date:
2014-03-05
Revision:
2:d53a7002da28
Parent:
1:aa61af968c8a

File content as of revision 2:d53a7002da28:

#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++);
        device.write(0xE0);
        wait_us(50);
    } 
}