RuggedCircuits

What are you using to communicate with your Arduino? Are you using the built-in serial monitor? Whatever you are using, you must make sure to set its baud rate to match whatever you give to Serial.begin(). It sounds like you are changing the baud rate in your sketch but not in the serial monitor.

RuggedCircuits

That is interesting. It does have all the hallmarks of a not-quite-right-baudrate issue though. I don't suppose you have an oscilloscope that you can connect to the RXD serial line (digital pin D0) to accurately measure the bit width? It should be 17.36 microseconds.

I wrote a sketch to dump the UART config. It is using u2x mode for 57600, and it DOES seem to have correct values for the bit rate generator...

Hmm. Now that the Uno has an ATmega chip for the USB/Serial converter, is THAT firmware (LUFA) using the same algorithm for picking bitrates as the arduino firmware? This sort of thing could be explained if the 8u is picking a divisor/setting with +n% error, while the 328 is picking a divisor with -m% error... Having them MATCH is more important than actually being close to the specified bit rate...

In fact, it looks like the 8u firmware has special case code for 57600 that DOES configure its uart "opposite" the way the 328 is configured. I can't tell whether that is a bug, or something that was done specifically to address 57600bps issues with an earlier Arduino; there's a comment there about being compatible with the 57600bps bootloader on 328, but... the 328 bootloader doesn't RUN at 57600 any more. And if it is talking about the current Arduino code, it looks like the tests are backward (it picks u2x for everything except 57600 !?)

This same issue happened when using Teensy to communicate with '328 based Arduino clones. I wrote about it here:

http://dorkbotpdx.org/blog/paul/teensy_as_benito_at_57600_baud

The original Arudino bootloader never tried to use the 2X mode, so it communicated at 58824 baud, not 57600. That's +2.124% error, which is just barely within 8 bit serial tolerance. In other words, all those Duemilanove boards were just barely working when in bootloader mode.

Dean probably tested the 8u2 firmware for Uno with a Duemilanove running the original bootloader at 58824 baud, instead of optiboot. Just as I encountered, if you use the "best" baud rate in 2X mode, which is 57143 (-0.794% error), then you can't communicate with the original Arduino bootloader.

#if F_CPU == 16000000UL // hardcoded exception for compatibility with the bootloader shipped // with the Duemilanove and previous boards and the firmware on the 8U2 // on the Uno and Mega 2560. if (baud == 57600) { use_u2x = false; }#endif