Support Support Home » USB3 » Compatible hardware » Multiple Cameras Setup

Multiple Cameras Setup


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.


Bandwidth of USB 3.0 controllers and hubs

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.

  • Maximum transfer rate of USB 3.0 host controller (MTRHC) is typically
    • 3500 Mbit/s when connected to PCIe Generation 2.0
    • 1800 Mbit/s when connected to PCIe Generation 1.0
      Sum of the transfer rate of cameras connected to one controller should be less than MTRHC
  • Maximum transfer rate of USB 3.0 hub (MTRH) is typically 2400 Mbit/s

    Sum of camera rates connected to one USB 3.0 hub should be less than MTRH

Maximum USB3 controller bandwidth

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.

Bandwidth Limit of Camera

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.

Connection Examples

Four monochrome cameras connected to one USB 3.0 hub

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

Four color cameras connected to two separate controllers

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.

Example of multiple USB3 controllers card

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.

Linux specific settings

Acquisition buffer size limit

Symptom

When the acquisition is started on more than 7 cameras simultaneously on Linux - the acquisition start is not successful on the 8th camera.

Description

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.

Solution

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