option XTAL16M for boards with 16MHz-crystal

tested on STM32F103VE only but surely can be used on other STM32F103xC, STM32F103xD, STM32F103xE with the same clock PLL structure
This commit is contained in:
BlackBrix-Editor 2018-01-09 11:23:16 +01:00 committed by GitHub
parent 98fdd47203
commit 8540c6b08b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -130,6 +130,12 @@ static void setup_clocks(void) {
wirish::priv::board_setup_clock_prescalers();
rcc_configure_pll(&wirish::priv::w_board_pll_cfg);
#ifdef XTAL16M
// 16MHz crystal (HSE)
// in this case we additionally set the Bit 17 (PLLXTPRE=1) => then HSE clock is divided by 2 before PLL entry
RCC_BASE->CFGR |= RCC_CFGR_PLLXTPRE;
#endif
// Enable the PLL, and wait until it's ready.
rcc_turn_on_clk(RCC_CLK_PLL);
while(!rcc_is_clk_ready(RCC_CLK_PLL))