Page 1 of 1

is low latency communication possible?

Posted: Sun Jan 25, 2009 12:43 pm
by hm1717
Hello everybody,

I'm trying to find out a way to make a low latency read-compute-write solution over usb.
.. i mean.. i'd like to be able to read some sensors (low amount of data..4-16 bytes) from an usb device, then do some (quick) computation on the computer side, and then send some result back to the usb device (also low amount of data)... what's important is that the time between sensor read and getting the reply in the usb device is as short as possible.
which should be the fastest method ? using an interrupt-in interrupt-out pair ? or maybe tricking the control endpoint to carry some little data?
which would be the lowest latency possible? (i'd need something like 1ms or less in an ideal world)
does HID or PID devices offer a lower latency in any way ?

thanks,
mihai

Posted: Mon Feb 02, 2009 10:09 pm
by Drools
I'm also looking for a something similar however only one way, from USB --> PC but it has to be very low latency. If I come across a solution I will post back.

Posted: Tue Feb 03, 2009 3:30 pm
by christian
When the host initiates communication, the control transfer is one of your best options for low speed devices. Full speed devices would benefit from a bulk endpoint, though.

In your case, just do a control-in, do your processing and then a control-out. 1 ms latency may be possible, but better measure the actual delay.

For AVR-USB to be as fast as possible, make sure that you have low delays in usbFunctionSetup(), usbFunctionRead() and usbFunctionWrite().