Hello,
I've just tried out the library and if i follow the clock and pll setup
recommended by ST the controller hangs in the
rcc_wait_for_osc_ready(HSI). This is caused by an wrong comparation in
this function.
I've attached a patch so that just now also the following for external
oscillators will work:
void clock_setup(void)
{
/* enable Internal High Speed Oscillator */
rcc_osc_on(HSI);
rcc_wait_for_osc_ready(HSI);
rcc_set_sysclk_source(SW_SYSCLKSEL_HSICLK);
/* enable External High Speed Oscillator */
rcc_osc_on(HSE);
rcc_wait_for_osc_ready(HSE);
rcc_set_sysclk_source(SW_SYSCLKSEL_HSECLK);
/* Set the PLL multiplication factor to 4. -> 4*16 = 64MHz */
rcc_set_pll_multiplication_factor(PLLMUL_PLL_CLK_MUL4);
/* Select HSI/2 as PLL source. */
rcc_set_pll_source(PLLSRC_HSE_CLK);
rcc_set_pllxtpre(PLLXTPRE_HSE_CLK_DIV2);
/* Enable PLL oscillator and wait for it to stabilize. */
rcc_osc_on(PLL);
rcc_wait_for_osc_ready(PLL);
/* Select PLL as SYSCLK source. */
rcc_set_sysclk_source(SW_SYSCLKSEL_PLLCLK);
}
|