2015-06-29 04:28 AM
hello every one
i use stm32f429 micro controller and use external 8mhz oscillator as external clock src. and connect output frq of the oscillator to osc_in pin and osc_out is floating. every thing work correctly i use ltdc , eth , can , ... but i have problem with usart baud rate , it dose not work correctly if i change clock src to hsi (in system_stm32f4xx.c) it worked correctly too but if i use hse as clock src it dose not work. like baud rate has config problem . i check system clock by mco1 pin and its 180mhz (with hse config)2015-06-29 04:56 AM
CubeMX clock tool can not find a solution for 180MHz clock using a 8MHz crystal. There must be some confusion. What are your PLLM, PLLN, PLLP, PLLQ values?
For example with these values below and a 8MHz crystal you can run at 168MHz. PLLM = 5 PLLN = 210 PLLP = 2 PLLQ = 7 AHB prescaler = 1 APB1 prescaler = 4 APB2 prescaler = 22015-06-29 05:42 AM
If you are using the Std Periph Lib functions then setting the baud rate uses a call to RCC_GetClocksFreq. This function uses HSE_VALUE.
HSE_VALUE is a constant defined in stm32f4xx.h file (default value 25 MHz), user has to ensure that HSE_VALUE is same as the real frequency of the crystal used. Otherwise, this function may have wrong result. Check what HSE_VALUE is defined as in your project.2015-06-29 06:09 AM
And if you use the scope to measure the bit timing of the serial data how does this correlate with the rate programmed into the USART? What's the relationship here?
Review the source code for setting the baud rate. Print out the speeds the system thinks the AHB, APB1, APB2, etc are clocking at.2015-06-30 05:58 AM
thanks for your replays
hse_value in stm32f4xx.h was 25000000 and i change it to 8000000 and every thing is true now