The USB specification plans for 127 device adresses on the USB bus, and it is tempting to deduce from this that you can connect up to 127 devices on a USB port. Bad luck, life is not as simple: this naive reasoning does not take into account all constraints imposed by USB controllers. To give you a better and more useful answer, we have decided to test what works in real life...
Our goal is to determine how many Yoctopuce USB devices, either sensors or actuators, you can hope to get working properly on a machine. At the same time, we will let you know what are the ideal conditions to maximize this limit. In order to get real numbers, we have built a batch of USB test devices, which behave like Yoctopuce sensors. Actually these are just Yocto-Demo with a custom firmware allowing to setup at will the number of measures reported per second. In this way, we will be able to run specific tests with devices creating USB trafic at 1Hz, 10Hz, 100Hz or even 1 KHz, which is the maximum message transfer rate allowed by the USB Full Speed standard used by Yoctopuce devices.
The first thing to know is that the maximum number of USB devices that you can use depends as much from the USB hubs as from the USB host controller. We will therefore test these two aspects separately.
We have tested quite a few USB hubs.
USB hub comparison
Our first test is designed to observe how various USB hubs react to a small number of devices configured to send data at high frequency. This reproduces what would happen when you connect for instance several Yocto-3D-V2 inertial sensors, or a few analog interfaces like the Yocto-0-10V-Rx reading fast-changing signals. From this test, we can immediately distinguish between two groups of USB hubs:
- Those who loose packets, and happen to be mostly cheap ones purchased from retail outlet;
- Those who don't loose packets, and have usually been a bit more expensive
A USB bus is not expected to loose packets: USB is supposed to provide a lossless transport layer. Contrarily to Ethernet or WiFi networks, where packet loss are expected and taken into account, USB protocols are not designed to handle retransmissions. So when a USB hub looses packets, it might go unnoticed for a mouse, but it creates real trouble for measure and control applications.
Multi-TT vs Single-TT USB hubs
Price is obviously not the most relevant factor to determine if a hub might loose packets. What matters is its chipset, and in particular if the chipset can handle Full Speed transactions on all ports simultaneously, or if it can only handle one Full Speed packet at a time because it has only one Transaction Translator. In the first case, we have a Multi-TT hub (MTT), which normally works well. In the second case, it is a Single-TT hub (STT), which will loose packets when they come too quickly.
With a Single-TT hub, when there is heavy Full-Speed traffic, one can observe packet loss as soon as there are 2 devices connected. With moderate traffic, it may work properly up to 3 or 4 devices, but as the number of device increase, packet loss may quickly appear and trigger communication errors.
Using exclusively multi-TT hubs, we have been able to connect up to 30 Full-Speed devices configured to send the most intensive traffic possible, i.e. 1000 messages per second, without seeing any packet loss.
You will find a summary of Single-TT and Multi-TT hubs that we have tested on the table below. If your hub is not in this list, you can try to find on Internet the type of chipset that it uses. You can also open the OS device manager and check the VendorID and DeviceID of the hub. The most common Single-TT chipset is Genesys GL850, which can be recognized by its DeviceID 0x0608.
By the way, we were sorry to find out that the Moxa UPort 207 et Uport 407 hubs, based on a SMSC chipset capable of doing Multi-TT, are nevertheless dropping packets. The manufacturer should probably have spent a little bit more time to check this rather than spending time for replacing SMSC VendorID by its own VendorID.
Moxa industrial hubs look good, but during our load tests they do frequently loose Full-speed packets like any cheap Single-TT hub
Another limiting factor for connecting many USB devices is the hub connection topology, or in simpler words, the way hubs are connected to each other. Indeed, you cannot link blindly one hub to another indefinitely until all devices are connected: there is a maximum number of hubs that a message can cross between the host controller and the device. Starting from the USB controller and the Root Hub embedded on the host motherboard, a message can only cross 5 external hubs at most. So the best way to connect as many devices as possible is to organize them in a tree, rather than linking them in a chain: on the first external hub, only connect other hubs, on which you can also connect further hubs if needed. This will create a large number of USB ports, with a minimal number of hubs to the host controller.
It looks easy, but there are three traps. First, you must take care about power supply: the USB standard does not allow you to connect a USB hub to another if they don't have their own power supply. Some hubs will even disable their downstream ports when they detect that they are second-layer hubs without external power supply. Generally speaking, if you want to connect many devices, always start by powering all hubs from the beginning, without exception. This is the safest way to go.
Second, if you need some distance between your USB devices and the PC that drives them, be prepared to spend one level of hub for this. Indeed, over 2m distance, USB active extension cables are the only one you can rely on, as long passive cables cause packet loss due to weak signal. But an active extension cable is actually a cable with a built-in USB hub to re-amplify the signal.
Third, you may hope that using 7-port or 10-port hubs can make it much easier since you get more USB ports using less hubs. However it is often not the case: most USB 7-port hubs and 10-port hubs are actually made of two or three USB hubs embedded in the same box. Therefore, they still count as multiple chained hubs for the maximum depth limit. To create an optimized topology and chain them properly as a tree, you need therefore to use the device manager and check the depth of each hub port, which makes it a little bit more difficult to build an optimal tree.
From a topology perspective, the best USB hubs that we have tested are those based on Terminus FE2.1 chipset: they provide 7 flat USB 2.0 ports within a single hub. The hub models which use this chipset are the LogiLink UA0148 and the ExSys EX-1177. Another interesting topology option is the ExSys EX-1116HVMS, which offers 16 USB 3.0 ports, made from 5 hubs organised as a balanced tree of depth 2.
The ExSys EX-1116HVMS hub provides 16 USB 3.1 Gen 1 ports, and is made of 5 hubs connected as a tree
On the other extreme, in the 10-port hubs category, the IcyBox IB-AC6110 is the worst from a topology perspective, as it connects three hubs in a chain without making a tree.
USB 1.1, USB 2.0 and USB 3.x
Yoctopuce devices work in USB Full-Speed mode, as defined in USB 1.1 standard and inherited by USB 2.0. One outstanding question is to know if there is an advantage for this type of traffic to use an hub USB 2.0 hub over a more recent USB 3.x host.
According to the specifications, USB 3.x remains compatible with 2.0 devices. If you look at the datasheet of USB 3.x chipsets, you will notice that they all include a USB 2.0 hub in one form or another.
This is verified in real life: we have observed identical performances for Full-Speed traffic routing on USB 2.0 and USB 3.x hubs. The only advantage in favor of USB 3.x hubs is that they usually include an individual status LED on each port, which is seldom the case for USB 2.0 hubs. The only USB 2.0 hub with individual status LEDs that we have seen is the LogiLink UA0148.
The USB 2.0 hub LogiLink UA0148 is Multi-TT and includes individual status LEDs for each port
USB hub comparison table
Here is a summary table to conclude this UBS hub test bench. Note that our comparison is focused on the performance for handling multiple Yoctopuce devices. We have not tested high-speed USB 3.x throughput, nor fast-charging capabilities for instance. We have also added at the end of the list our own Micro-USB-Hub-V2 for comparison purpose, even though it does not really belong to the same category since it is designed to be embedded rather than used stand-alone.
|Maxxtro MX-USL||Genesys GL850||7xUSB2||3+4||desktop||15€|
|Maxxtro MX-UA6||Genesys GL850||10xUSB2||2+4+4||desktop||30€|
|Maxxtro MX-U3HU05||Realtek 5401||7xUSB3||3+4||desktop||34€|
|D-Link DUB-H7||Genesys GL850||5xUSB2||3+2||desktop||37€|
|IcyBox IB-AC618||VIA VL812||7xUSB3||3+4||desktop||52€|
|IcyBox IB-AC6110||VIA VL812||10xUSB3||3+3+4||desktop||74€|
|LogiLink UA0126||Moai MA8601||13xUSB2||1+4+4+4||desktop||19€|
|LogiLink UA0148||Terminus FE2.1||7xUSB2||7||industrial||19€|
|Moxa UPort 207||SMSC USB2507||7xUSB2||7||desktop||181€|
|Moxa UPort 407||SMSC USB2507||7xUSB2||7||industrial||255€|
|ExSys EX-1177HMV||Terminus FE2.1||7xUSB2||7||industrial||48€|
|ExSys EX-1181||Genesis GL3520||10xUSB3||2+4+4||industrial||83€|
|ExSys EX-1187HMVS||Genesis GL3520||7xUSB3||3+4||industrial||86€|
|ExSys EX-1188HMS||Genesis GL3520||7xUSB3||3+4||industrial||82€|
|ExSys EX-1189HMVS||Genesis GL3520||7xUSB3||3+4||industrial||89€|
|ExSys EX-1116HMVS||Genesis GL3520||16xUSB3||4+4+4+4||industrial||225€|
|Yoctopuce MHUB0002||SMSC USB2514BI||4xUSB2||4||embedded||29€|
The best quality/price ratio for an industrial Multi-TT hub is clearly the LogiLink UA0148. At this price point, we can only hope that the workers who built it have received enough money to make a living.
Alternatively, the ExSys hubs are both affordable and of good quality. Most of them feature an industrial 7-24V terminal connector for power supply.
Load test with ExSys industrial USB hubs
USB host comparison
Once we know how to connect many USB devices using hubs, we must still make sure that the host will be able to handle them all. First the CPU must be powerful enough to handle all traffic. But in addition, there are sometimes constraints in the USB controller itself which limit the maximum number of usable devices. Here is the results of our experiments.
PC (Windows 7.0 and 10.0)
On slightly older motherboards featuring several USB 2.0 controllers, we have been able to connect without problem up to 16 devices on the "Enhanced" controller and up to 7 devices on each of the standard USB controller. Make sure not to get tricked by the fact that several USB ports may actually correspond to the same controller: you need to verify how devices are spread on controllers using the Device Manager. With a bit of care, we have been able in this way to use about fifty devices on a single machine, each sending 1000 messages per second.
On some recent machines, there is just one Intel xHCI USB 3.0 controller, which handles all USB ports. The problem is that, by design, this controller cannot talk to more than about 20 USB 2.0 devices in total. So if you have a mouse, a keyboard and a few hubs, you will not be able to use more than 13 to 15 Yoctopuce devices.
On the iMac that we have tested, we have been able to connect 30 devices, each sending 1000 messages per second, on each of the two USB 2.0 ports. The EHCI controller used by Apple seems to be robust.
Raspberry Pi 2
The Raspberry Pi 2 appears to work with 10 devices sending messages at 100Hz: this eats up about 12% of its CPU time. Over 10 devices, the handling of High-Speed devices seems to slow down exponentially, and it is even impossible to get 17 devices to work simultaneously, even when they send almost no data.
The Intel Edison is capable of handling 12 devices sending messages at 100Hz: this eats up 9% of its CPU time. It is impossible to connect more than 13 devices, as the USB controller does not have enough ressources. However the Intel Edison is also capable of handling devices sending messages at 1 KHz, as long as you don't push to far: it is still a small machine...
Here is what you should keep from these tests:
- If you use more than one USB device per USB port, always use Multi-TT hubs. Forget cheap USB hubs sold in retail outlets, they are no good for USB Full-Speed traffic.
- As soon as you use more than 4 devices per port, provide a power supply to all USB hubs.
- To connect many devices, you must create a tree topology.
- Don't expect to use more than 10 devices on a mini-PC like the Raspberry Pi or the Intel Edison.
- No more than 13 devices in total on recent PC using Intel USB3 xHCI controller.
- Apart from than, on a robust machine, you can connect up to 50-60 devices USB in total if you select properly your USB hubs and the connection topology.
And don't forget that your real-world tests are the only proof that your design works. We can give you hints at how to get the best results, but ultimately it is your hardware and your design that will make the difference.