Merge pull request #424 from BlackBrix-Editor/16MHz-crystal-option

Added support inside the Core, for boards which have a 16Mhz crystal using '#define XTAL16M'. Note, no variants or boards.txt changes have been added to use this feature,
This commit is contained in:
Roger Clark 2018-01-21 14:43:40 +11:00 committed by GitHub
commit e01a70b040
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))