U3 latency problems | LabJack
 

U3 latency problems

10 posts / 0 new
Last post
paulbays
paulbays's picture
U3 latency problems

I use U3-LV devices on a number of PCs running Windows 7 & 10. To test the latency of the Labjack digital I/O I use the high performance counter in C++ to measure the time from issuing a command to change a digital output pin to receiving the message that the input has changed on a second pin wired to the first. On the majority of PCs this loop is completed in ~0.5-0.8 ms. However I have two PCs on which the loop time is ~3.5 ms. Both of these PCs run Windows 7, one is an HP machine and one a Dell machine. I have tried connecting the Labjack to both USB 2.0 and 3.0 ports and found no difference. On one of these PCs I have installed Windows 10 as a dual-boot and found loop times < 1 ms under that OS, so I conclude it is not a hardware problem. I have another, older Dell PC that runs Windows 7 and has a loop time < 1 ms, so it is not a universal issue with Win 7. The only commonality I can find is that both the PCs with long latencies have Intel USB drivers, whereas the Win 7 PC with short latency has a Microsoft USB driver (I have tried installing the Microsoft driver on one of the long-latencies PCs but it refuses to install blaming hardware incompatibility).

It is actually quite important for my projects to have Labjack running at sub-millisecond latency under Windows 7. Any help in eliminating the mystery additional latency on these two machines would be much appreciated.

LabJack Support
labjack support's picture
What you are seeing on

What you are seeing on Windows 7 is what we normally saw for years.  I think you will find that if you add a modern USB hub in between you will get faster speeds:

https://labjack.com/support/datasheets/u3/operation/command-response

We have noticed that many new machines with Windows 10 are much faster, and do not need a hub in between to get that faster speed.  Perhaps something changed in the O/S, or perhaps the motherboards have a hub onboard that does what the external hub used to do.

 

paulbays
paulbays's picture
Thanks for the quick reply. I

Thanks for the quick reply. I am aware of the USB hub trick but unfortunately it doesn't help in this case - both PCs show the same >3 ms latency with or without a USB hub between the Labjack and the machine. Do you have any other suggestions?

paulbays
paulbays's picture
Thanks for the quick reply. I

Thanks for the quick reply. I am aware of the USB hub trick but unfortunately it doesn't help in this case - both PCs show the same >3 ms latency with or without a USB hub between the Labjack and the machine. Do you have any other suggestions?

LabJack Support
labjack support's picture
Note that USB 2 does not

Note that USB 2 does not necessarily mean high speed will be used or is even supported.  It tells you that high speed might be supported (in addition to full speed and low speed), whereas on a USB 1.1 you know that high speed (and super speed) are not possible.

On Windows 7, whenever the connection between the hub and computer is high speed USB we have always seen the USB time per command-response drop from about 4 ms to about 1 ms.  Perhaps your hub does not support high speed or for whatever reason the hub or computer is forcing a full speed connection?

One other comment is that I can't say we have noticed or had feedback on whether a super speed hub to host connection provides the same benefit as we saw for years with a high speed hub to host connection.

paulbays
paulbays's picture
Thanks for your comment. I

Thanks for your comment. I mentioned that I had another Win 7 machine which had < 1 ms latencies. I should have said that this latency is achieved only when the Labjack is connected via my external USB hub (a D-LINK DUB-H7 USB 2.0). If plugged directly into the PC's USB port the latency is 5-7 ms. In other words, the USB hub I am using can produce the reduction in latency - it just doesn't do so on the two PCs in question. So the problem is not that the USB hub doesn't support high speed. It could be that, as you say, for some reason these PCs are forcing an inferior (full or low speed) connection - but I don't know how to test that theory or how to fix it. Can you offer any recommendation?

LabJack Support
labjack support's picture
Per the USB specs for a full

Per the USB specs for a full speed connection (U3), round trip times of 1ms or perhaps 2 ms make sense.  There is nothing in the spec that explains why most older machines (older machine or older O/S?) would take more like 4 ms, and further nothing to explain why a hub in between would make any difference.  So there is nothing based on USB specs that explains the behavior we usually see, or the behavior you are seeing.

I can't think of much more to recommend, except to point out that we rarely if ever see or hear about what you are experiencing, so it suggests something is unique about the combinations giving you the slower times.

paulbays
paulbays's picture
Thanks. If you haven't seen

Thanks. If you haven't seen this behaviour I suspect it happens only on newer machines running Win 7 - I'm guessing the Win 7 machines you've tested for latency have tended not to be recent models? Unfortunately newer Windows OSs have changed their graphics behaviour, introducing very long display latencies that rule them out for our purposes (we're a vision lab). One possibility is to switch to Linux. In your experience are Labjack latencies similar under Linux and Windows?

LabJack Support
labjack support's picture
We haven't tested Windows 7

We haven't tested Windows 7 on new machines to confirm if recent models have more USB latency. The latency could be related to the USB hosts used in the computer models you are using. Make sure your Windows 7 machines have the latest system and motherboard chipset driver updates.

Regarding Linux, latencies are comparable to Windows.

iandol
iandol's picture
paul: do you use PTB for your

paul: do you use PTB for your vision work? If so, I think there is a strong incentive to move to Linux, Windows is very poorly supported for ensuring precise visual stimulus timing...