SOLVED! Strange serial communication behavior (Nano vs. Uno)

Hello everybody..

I've been working on a project where i communicate via serial with an Arduino Uno from a windows c# program. Everything works nice. When i invoke a command in windows, then I get a fast response from the uno..

I also have a Arduino Nano in my posession, but when i run the exact same code on that, the serial connection seem "slow", even though the settings are the same. When i invoke commands, the response takes a long time to return.

Does anyone have any idea what might slow/delay the serial connection??

Maybe the windows driver? The Nano uses an FTDI chip where the UNO has a ATmega16U2 programmed as a USB2Serial converter. They use different drivers (on my Linux box they appear as /dev/ttyUSBx [FTDI] or /dev/ttyACMx [16U2]) and it's possible that there is a difference. As the rest of the communication line is identical (ATmega328 at 16MHz) it's unlikely that this slows things down.

As you haven't showed us your code, this is the best guess I can give you.

I've investigated a little further...

In the windows program I send 20 packages every 1/4 second. Each package is two bytes. Before the next package can be sent the Arduino must first send a response, so:

time 0 ms; package 1, wait response 1 package 2, wait response 2 package n, wait response n..... package 20, wait response 20 wait..... time 250ms; package 1, response 1.. etc

windows program generates all 20 packages and stores them in a buffer, where a separate thread handles them.. When connected to the Uno, and by measuring with an oscilloscope on the Rx and Tx, the packages come in a cluster every 250ms, so no problem there.

but on the Nano, the Rx/Tx line is packed with data the entire time, and the buffer in windows keeps getting bigger (after a min or so over 2000 packages waiting). So something delays the packages from being sent. and it must be the waiting for a response.

I have checked the driver and tried to update it, but no change there..

any particular code you are interested in?

New info.. tried to simplify everything and then time the delays of the serial communication..

arduino send byte, arduino turn I/O HIGH windows receives byte windows returns byte arduino receives byte arduino turn I/O LOW delay repeat

the Uno is exact 5.8 ms from pin is high to low, while the nano around 18ms.

the only difference is the FTDI chip vs ATmega16U2. Does the FTDI chip/driver really delay the packages that much?

SOLVED!!!!

The FTDI driver has a build in Latency control. it was set to 16ms. Switch to 1ms and everything is snappy

solution here: http://blog.lincomatic.com/?p=201