Hi,
I am measuring Round Trip times (RTT) for the USB connection between an Android phone and Teensy 3.5 (with the USB type set as "Serial"). The "problem" I’d like to understand is why the minimum latency is generally between 170-300us which is far less than the expected >1ms (which is the USB polling interval defined for the full-speed USB, as available in the Teensy). I’ve established a bulk transfer connection type between the devices (through the on-the-go USB cable, hosted by the phone). The USB interface towards the Teensy is the following:
The polling interval (mInterval) is set to "0" but based on USB specifications it is ignored for the bulkTransfer type so apparently this does not contribute to the issue.
Latency is measured in phone as the interval between timestamps taken immediately before sending a USB package and immediately after receiving the corresponding response from the Teensy. Only one byte of data is transmitted from Android to Teensy. Teensy responds to the request by sending a timestamp (as a String) using
followed by
A random delay of 2-10ms (or even more!) between each RTT measurement round is added in the phone to eliminate the effect of a possible data buffering.
I’m more than happy to achieve such a small connection latency between the devices and would like to understand why this is possible. Does it have something to do with the way the USB serial communication has been implemented in Teensy? There is a lot of related information available (for example at https://www.pjrc.com/teensy/td_serial.html) but unfortunately I haven’t been able find any documentation which would explain latencies under 1ms for this kind of setup.
Thank you in advance!
Br, -=Markus=-
I am measuring Round Trip times (RTT) for the USB connection between an Android phone and Teensy 3.5 (with the USB type set as "Serial"). The "problem" I’d like to understand is why the minimum latency is generally between 170-300us which is far less than the expected >1ms (which is the USB polling interval defined for the full-speed USB, as available in the Teensy). I’ve established a bulk transfer connection type between the devices (through the on-the-go USB cable, hosted by the phone). The USB interface towards the Teensy is the following:
Code:
UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=3,mAttributes=2,mMaxPacketSize=64,mInterval=0]
UsbEndpoint[mAddress=132,mAttributes=2,mMaxPacketSize=64,mInterval=0]]
The polling interval (mInterval) is set to "0" but based on USB specifications it is ignored for the bulkTransfer type so apparently this does not contribute to the issue.
Latency is measured in phone as the interval between timestamps taken immediately before sending a USB package and immediately after receiving the corresponding response from the Teensy. Only one byte of data is transmitted from Android to Teensy. Teensy responds to the request by sending a timestamp (as a String) using
Code:
Serial.write(data.c_str(), data.length());
Code:
Serial.send_now();
I’m more than happy to achieve such a small connection latency between the devices and would like to understand why this is possible. Does it have something to do with the way the USB serial communication has been implemented in Teensy? There is a lot of related information available (for example at https://www.pjrc.com/teensy/td_serial.html) but unfortunately I haven’t been able find any documentation which would explain latencies under 1ms for this kind of setup.
Thank you in advance!
Br, -=Markus=-