This program:
- Starts the high-speed external oscillator (HSE).
- Configures the PLL source and multiplier.
- Connects the SYSCLK to the PLL.
- Configures the AHB prescaler.
- Enables the LED port.
- Configures the LED pin as a digital output.
- Stops the high-speed internal oscillator (HSI).
- Toggles the LED in an infinite loop.
- main.c
#include BOARD_H
#define SYSHZ (36*1000*1000) // Desired frequency for the SYSCLK signal
#define AHBHZ (9*1000*1000) // Desired frequency for the core (and systick)
#define PERIOD 0.5 // Blinking period
int main ( )
{
input, hse/2,
hwa( connect, sysclk, pll );
while ( !
hw(stat,pll).ready ) {}
hwa( clock, ahb, sysclk / (SYSHZ/AHBHZ) );
mode, digital_output,
frequency, lowest );
while (
hw(stat,hsi).ready ) {}
for(;;) {
}
}