To connect multiple cameras some precautions must be taken into account.
Motherboards that support USB 3.0 usually offer from 2 to 8 USB 3.0 ports.
Here you can find examples of up to 12x USB3 computer.
In order to further expand the number of ports, the user can consider USB 3.0 hubs or USB 3.0 host controller cards.
USB 3.0 hubs are made in many different variations and using USB 3.0 hub controllers from different chipset producers.
The maximum transfer rate of each controller and hub is different.
Sum of camera rates connected to one USB 3.0 hub should be less than MTRH
USB 3.0 cameras support bandwidth throttling allowing you to set the maximum bandwidth of the camera.
Newer USB 3.0 hub host controllers that have better performance are for example: VIA VL812, Genesys Logic GL3520 and Renesas uPD720210.
They can also increase the working distance of the system.
Please refer to the article High Performance Hardware containing the table of maximum data transfer to get the maximum transfer rate of selected USB3 controllers.
xiAPI allows to measure the maximum available bandwidth and set the bandwidth limit for each camera.
User application is responsible for setting bandwidth parameter for all connected cameras to keep the sum of data rates under the available bandwidth of the controller/hub.
// disable auto bandwidth calculation (before camera open) xiSetParamInt(0, XI_PRM_AUTO_BANDWIDTH_CALCULATION, XI_OFF); // open the cameras xiOpenDevice(0, camera1); xiOpenDevice(1, camera2); // set interface data rate int interface_data_rate=2400; // when USB3 hub is used // calculate datarate for each camera #define CAMERAS_ON_SAME_CONTROLLER 2 int camera_data_rate = interface_data_rate / CAMERAS_ON_SAME_CONTROLLER; // each camera should send less data to keep transfer reliable #define SAFE_MARGIN_PERCENTS 10 camera_data_rate -= camera_data_rate*SAFE_MARGIN_PERCENTS/100; // set data rate xiSetParamInt(camera1, XI_PRM_LIMIT_BANDWIDTH , camera_data_rate); xiSetParamInt(camera2, XI_PRM_LIMIT_BANDWIDTH , camera_data_rate);
By decreasing the bandwidth the maximum FPS of the camera is also decreased.
To achieve the maximum framerate use more controllers and fewer hubs.
Hub plugged into USB 3.0 port on the PC will funnel all data through a single port and bandwidth will be shared by all the ports on the hub.
Hence bandwidth of each connected camera needs to be monitored and managed to avoid data loss or overflow of the bus.
In this setup example, the application must limit the FPS of each camera to keep the sum of all bandwidths under the maximum allowed by the hub (2400Mbit/s).
Camera model | Pixel Format | FPS | Bandwidth limit |
MQ013MG-E2 | XI_MONO8 | 38 | 400Mbit/sec |
MQ013MG-E2 | XI_MONO8 | 38 | 400Mbit/sec |
MQ013MG-E2 | XI_MONO8 | 38 | 400Mbit/sec |
MQ013MG-E2 | XI_MONO8 | 38 | 400Mbit/sec |
total | 1600Mbit/sec |
In this setup example, the maximum possible camera FPS would be possible.
Controller1:
Camera model | Pixel Format | FPS | Bandwidth limit |
MQ013CG-E2 | XI_RGB32 | 60 | 1300Mbit/sec |
MQ013CG-E2 | XI_RGB32 | 60 | 1300Mbit/sec |
total | 2600Mbit/sec |
Controller2:
Camera model | Pixel Format | FPS | Bandwidth limit |
MQ013CG-E2 | XI_RGB32 | 60 | 1300Mbit/sec |
MQ013CG-E2 | XI_RGB32 | 60 | 1300Mbit/sec |
total | 2600Mbit/sec |
This setup is possible with a direct connection of each camera to the controller.
Two cameras per controller. No secondary hub can be involved.
A multi-port host controller card is the additional way how you can have more USB 3.0 ports in your system.
These cards are plugged directly into a PCI-Express on the motherboard and thus matching each port with a host controller providing full bandwidth per port.
However, they can sometimes require a larger PCI-Express slot, for example, the slot with x4 or x8 lanes.
One existing USB3 controller card that contains 4 independent controllers is U3X4-PCIE4XE111.
It contains 4x Fresco FL1100 controllers.
This controller is capable to connect 4 independent MQ013xG-E2 or 4 Subminiature MU9 cameras without bandwidth limitation.
When the acquisition is started on more than 7 cameras simultaneously on Linux - the acquisition start is not successful on the 8th camera.
Default the Linux (e.g. Ubuntu 14.04) uses a small amount of memory allocated for USB buffers (e.g. 16MB). This amount is not enough when multiple cameras are connected.
In order to increase the number of transport buffers - the user needs to change this number. This is especially needed when multiple cameras are connected.
To set unlimited memory space to be allocated - the user must use the following command before the camera is opened by the application:
sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb >/dev/null <<<0