Edgertronic multi-camera synchronization genlock
Genlock is a mode where a master camera provides frame start and trigger signals to one or more slave cameras. The master and slaves capture frames at the at the exact same rate, with the start of exposure synchronized to within +/- 1 uS of each other. Trigger events are processed by the master and distributed to the slaves in manner that causes the master and slave to trigger on the exact same frame.
The frame timing and trigger are sent on a single wire in the IO (external trigger) trigger connector. In the simplest setup, with one master and one slave, all that is needed is a 3 conductor, 2.5mm male to 2.5mm male, patch cord cable to connect the cameras. The cable was included with the camera. If you need another 3 conductor 2.5mm male to 2.5mm male patch cord cable they are commonly available.
For each frame that is captured, the cameras go through three phases: exposure, frame data readout and idle. As long as the slave camera has a positive idle time the slave will stay in genlock with the master. During the exposure phase and frame data readout phase a slave camera will ignore start-of-exposure signals from the master.
There are limitations:
- All cameras have to be configured for compatible timing (see below). For one-to-one frame lock, each slave has to be set to a frame rate that is greater than or equal to the master's frame rate.
- The user is responsible to make sure all cameras can be triggered before issuing a trigger. There is no automated check that verifies whether or not a slave camera has completed saving the previously captured video, finished the calibrate operation, has available storage, etc.
All cameras must have identical settings except for Genlock Mode, Sensitivity and Shutter. The Shutter value must not limit frame rate. You are responsible for configuring each camera; there is no configuration information flowing over the genlock cable. Incorrect camera configuration will lead to unusable videos.
Should you wish to violate the above and have different settings, you must always guarantee the following:
- What ever the settings (exposure, resolution etc) the slave must be able to keep up with the master. Just because you set the master to 1000 fps doesn't magically make an SC1 set to 1280x1024 able to run faster that 494 fps.
- The slave must not be set for more post-trigger frames than the master. The master camera only sends genlock timing pulses when it is filling the pre and post trigger buffers. When the master post-trigger buffer is filled, the master will stop sending pulses until it is ready for the next capture. Until then, if a genlock slave still wants to capture more post-trigger frames, it will loose genlock sync.
Identify one camera to be the master; it doesn't matter which one. Browse to each camera and configure each camera with identical settings, except one is identified as the master while the rest are identified as slaves. Look at the LEDs on all cameras to verify all cameras are in the run state (solid green camera LED). A blinking red camera LED indicates that the slave isn't receiving a genlock signal.
Once the cameras are wired, configured, and triggerable, go ahead and trigger the master camera to verify the slave cameras are responding to the trigger. During capture, look at the camera LED on each camera and verify none of them are blinking white. A blinking red/white camera LED indicates that camera was not able to maintain genlock. Check each captured video to verify the results are what you expected.
The cameras need to have unique IP addresses. If you are not using DHCP, you can buy a simple 4-port network switch (such as a D-Link DES-105 5 Port 10/100 Network Switch or the D-Link DGS-105 5 Port Gigabit Network Switch. Plug the PC, and each camera into the network switch. Leave the PC configured for network IP address 10.11.12.1 and the genlock master camera configured for network IP address 10.11.12.13. The genlock slave camera needs a different, unique IP address. You can assign the genlock slave camera the IP address 10.11.12.14 by putting the interfaces.10.11.12.14 file on the SD card on the genlock slave camera and powering on the camera.
If the above link doesn't work with your browser, try the link below, then download the interfaces.10.11.12.14 file.
Customize camera settings
Browse to each slave camera and adjust the settings. There are setting limitations:
- For one-to-one frame lock, each slave has to be set to a frame rate greater than or equal to the master's frame rate.
- The number of post-trigger frames (Frame_rate * Duration * (1 - Pretrigger_percentage/100) must be greater than the master's post-trigger frames. Once a master has filled it's post-trigger buffer, it will momentarily stop sending genlock signals and this will make the slaves unhappy if they still expect to capture more post-trigger frames.
Once all the camera settings are adjusted, do another trial video capture to verify the timing is compatible. The metadata file will indicate if each slave camera was able to maintain genlock.
There are two genlock related settings in each captured video metadata file.
|Camera genlock setting.|
|Indicates if the slave camera was able to maintain genlock throughout the video capture. Set to NA if camera is not configured as a genlock slave.|
There are several metadata file keys whose meaning can be effected when genlock is enabled:
|Frame rate||The master is slowed down slightly to make sure it doesn’t over-run the slave. All that is required is the master period must be greater than or equal to the min period that the slave can run at given the slave's allowed settings. This includes a little fudge factor for clock frequency error and jitter due to cabling.|
|Frame count||The slave may capture more frames than the master, even with identical settings, because of the frame rate adjustment that ensures both cameras stay synchronized.|
|Trigger delay||For the slave camera, trigger delay is meaningless. Trigger delay is reported correctly for when the camera is configured for external genlock.|
The genlock setting is stored on the camera so the value is used the next time you power on the camera. The value is also stored in the metadata file. The possible Genlock values are described below:
|Genlock||Off||Camera will respond to trigger events as normal and generate its own start-of-exposure timing signal.|
|Master||Camera will provide both the genlock trigger and genlock start-of-exposure signals on the External trigger connector.|
|Slave||Camera will get trigger and start-of-exposure from the External trigger connector.|
|External||An external timing source is providing the start-of-exposure signal. The external trigger signal can be used to trigger the camera when configured for external genlock.|
Additional technical details, if you are trying different settings on different cameras:
- Post trigger duration of the master camera has to be as long as the longest post trigger duration of one of the slave cameras.
- Frame rate must be the same on all cameras
- Resolution can be different
Genlock status reporting
Only the genlock slave will report genlock status information, specifically genlock slave timing error. If the slave camera is in genlock, then normal camera status information is provided.
When a slave camera is unable to maintain genlock the camera LED will blink red/white. Once the slave camera is maintaining genlock, the camera LED will stop blinking white after a five second timeout. Entering the calibrating or saving state will clear the blinking white camera LED.
If the slave camera doesn't detect any genlock signal, the camera LED will blink red.
Automation using CAMAPI
The original design concept for genlock was the same for the camera itself - capturing critical videos to get insight into the physical world. The video capture process was anticipated to be through the web user interface and a simple trigger button, which is all that is needed to manually capture a handful of videos. Once the edgertronic camera was integrated into more complex workflows, the use model changed, and additional aspects of the camera's overall operation need to be taken into account.
Although the cameras are in lock-step synchronization for triggering and capturing each frame, there are other aspects of the cameras that are operating asynchronously.
- Local storage - an SD card may be full on one camera, but not on another camera.
- SD card performance is difficult to predict. Even two SD cards in the same packaging bought at the same time might have noticeable different performance characteristics. A new SD card tends to be noticable faster until all the underlying NAND storage has been used once, then the needed erase cycles cause the performance to drop.
- The time it takes a camera to finish the current capture and start putting pre-trigger frames in the next buffer can also be affected by the SD card performance.
If the slave camera is experiencing a genlock timing error, the CAMAPI_FLAG_SLAVE_GENLOCK_ERROR flag (0x40000) bit is set. Once the slave camera is maintaining genlock, the CAMAPI_FLAG_SLAVE_GENLOCK_ERROR flag is cleared after a five second timeout. In addition, entering the calibrating or saving state will clear the CAMAPI_FLAG_SLAVE_GENLOCK_ERROR flag.
- If camera Serial console is enabled, genlock setting is forced to Off.
- If camera is configured a genlock slave, camera will ignore all trigger local events (web UI trigger button, multi-function button, CAMAPI trigger(), etc); expecting a genlock trigger over the External trigger connector.
- Each camera generates its own timing for the calibration cycle.
- When configured as a slave camera, the camera will only use the slave camera's frame rate setting if the genlock start-of-exposure signal is not detected for 100 ms.
- Plugging in genlock cable may trigger both master and slave cameras.
- Unplugging genlock cable may trigger both master and slave cameras.
- Powering off a genlocked camera may trigger any other connected cameras.
If your wiring requirements are longer than 10 meters (30 feet), you will need to use a Genlock Adapter with each camera.
The metadata file on the master camera will contain an entry indicating the delay from the incoming trigger and the start of the first frame following the trigger.
- For genlock to function properly, the slave camera(s) must support a frame rate greater or equal to the master camera's output frame rate. The easiest way to ensure this is to use identical settings on all cameras. The master camera will decrease its maximum allowed frame rate slightly to allow for the slight clock differences that are possible between the master and slave cameras.
The camera can be triggered from three sources:
- UI / API - trigger via CAMAPI trigger() method.
- Multi-function button on back of camera
- Tip of 2.5mm phone jack (I/O connector)
The UI / API trigger() software API, Multi-function button, and Tip of phone jack are logically or-ed together and only the master responds to the trigger event.
|tip||trigger input signal
(3.3V LVCMOS, active low)
|trigger input signal
(3.3V LVCMOS, active low)
|unused||trigger input signal|
(3.3V LVCMOS, active low)
|ring||unused||genlock output signal to slave camera(s)
(combined frame start and trigger)
|frame start input signal
(3.3V LVCMOS, active low)
|frame start input signal|
(3.3V LVCMOS, active low)
You can use the cable listed below to genlock two cameras (which does not support external trigger via wired remote).
Steren 252-612 12' 2.5mm Male to 2.5mm Male
To genlock 3 to 5 cameras, or to use an switch closure to trigger the master, you will need to make your own cable. To have an external trigger,you will need to make a custom cable. The signalling from the master genlock camera can drive up to 4 slave genlock cameras. If you need to connect more than 4 slave genlock cameras, then you will need to increase the drive by using an active cable with a 3.3V LVCMOS buffer. You can get 5v from the USB port, but will need to step it down to 3.3V before powering the VLCMOS buffer. If this doesn't make sense to you, then please use Genlock Adapters to drive more than 4 slave genlock cameras.
If you are making your own cable, note that the wired trigger we supply will ground both the tip and ring when the button is pressed. Connect the trigger's tip and sleeve to the master camera tip and sleeve respectively, and DO NOT connect the trigger ring to either camera. Look at the table above and you'll understand why.
If you are having problems with your cabling, test out genlock using the supplied 12' 2.5mm male-male genlock camera between the master and one slave. Setup the two cameras in the UI, and then trigger the master from the UI. Both cameras should be synced and trigger at the same instant. If you are having problems when using your custom cabling, please check your wiring.
Electrically, the tip and ring are identical circuits, with the exception that the tip is always an input, while the ring is an output in genlock master mode and an input in all other modes. Each signal has a 4.7K pullup to 3.3V, followed by a 165 Ohm series resistor. The other end of the 165 Ohm resistor connects to an ESD diode clamping array (GND and 3.3V), an FPGA 3.3V LVCMOS GPIO and an SOC LVCMOS 3.3V IO.