Edgertronic multi-camera synchronization genlock
Note: Genlock terminology changed in software release v2.5.2. The change was done in a way that is backwards compatible for controlling applications that use CAMAPI.
Genlock is a mode where a source camera provides frame start and trigger signals to one or more receiver cameras. The source and receiver cameras 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 source and distributed to the receivers in manner that causes the source and receiver camera to trigger on the exact same frame.
For each frame that is captured, the cameras go through three phases: exposure, frame data readout and idle. As long as the receiver camera has a positive idle time the receiver will stay in genlock with the source. During the exposure phase and frame data readout phase a receiver camera will ignore start-of-exposure signals from the source.
There are limitations:
- All cameras have to be configured for compatible timing (see below). For one-to-one frame lock, each receiver has to be set to a frame rate that is greater than or equal to the source'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 receiver 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 receiver must be able to keep up with the source. Just because you set the source to 1000 fps doesn't magically make an SC1 set to 1280x1024 able to run faster that 494 fps.
- The receiver must not be set for more post-trigger frames than the source. The source camera only sends genlock timing pulses when it is filling the pre and post trigger buffers. When the source post-trigger buffer is filled, the source will stop sending pulses until it is ready for the next capture. Until then, if a genlock receiver still wants to capture more post-trigger frames, it will loose genlock sync.
The frame timing and trigger are sent on a single wire in the IO (external trigger) connector. In the simplest setup, with one source and one receiver camera, 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.
You can also use an accessory product, the Genlock Adapter for longer cabling runs and/or supporting more than 2 genlocked cameras.
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. For initial configuration, plug the PC and one receiver camera into the network switch. Leave the PC configured for network IP address 10.11.12.1 and the genlock source camera configured for network IP address 10.11.12.13. Each receiver camera needs a different, unique IP address, such as 10.11.12.14, 10.11.12.15, etc. Refer to the network setup instructions to see how to set each receiver camera's IP address. Remember you can only have one receiver connected at a time when setting the camera's IP address. Once all receiver cameras have been configured, plug all cameras into the network switch. There is no need to power off the cameras.
Browse to the camera you chose to generate the genlock source; from the above instructions it will be at http://10.11.12.13. Configure the camera settings with genlock being configured as source. Then browse to each receiver camera and configure each one with identical settings, except of course set genlock to receiver. Once configured and properly cabled, 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 receiver camera isn't receiving a genlock signal.
Once the cameras are wired, configured, and triggerable, go ahead and trigger the source camera to verify the receiver 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.
Customize camera settings
Browse to each receiver camera and adjust the settings. There are setting limitations:
- For one-to-one frame lock, each receiver has to be set to a frame rate greater than or equal to the source's frame rate.
- The number of post-trigger frames (Frame_rate * Duration * (1 - Pretrigger_percentage/100) must be greater than the source's post-trigger frames. Once a source has filled it's post-trigger buffer, it will momentarily stop sending genlock signals and this will make the receivers 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 receiver camera was able to maintain genlock.
Additional technical details, if you are trying different settings on different cameras:
- Post trigger duration of the source camera has to be as long as the longest post trigger duration of one of the receiver cameras.
- Frame rate must be the same on all cameras
- Resolution can be different
There are two genlock related settings in each captured video metadata file.
|Camera genlock setting.|
|Indicates if the receiver camera was able to maintain genlock throughout the video capture. Set to NA if camera is not configured as a genlock receiver.|
There are several metadata file keys whose meaning can be effected when genlock is enabled:
|Frame rate||The source is slowed down slightly to make sure it doesn’t over-run the receiver. All that is required is the source period must be greater than or equal to the min period that the receiver can run at given the receiver's allowed settings. This includes a little fudge factor for clock frequency error and jitter due to cabling.|
|Frame count||The receiver may capture more frames than the source, even with identical settings, because of the frame rate adjustment that ensures both cameras stay synchronized.|
|Trigger delay||For the receiver 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 available 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.|
|Source||Camera will provide both the genlock trigger and genlock start-of-exposure signals on the External trigger connector.|
|Receiver||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.|
Genlock status reporting
Only the genlock receiver will report genlock status information, specifically genlock receiver timing error. If the receiver camera is in genlock, then normal camera status information is provided. Genlock status reporting is provided via the LEDs and CAMAPI get_camstatus() API.
When a receiver camera is unable to maintain genlock the camera LED will blink red/white. Once the receiver 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 receiver 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 receiver camera is experiencing a genlock timing error, the CAMAPI get_camstatus() API returns a dictionary containing the flags keyword with CAMAPI_FLAG_RECEIVER_GENLOCK_ERROR flag (0x40000) bit is set. Once the receiver camera is maintaining genlock, the CAMAPI_FLAG_RECEIVER_GENLOCK_ERROR flag is cleared after a five second timeout. In addition, entering the calibrating or saving state will clear the CAMAPI_FLAG_RECEIVER_GENLOCK_ERROR flag.
- If camera Serial console is enabled, genlock setting is forced to Off.
- If camera is configured as a genlock receiver, camera will ignore all trigger local events (web UI trigger button, multi-function button, CAMAPI trigger() invocation, etc); expecting a genlock trigger over the External trigger connector.
- Each camera generates its own timing for the calibration cycle.
- When configured as a receiver camera, the camera will only use the receiver 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 source and receiver cameras.
- Unplugging genlock cable may trigger both source and receiver 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 source camera will contain an entry indicating the delay from the incoming trigger and the start of the first frame following the trigger. The trigger delay value in the metadata file created by the receiver cameras is meaningless.
- For genlock to function properly, the receiver camera(s) must support a frame rate greater or equal to the source camera's output frame rate. The easiest way to ensure this is to use identical settings on all cameras. The source camera will decrease its maximum allowed frame rate slightly to allow for the slight clock differences that are possible between the source and receiver cameras.
The camera can be triggered from three sources:
- UI / API - trigger via CAMAPI trigger() API.
- Multi-function button on back of camera
- Tip of 2.5mm phone jack (I/O connector)
- If using a Genlock Adapter - tip of the 2.5mm phone jack labeled TRIGGER IN.
The UI / CAMAPI trigger() API, Multi-function button, and Tip of phone jack are logically or-ed together and only the source camera 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 receiver 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
- Generic 3 conductor 2.5mm male to 2.5mm male patch cord cable
We recommend if you are going to genlock more than 2 cameras, use Genlock Adapters. If you are good with a soldering iron, you can make your own custom cable. To genlock 3 to 5 cameras, or to use an switch closure to trigger the source, 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 source genlock camera can drive up to 4 receiver genlock cameras. If you need to connect more than 4 receiver 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 receiver 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 source 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 source camera and one receiver camera. Setup the two cameras in the UI, and then trigger the source 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 on the genlock source camera and an input on all genlock receiver cameras. 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.