Electronic – USB Device Latency

latencymicrocontrollerusb

This is a theoretical question. I would like to know what the lowest latency is which can be achieved when interfacing a microcontroller with USB interface. Consider a USB host (computer) sending one byte to a USB device (microcontroller) and waiting for it to respond the same byte. How much time would this at least take? Are there any experiments about that? Any information would help me.

When using serial communication (RS232) the minimum latency you can achieve is 1 ms (by using USB to serial converter). I am looking for a faster way to communicate with my microcontroller (in terms of latency).

Best Answer

USB has a strict master/slave architecture, in which all communication is controlled by the host PC.

When the host wants to send data to the device, and assuming that there are no other devices on the bus, the data can always be sent immediately.

When the host wants to receive data from the device, it must ask for it.
If the host controller has just finished receiving a previous packet, it typically asks for the next packet immediately. But if the bus has been idle, continuously polling for new data would waste lots of power, so this polling happens once every millisecond (for full-speed devices).


To get a latency lower than 1 ms, you would have to use a protocol with a peer-to-peer architecture, in which devices can send data without being asked by the host. Even plain RS-232 can achieve this, but you would need to replace the USB converter with a PCI(e) card.