2008-05-25 05:23 AM
STM32104RBT6 baud rate problem
2011-05-17 03:35 AM
[I am new to this, so please help without ambiguity]
I am using the Olimex board STM32-103STK with an STM32104RBT6 mcu. the problem is that for a simple application of UART1 (code attached), I am unable to set the baud rate correctly. For example, if I set the baud to 10400 bps, then the actual baud on the wire is 6944 baud (checked using an LA), which is very strange. I modified an existing USART example (and the olimex bliking LED example). All other files are same as the library from ST site. The line ''myDelay(8000);'' in my code, is another problem as without this, my bytes on the wire ''keeps changing slightly'', however this is not the primary problem. I am using CodeSourcery GCC (4.2.3) with Eclipse to build my firmware. What is wrong :o with my code? [ This message was edited by: pranamesh on 23-05-2008 21:57 ]2011-05-17 03:35 AM
HSI clock source is not accurate for baudrate generation. Use an external crystal instead.
2011-05-17 03:35 AM
Pranamesh, the number, which you put in the baudrate register is in fact the divider of the clock frequency:
72000000 / 10400 = 6923 - close to the number, which you measured. If you need a baudrate of 10400 put 6923 in the register.