AVR Baud and Clock speed

I’ve been getting away from using the Arduino IDE and have learning the lower level stuff around avr-gcc. I’m currently learning how to use and configure a USART via direct control of the registers which brings me to my question. The typical Arduino runs at 16Mhz. To set the USART Baud rate you must configure the UBRR register. This register accepts only unsigned integers. You set this register using the formula:

UBRR = (Freq / (Baud * 16) -1)

where Freq is the cpu clock speed.

Using this formula if you want the Baud rate 115200 you get a UBRR value of 7.68. Rounding up you get an error of 3.7%. How is it that we can use this baud rate so reliably when the math just doesn’t work out?

Less then 5% error is generally OK.

Alan KM6VV

Sometimes… but that is also why some boards like the SSC-32 don’t run at 16mhz but run with a 14.7456 which gives you a 0% error at most of the standard baud rates…

So what’s the error rate at 16MHz?

Obviously a perfect clock rate for a divisor will work better.

Alan KM6VV

Did you even read my original post…?

Are you talking to your self?

Did you even read my response?

Allen,

You asked him a question he provided the answer to in his first post. That being "So what’s the error rate at 16MHz? "

In his first post he said. “The typical Arduino runs at 16Mhz.” snip “Using this formula if you want the Baud rate 115200 you get a UBRR value of 7.68. Rounding up you get an error of 3.7%.”

Hope this clears it up.