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

Multiple Cameras Setup


To connect multiple cameras some precautions must be taken into account.

Motherboards which support USB 3.0 usually offer from 2 to 8 USB 3.0 ports.
In order to further expand the number of ports you will need 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.
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 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 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 the article High Performance Hardware containing the table of maximum data transfer to get maximum transfer rate of selected USB3 controllers.

Bandwidth Limit of Camera

xiAPI allows to measure maximum available bandwidth and set bandwidth limit for each camera.
User application is responsible to setting bandwidth parameter for all connected cameras to keep sum of data rates under the available bandwidth of 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 camera is also decreased.
To achieve the maximum framerate use more controllers and less 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 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 sum of all bandwidths under the maximum allowed by 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 direct connection of each camera to controller.
Two cameras per controller. No secondary hub can be involved.

Example of multiple USB3 controllers card

A multi-port host controller card is 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 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 acquisition is started on more than 7 cameras simultaneously on Linux - acquisition start is not successfully on 8th camera.

Description

Default the Linux (e.g. Ubuntu 14.04) uses 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 number of transport buffers - user needs to change this number. This is especially needed when multiple cameras are connected.

To set unlimited memory space to be allocated - user must use following command before camera is opened by application:

sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb >/dev/null <<<0