Hi, I have some questions about Optiboot and the Uno please, if some of you could dig way back in your memories.
I have compiled Optiboot 6.2 for 57600 baud, and it works great with a device like an HC-05 Bluetooth transceiver. But it does not work with the Uno's built in ATmega16U2 running the Rev 3 firmware. I found this old thread: http://forum.arduino.cc/index.php?topic=28560.0
There are some interesting things brought up in that thread, such as this:
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.
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 !?)
So, I compiled Optiboot for 58824 baud rate and made a boards.txt entry for my modified Uno with unob.upload.speed=57600. It works great when using the built in ATmega16U2 and with the HC-05 Bluetooth.
Is this a compromise or workaround which results in the bootloader actually running closer to 57600 baud than it would if it were compiled to run at 57600?
Or is the firmware on the ATmega16U2 off a little and never has been worked on because Uno is rarely used at 57600 anyway?