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@1:aa61af968c8a, 2014-03-05 (annotated)
- Committer:
- dreschpe
- Date:
- Wed Mar 05 21:41:36 2014 +0000
- Revision:
- 1:aa61af968c8a
- Parent:
- 0:21b36798fd00
- Child:
- 2:d53a7002da28
Test for 84MHz cpu speed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:21b36798fd00 | 1 | #include "mbed.h" |
dreschpe | 1:aa61af968c8a | 2 | #include "stm32f4xx_hal.h" |
dreschpe | 1:aa61af968c8a | 3 | #include "ST_F401_84MHZ.h" |
bcostm | 0:21b36798fd00 | 4 | |
bcostm | 0:21b36798fd00 | 5 | SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); |
bcostm | 0:21b36798fd00 | 6 | |
bcostm | 0:21b36798fd00 | 7 | int main() { |
bcostm | 0:21b36798fd00 | 8 | int i = 0; |
dreschpe | 1:aa61af968c8a | 9 | SystemClock_Config_84MHz_internal(); // speed up to 84 MHz |
dreschpe | 1:aa61af968c8a | 10 | HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1); // output SYSCLOCK to pin PC9 to monitor frequency |
dreschpe | 1:aa61af968c8a | 11 | device.format(8,0); |
dreschpe | 1:aa61af968c8a | 12 | device.frequency(20000000); // 20 MHz SPI Clock to test the clock setting |
dreschpe | 1:aa61af968c8a | 13 | |
bcostm | 0:21b36798fd00 | 14 | while(1) { |
bcostm | 0:21b36798fd00 | 15 | device.write(0x55); |
bcostm | 0:21b36798fd00 | 16 | device.write(i++); |
bcostm | 0:21b36798fd00 | 17 | device.write(0xE0); |
bcostm | 0:21b36798fd00 | 18 | wait_us(50); |
bcostm | 0:21b36798fd00 | 19 | } |
bcostm | 0:21b36798fd00 | 20 | } |
bcostm | 0:21b36798fd00 | 21 |