2017-03-27 10:30 AM
Dear All. I'm using STM32F051 with 12 MHz crystal. but my serial communication ran 1.5X faster then i set.I think i need to configure HSE. i have editted -> #define HSE_VALUE ((uint32_t)12000000) but still doesn't work.
2017-03-27 12:20 PM
Perhaps in the wrong place? In Keil I'd try mousing over the use of HSE_VALUE in system_stm32f0xx.c and stm32f0xx_rcc.c
2017-03-27 02:30 PM
as your advice, i am looking at system_stm32f0xx.c and found
/* PLL configuration = HSE * 6 = 48 MHz */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL6);i see, HSE multiplied by 6
than i try to change it to ......| RCC_CFGR_PLLMULL4); and now it works fine.
curiously, i try write HSE at stm32f0xx.h back to 8000000, but it still works. maybe because i have set xtal at option for target 'target1' as 12 MHz.
thank you, clive one.
2017-03-27 04:33 PM
HSE_VALUE tends to be critical when selecting USART baud rates, it is used with the RCC clocks, and decoded PLL settings, to compute the APBx speeds
The PLL settings are more like gears, as long as the ratios are right the clocks will run how you set them regardless of HSE_VALUE