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?
Chuck