## megaAVR 0 series uart baud rates

3 posts / 0 new
Author
Message

Hello,

i am using Atmega3209(at 20MHz) and using its uart to send data to PC via ftdi serial to usb cable. At the moment i am using 9600 baud, and i also tried 115200, 460800 and 921600 bauds. I noticed on all of them, the data i received was almost intact, which lead me to do calculations of baud rates errors(as im used from atmega328 and similar ones). I found the equation in Atmega 0 series UART manual, page 7. I did the calculations with 9600, 57600, 115200, 921699 and just for fun also 2.5M baud and noticed that on ALL of them, error rate is below 1%. Did i do math wrong or is atmega 0 series configured this way to be more flexible??

Example of my calculation:

baud = 9600
fbaud(register) = (64x20.000.000)/(16x9600) = 8334
BAUD(actual baud) = (64 x 20.000.000)/(16x8334) = 9599
Error% = ((9599/9600)-1)*100% = -0,010%

baud(register) = 115200
fbaud = (64x20.000.000)/(16x115200) = 694
BAUD(actual baud) = (64 x 20.000.000)/(16x694) = 115274
Error% = ((115274/115200)-1)*100% = 0,064%

baud(register) = 921600
fbaud = (64x20.000.000)/(16x921600) = 87
BAUD(actual baud) = (64 x 20.000.000)/(16x87) = 919540
Error% = ((919540/921600)-1)*100% = -0.223%

This topic has a solution.

Last Edited: Wed. Sep 18, 2019 - 10:44 AM
This reply has been marked as the solution.

Klemko wrote:
Did i do math wrong ...
incomplete

CLK_PER is dependent on OSC20M or EXTCLK; OSC20M's accuracy is approximately 2% max or 4% max across ambient temperature and VDD voltage.

CLK_PER can be on pin CLKOUT so can calibrate OSC20M.

Klemko wrote:
... or is atmega 0 series configured this way to be more flexible??
Yes (fractional baud rate generator and auto-baud, similar to PIC enhanced USART)

"Dare to be naïve." - Buckminster Fuller