About the jerky data transfer on the Duemilanove

When trying out serial transfer speeds a while back, I noticed the data flow on the Arduino Duemilanove to be “jerky” compared tho the Arduino Uno. This held true to other boards using the FTDI chip, too. Seems, like there is an explanation for it. I came across Jan Axelson’s book Serial Port Complete (2nd ed), where it says (on page 332) that there are two situations for slow data transfer:

The first occurs when sending only very little data as the FTDI chip likes to fill it’s buffer of 62 bytes before passing them on the USB-bus. (This USB-endpoint sends packets of 62 data and 2 status bytes.) The chip has a latency timer of 16 ms, after which it sends the data regardless of the buffer’s lower byte count. [Edit: the 64 byte packet size is for full-speed USB, but high-speed USB requires 512 byte packets. (p. 345)]

The second case probably explains my problem: When receiving data at 38.75 kbps or higher, the driver holds the data until it has received 4096 bytes (or it’s latency timer has timed out) before passing it to the application.

I assume that the Arduino UNO’s serial driver just moves smaller chunks of data at a time. (Judging by source code that is provided with the Arduino environment, the USB-serial is in UNO’s case programmed on the Atmega8U2 or Atmega16U2 using LUFA.)

The book also suggests reading this app. note. It describes a few methods to adjust some latency times and buffer sizes – in windows. It also says that modem status lines can be used to flush the (FTDI’s, I assume) buffer.