Serial communication at 0.5 Mbps!

I haven’t found anywhere informations about the max serial speed supported by Arduino, so I did a few tests.

I’ve found that an Arduino Diecimila works perfectly (no bytes lost and no errors, in both RX and TX) with a baud rate of 500000 (500 kbps), as long as the PC uses two stop bits and waits for an ACK from the Arduino before the 128-byte buffer is completely filled up.

A baud rate of 1000000 (1 Mbps) works too, but the Arduino starts dropping received bytes as soon as I send packets bigger than 5 bytes without waiting for an ACK.

FYI, I used a tight loop to receive and echo back bytes on the Arduino:

while (1) {
b = Serial.read();
if (b == -1) {
break;
}
Serial.print((char)b);
}

I did my tests with Python and pyserial on a GNU/Linux Eee PC 701. My pyserial version didn’t support 0.5 and 1 Mbps out-of-the-box, but this quick Linux-specific hack fixed it:

import termios
termios.B500000 = 4101
termios.B1000000 = 4104

The values are from /usr/include/bits/termios.h

Any comments or suggestions about high-speed serial communications?