2019-09-13 06:08 AM
Hello, I'm a newbie with STM32.
I transmit data over the UART interface and I have configured 9600 Baudrate, but I can only receive the correct data on my PC terminal if I setup to 4800.. So why the Baudrate is effectively 2 times lower? I'm using the blue pill board with the STM32F103C8Tx, and clock configuration Sysclk,Hcclk is 72Mhz, setup with STM32CubeMx. (no warnings at build)
sorry my poor english.
thank you very much
2019-09-13 06:12 AM
The define for HSE_VALUE likely disagrees with crystal in use. Check clocks and PLL settings
2019-09-13 06:27 AM
thanks, see attached my clock configuration. unfortunately I have no idea which parameters I must change for that. The external crystal is a 8.000 MHz.
2019-09-13 06:52 AM
update, if I change PLL Source Mux to HSI it works... very special?!.
what do to use the external clock correctly?
2019-09-13 08:22 AM
Make sure a) the hardware actually clocks properly, get a scope and measure, output internal clocks via PA8 (MCO) pin, and b) that the setting of HSE_VALUE is coherent, ie HW and SW working from the same set of facts, so the computations will work correctly for the baud rate divider settings.
2019-09-13 09:26 AM
You must define HSE_VALUE at project level, of course mathcing the actual crystal value.
Its not once or twice that I have done the mistake of not doing so, and then chased ghost's only because cube failed to generate the correct clock value in code.(for reason or another it does like to set the HSE_VALUE = 25mhz, no matter what i put in the text box)
2019-09-13 12:42 PM
Also, when using crystal, make sure that HSE bypass mode is not enabled.