On Mar 18, 2008, at 8:56 PM, Charles Henry wrote:
On Tue, Mar 18, 2008 at 7:34 PM, Derek Holzer derek@umatic.nl wrote:
What's interesting is that the HID protocol is orders of magnitude faster than using USB-serial to access an Arduino. We figured that
out last week preparing for the gamepad hacking workshop at Pickled Feet here in Berlin.This is something I've been wondering about... where does that latency come from on the usb to serial on the arduino. I am using debian Linux with 2.6.17 kernal on a computer that accesses the arduino through /dev/ttyUSB0
The arduino is doing serial communication with a couple of IC's. Even with 24 bits of information sent to an IC using 3-wire interface, the process only takes about a millisecond. The computer interfaces with /dev/ttyUSB0 and sends a command, then waits for information to return.
I poll the device with select(). The round trip time is around 15-16 ms. Only 2-3 ms are actually accounted for in the communication routines, so where does the other 12 ms come from?
(Actually, I have thought about different methods, such as triggering an interrupt from the actual serial port via another pin on the arduino, to indicate that data has been sent. Would it help?)
I think that the linux kernel doesn't check the file very frequently, which gives me this kind of latency, but I don't really know. I wonder, how is the HID interface different? It gets registered as a character device, also, right? Any tricks? fundamental concepts I'm missing?
USB-serial drivers are usually optimized for maximum thruput rather
than low latency and jitter. Basically, they were designed to hook
up modems and the like. USB HID was designed around low latency and
jitter. Most USB HID devices deliver data every 10ms with decently
low jitter.
The best I've been able to get with Arduino/Firmata is 20ms. The
FTDI driver/chip on has a huge and crappy buffer, so lowering the
poll time would actually make it slower with massive jitter. With
the Arduino, you can tie a pin of the Atmel to the FTDI USB chip then
you can flip that pin to force the FTDI to send it's data
(circumventing the buffer). Then you can get reliable 10ms latency,
perhaps lower. Check the arduino forums for docs on that.
.hc
Chuck
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Using ReBirth is like trying to play an 808 with a long stick. - David Zicarelli