![](/media/cache/profiles/fe04e05fbe48920b8ba90bea2ddfe60b.50x50_q85.jpg)
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@2:d53a7002da28, 2014-03-05 (annotated)
- Committer:
- dreschpe
- Date:
- Wed Mar 05 21:44:00 2014 +0000
- Revision:
- 2:d53a7002da28
- Parent:
- 1:aa61af968c8a
typo
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); |
dreschpe | 2:d53a7002da28 | 19 | } |
bcostm | 0:21b36798fd00 | 20 | } |
bcostm | 0:21b36798fd00 | 21 |