Add support for boards with 16MHz HSE crystal. Note to use this feature users must add -D XTAL16M to the appropriate build options in boards.txt, as there are too few boards with 16MHz crystals to warrant adding this as a separate menu to each board in boards.txt

This commit is contained in:
Roger Clark 2018-04-13 16:32:56 +10:00
parent 083e98801d
commit 4f691b9eeb
1 changed files with 6 additions and 0 deletions

View File

@ -134,6 +134,12 @@ void rcc_configure_pll(rcc_pll_cfg *pll_cfg) {
cfgr &= ~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL);
cfgr |= pll_cfg->pllsrc | pll_mul;
#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
cfgr |= RCC_CFGR_PLLXTPRE;
#endif
RCC_BASE->CFGR = cfgr;
}