Closed GoogleCodeExporter closed 9 years ago
I'm sure everyone is aware of it right now, but for history...
Leaving the U2X bit set in the firmware for 8Mhz devices caused
http://code.google.com/p/arduino/issues/detail?id=47
Original comment by gabebear@gmail.com
on 3 Jul 2009 at 5:10
[deleted comment]
[deleted comment]
[deleted comment]
Currently, if "-DDOUBLE_SPEED" wasn't used, the baud error rate would be 7.8%
for
57600 baud on an 8MHz Arduino!!!!!
firmware equation:
F_CPU/(BAUD_RATE*16L)-1
better equation:
(F_CPU/(BAUD_RATE*8L)-1)/2
--------
7.84% error = 8MHz,57600 baud,firmware's equation,w/o U2X
3.68% error = 8MHz,57600 baud,better equation, w/o U2X
2.08% error = 8MHz,57600 baud,firmware's equation,w/ U2X
2.08% error = 8MHz,57600 baud,better equation, w/ U2X
Anything above 2% is considered "bad"
If you use setbaud.h without changing the default error-rate, it will generate a
warning if there is more than 2% baud error rate.
The Math for an 8MHz Arduino at 57600 baud:
--------
with the firmware's equation, not using U2X:
UBBR = 7 = 7.68 = (8000000/16/57600-1)
true_baud = 62500 = 8000000/(16*(7+1)) = 8000000/(16*(UBBR +1))
error = 7.84% = abs(1-(57600/62500)) = abs(1-( target_baud / true_baud ))
--------
with the better equation, not using U2X:
UBBR = 8 = 8.18 = (8000000/8/57600-1)/2
true_baud = 55555.56 = 8000000/(16*(8+1)) = 8000000/(16*(UBBR +1))
error = 3.68% = abs(1-(57600/55555.56)) = abs(1-( target_baud / true_baud ))
--------
with the firmware's equation, using U2X:
UBBR = 16 = 16.36 = (8000000/8/57600-1)
true_baud = 58823.53 = 8000000/(8*(16+1)) = 8000000/(8*(UBBR +1))
error = 2.08% = abs(1-(57600/58823.53)) = abs(1-( target_baud / true_baud ))
--------
with the better equation, using U2X:
UBBR = 16 = 16.86 = (8000000/4/57600-1)/2
true_baud = 58823.53 = 8000000/(8*(16+1)) = 8000000/(8*(UBBR +1))
error = 2.08% = abs(1-(57600/58823.53)) = abs(1-( target_baud / true_baud ))
Bleck!!! too bad we can't go back in time and choose 76800 baud as the upload
rate for
328s...
Original comment by gabebear@gmail.com
on 3 Jul 2009 at 7:18
Original comment by dmel...@gmail.com
on 12 Jul 2009 at 3:04
Original issue reported on code.google.com by
gabebear@gmail.com
on 3 Jul 2009 at 5:08