wiki/ news/ 2012-07-25 - USB latency measurements

USB latency measurements

We did the first measurements of USB latency on the GFE + FC setup. We put in a 3.3V square wave at 100 Hz into the GFE pin P0.16, interrupted off that, and then queued a bulk packet for the FC. When the FC gets it (running the imu-host application), it sends a newline to standard out which we redirected to the serial port. The delay from the rising edge of the 100 Hz signal to the rising edge of the start bit on the FC's RS-232 /dev/ttyS0 port gives us the USB latency and variability, as measured on a MSO4054 scope.

Setup:

Working on USB Latency

This is a pretty hokey test: we're redirecting stdout to ttyS0, and the user space code isn't optimized at all, etc etc. But we got results!

USB inbound latency: 1.139 - 2.140 ms -> 1.139 +/- 1.001 ms

The variability of 1.001 ms is almost exactly what we expect - that's the frame rate of the USB bus. But the 1.139 ms latency we can't explain except that our host code is kinda hokey. We ran all sorts of tests, including running a 'dd if=/dev/sdb1 of=/dev/null bs=512' at the same time, but nothing seemed to affect the timing - it was rock solid.

HOWEVER, then we started messing around with trying to get better latencies, it all went to hell and we started getting like 70 - 80 ms of latency. After a long time of trying to figure out what we did, we gave up and are now waiting for Real Software People to make it all better.