cameralink base 接口双通道任意图像数据源模拟

2022-12-21,,,,

设备说明

PCIe-CLS2000是基于PCIe 接口的2通道 camera link base接口图像模拟源,适用于图像数据源模拟、接收处理平台测试等场景。

PCIe Gen2x4/x8 接口,支持3GB/s吞吐率;
板载2GB 缓存;
2 通道标准cameralink base通路,可以独立工作,支持5-85Mhz不同速率 cameralink;
2通道均支持 8bit,10bit,12bit,16bit像素格式;
2通道均支持 1X2-1Y,1X3-1Y时序;
2通道均支持 LVAL, FVAL时序设置,可以软件调节时序;
2通道均支持CC1-CC4输入,可以作为触发源使用;
2通道均支持硬件触发、软件触发设置,即触发信号到来之后发送指定帧数;
配有测试板,可以将camrelink LVDS信号线引出到示波器观察,极大的方便测试

camera link硬件说明

背景说明

Camera Link is a serial communication protocol standard designed for camera interface applications based on the National Semiconductor interface Channel-link. It was designed for the purpose of standardizing scientific and industrial video products including cameras, cables and frame grabbers.

Camera Link is currently the recommended standard interface for data rates from 100 MB/s to about 800 MB/s

Camera Link基于LVDS、Channel Link技术, Channel Link是一个工业串并转换协议标准。Camera link接口主要用于工业、科学相机,定义有专用接插件与线缆。

图 2‑1 camera link框图,以上截图只是包含了BASE接口

线缆与屏蔽设计说明

MDR26标准接口、线缆,市场上很容易买到。

PIN脚说明

PIN脚说明截图来自camera link协议标准

驱动芯片说明

我们选用支持速度最高的芯片系列,288A最高可以支持到85MHz。

硬件设计框架

采用FMC子母板的形式,子板使用LPC标准接插件与FPGA母板连接,子板实现2路标准cameralink base输出,接插件采用SDR26 pin脚。

图 2‑2 CLS2000子板设计框架

FMC 采用LPC接插件;
对外接插件由于板卡尺寸原因,选用SDR26,而非MDR26;
DC90CR28A 是camera link专用的并串转换芯片,配合标准线缆,最高能够支持到85MHZ像素时钟;
DS90LV032A是TI的差分转单端芯片,负责将SDR26接口的CC1,CC2,CC3,CC4的差分输入信号转成单端输入信号,CC控制信号可以用作外部触发输入;
SerTFG, SerTC是UART接口,用作与simulator的串口通讯;

camera link部分原理图

注意其中CC1-CC4固定设置为输入,将差分信号转成单端信号送给主控芯片。

camera link线缆说明

线缆、接插件的选用对于系统的最终性能测试非常关键,因此要求较高的系统必须选用可靠的线缆,推荐使用市场标准线缆,尽可能不要自定义线缆。

接插件MDR26

采用MDR26接插件,共26个pin脚,

线缆及其测试

关键术语参考

Pixel Depth

像素采样深度,一般有8,10,12,14,16几种选择,指代一个像素对应的bit位数;

Pixel Clock

cameralink的时钟,时钟应当允许被disable,时钟支持5-85MHz不同速率;

Taps/ Geometry

https://www.baslerweb.com/fp-1510660945/media/downloads/documents/framegrabber_designers/AW00099004000_ace_beat_Camera_Link_Info_Frm_Grab_Designers.pdf

参考basler 的手册说明,我们的simulator计划支持下面2种格式,其它的格式在未来支持medium模式时再引入。

1X2-1Y表示在X方向,一次发送2个像素,在Y方向,一次发送一行,按照逐行扫描的顺序向外发送。

1X2-1Y Geometry – 8, 10, or 12 Bit Pixel Depth

The characteristics of the 1X2-1Y tap geometry are:

On each cycle of the Camera Link pixel clock, the data for two pixels are transmitted via the Camera Link interface. This is commonly referred to as a "two tap" Camera Link configuration.
The camera will begin transmitting data from sensor line one. It will transmit the data for the first two pixels in line one on the first Camera Link pixel clock cycle, the next two pixels in line one on the second pixel clock cycle, the next two pixels in line one on the third clock cycle, and so on until the line is complete.
When line one is complete, transmission of line two will begin and will proceed in a similar fashion. Data transmission will continue line-by-line until all of the data for the image have been transmitted.

1X3-1Y Geometry – 8 Bit Pixel Depth

Trigger

触发有开始触发、帧触发,触发类型分为立即触发、软件触发、上升沿触发、下降沿触发、高电平触发、低电平触发。

/// <summary>trigger类型</summary>

public enum CL_TRIGGER_TYPE

{

START_TRIGGER = 0,//START TRIGGER,开始触发

FRAME_TRIGGER = 1,//Frame trigger,每来1次,触发一次输出

};

/// <summary>camera link触发模式</summary>

public enum CL_TRIGGER_MODE

{

CL_SOFT_TRIGGER = (0x1 << 0),//software trigger

CL_RISING_EDGE_TRIGGER = (0x1 << 1),//rising edge trigger

CL_FALLING_EDGE_TRIGGER = (0x1 << 2),//falling edge trigger

CL_HIGH_LEVEL_TRIGGER = (0x1 << 3),//high level trigger

CL_LOW_LEVEL_TRIGGER = (0x1 << 4),//low level trigger

CL_IMMEDIATE_TRIGGER = (0x1 << 5)//immediate trigger

};//trigger mode

/// <summary>触发信号来源</summary>

public enum CL_TRIGGER_SOURCE

{

//camera link cc interface

C0_CC1 = 0,

C0_CC2 = 0,

C0_CC3 = 0,

C0_CC4 = 0,

C1_CC1 = 0,

C1_CC2 = 0,

C1_CC3 = 0,

C1_CC4 = 0,

};

Start Trigger 开始触发

The camera can be set to accept an External Acquisition Start Trigger (ExASTrig) input signal, which is used as an enabler for the frame start trigger. When the camera receives a proper ExASTrig signal, its acquisition status will change from "waiting for acquisition start trigger" to "waiting for frame start trigger". When the ExASTrig signal is applied to the camera via the Camera Link interface, it is an LVDS signal as specified for RS-644. The camera can be configured to accept an ExASTrig signal on the CC inputs in the Camera Link interface:

Frame Trigger触发

Frame Trigger触发,开启一帧任务;

The camera can be set to accept an External Frame Start Trigger (ExFSTrig) input signal to control exposure and readout of the camera’s sensor. When the ExFSTrig signal is applied to the camera via the Camera Link interface, it is an LVDS signal as specified for RS-644. By default, the camera will accept an ExFSTrig signal on the CC1 input in the Camera Link interface (pins 9 and 22 of the MDR connector) as specified in the Camera Link standard. The camera can also be configured to accept the ExFSTrig signal on these other CC inputs:

输出模式

Wrapping 循环发送一段数据,中间无间隔,需要手动停止;
Continuous连续向外发送数据,软件必须不断更新数据并写入到板载缓存,需要手动停止;
Finite 向外发送有限点数,发送完成自动停止

驱动安装

在运行范例程序之前需要先安装驱动,目前驱动支持WIN7,WIN10/11,Linux版本请联系开发人员。

安装SeeSharpTools_V1.5.0_Win.msi,双击安装;
安装PCIe2000Installer_V1.0.0.msi,双击安装;

安装完成后,可以打开windows设备管理器,如果可以看到PCIe2000 2 base cameralink simulator,且无黄色感叹号,表明驱动正常安装,且已经正确识别。

图 5‑1 驱动正常安装标志

范例说明

PCIe-CLS2000提供了基础范例程序,用于方便用户测试和二次开发。

单通道测试数据输出

向外输出测试数据,单次只启用一个cameralink通道。

图 6‑1 数据数据时序

图 6‑2 单通道cameralink 测试数据输出

像素时钟,默认20Mhz,范围5-85Mhz;
行数/高度,测试图像的height;
列数/宽度,测试图像的width;
Geometry,测试数据输出的格式,对应像素在线缆的位置;
帧间隔,相邻2帧图像之间的间隔周期数;
行间隔,相邻2行之间的间隔周期数;
Channel ID,camera link的通道序号,0对应camera link 0 ,1 对一个camera link 1;
FVAL_Setup,FVAL信号相对于LVAL的建立时间,单位为1个时钟周期;
FVAL_Hold,FVAL信号相对于LVAL的保持时间,单位为1个时钟周期;
Initial Value 测试数据第一个像素点的值;
X_Step 行像素的递进值,每隔一个像素递进1个step;
Y_Step 列像素递进值,每隔一行的第一个像素的递进step;
F_Step 第N帧像素的第一个点相对于N-1帧的第一个点的step;
Transfer Mode 发送模式,默认是Finite有限点模式,发送完指定帧的图像后自动停止;
Frames Num 待发送的数据帧数量,最小为1,最大为-1;
已发送Frames 状态指示,已经发送完成的帧数;
启动发送 开始一次发送认为;
停止 停止发送;

双通道测试数据输出

界面参数设置同单通道范例相同,区别是该范例固定单次输出双通道数据;

图 6‑3 双通道测试数据输出

单通道测试数据输出(高速)

单通道测试数据高速输出,使用多线程处理数据的写入,避免像素时钟较高时,上位机写入数据速度慢导致的数据下溢出。

图 6‑4 高速单通道测试数据输出

单通道真实图像输出

输出单色bmp,jpg,raw格式图像,当前程序为客户定制,展示灵活的输出能力。图像数据每一帧会加入一行冗余数据,冗余数据中包含了用户自定义的信息。

图 6‑5 单通道真实图像带冗余数据输出

图 6‑6 待输出图像及其冗余信息格式

cameralink base 接口双通道任意图像数据源模拟的相关教程结束。

《cameralink base 接口双通道任意图像数据源模拟.doc》

下载本文的Word格式文档,以方便收藏与打印。