I am trying to set the baudrates for the st10f269 to something higher then 57600. Obvisouly since the st10 runs at 20 MHz the deviation is too high and i communication over the serial is erronous. Is there a way i can set the baudrate to 230400 or higher(anything higher) without having to use an external crystall. Thanks
Basically there is only two choices. If you look at the baud rate formulas (chapter 4 of the user's manual) you have only two choises according to the bit (SOBRS):
Code:
(SOBRL) = (Fcpu / {16 x [ 2 + (SOBRS)] x Basync})- 1
with Fcpu=20MHz and Basync=57600bauds we have either (SOBRL) = 9.85 rounded to 10 AND (SOBRS) = 0 or (SOBRL) = 6.23 rounded to 6 AND (SOBRS) = 0 If we use the rounded value in the backward formula (same page)
Code:
Basync = Fcpu / { 16 x [ 2 + (SOBRS)] x [ (SOBRL) + 1]}
we get: for ( S0BRS=0; S0BRL=10) we have Basync = 56818Bauds ( ~57600 - 1.376% deviation) and for ( S0BRS=1; S0BRL=6) we have Basync = 59524Bauds (~57600 + 3.232% deviation) Those values are close enough to establish a communication with most of the UART compatible cell available on the market. If your application require a very precise baud rate, you may have to use a specific crystal (baud rate crystals). Using the same method, we can calculate the closer speed to 230400 bauds. The closest we can go with a 20MHz clock is 208333 ( - 9.6% frequency deviation) with either ( SOBRL=2; S0BRS=0) or ( S0BRL=1; S0BRS=1) The higher the baud rate, the bigger the deviation can be... The maximum speed of the cell at 20MHz is 625kBauds with ( SOBRS=0 ; S0BRL=0). [ This message was edited by: Max on 24-03-2003 21:50 ] [ This message was edited by: Max on 24-03-2003 21:54 ] [ This message was edited by: Max on 24-03-2003 21:57 ] [ This message was edited by: Max on 24-03-2003 21:59 ]
I am aming at the 230400 baudrate, and 9% seems too high , since the bits are intepreted as different characters... Seems like i have to use an external crystall Thanks again