最近项目在调试AR0134摄像头,无奈资料太少,只能摸索。AR0134是ON Semiconductor公司的一款全局快门的摄像头。1/3-inch 1.2 Mp CMOS digital image sensor with an active-pixel array of 1280 (H) ×960 (V)。It is designed for low light performance and features a global shutter for accurate capture of moving scenes. It includes sophisticated
camera functions such as auto exposure control, windowing, scaling, row skip mode, and both video and single frame modes. It is programmable through a simple two-wire serial interface. The AR0134CS produces extraordinarily clear, sharp digital pictures, and its ability to capture both continuous video and single frames makes it the perfect choice for a wide —range of applications, including scanning and industrial inspection.
默认的时序图如图所示:
在FV(frame valid)为高且LV(line valid)为高时,每一个pixclk 的上升沿输出一个12bit的像素数据,这个像素数据是sensor中单个感光元件输出的数据,只代表R,G,B中的一种。
AR0134可以工作在master (video) 模式,也可以工作在trigger (single frame)模式。本次使用就是在master模式,master模式下的自动曝光模式,时序图如下:
FLASH能控制外接闪光灯来进行补光操作。
先配置PLL,控制像素时钟频率,在控制输出的像素格式。需要注意的是配置锁相环的时候,每个参数都有取值范围,要合理的取值,按照720行的配置=Y_ADDR_END -Y_ADDR_START +1=843-124+1=720的配置参数,,最终测试为1280*720@60P.
补充:
在自动曝光模式下,要输出4行statistical data,加上720行像素数据,因此实际输出有724行的数据,所以在计算FRAME_LENGTH_LINES 时要小心。
////////////////////////////////////////////////////////////////////
///////////////////// Config Data LUT //////////////////////////
//AR0134
//1280*720 24M晶振, 输出74.25M,帧率60 --- by me
//The VCO frequency, defined as fVCO = fEXTCLK × M/N must be within 384-768 MHz.
// 32 ≤ M ≤ 255
// 1 ≤ N ≤ 63
// 1 ≤ P1≤ 16
// 4≤ P2 ≤ 16
// 74.25MHz =24MHz * M /N /P1/P2
// 74.25MHz =24MHz * 198 /8 /2 /4
always @(*)
begin
case(LUT_INDEX)
// [PLL_settings]
0 : LUT_DATA<={16'h3028, 16'h0010}; //ROW_SPEED = 16 // The launch edge of PIXCLK may be set in register R0x3028.
1 : LUT_DATA<={16'h302A, 16'h0004}; //P2=4
2 : LUT_DATA<={16'h302C, 16'h0002}; //P1=2
3 : LUT_DATA<={16'h302E, 16'h0008}; //N=8
4 : LUT_DATA<={16'h3030, 16'h00C6}; //M=198
5 : LUT_DATA<={16'h3032, 16'h0000}; //DIGITAL_BINNING = 0
6 : LUT_DATA<={16'h30B0, 16'h0080}; //DIGITAL_TEST = 128
// [Timing_settings]
8 : LUT_DATA<={16'h301A, 16'h00D8}; //RESET_REGISTER = 216
9 : LUT_DATA<={16'h301A, 16'h10DC}; //RESET_REGISTER = 4316 h10DC
10 : LUT_DATA<={16'h3002, 16'h007C}; //Y_ADDR_START = 124
11 : LUT_DATA<={16'h3004, 16'h0002}; //X_ADDR_START = 2
12 : LUT_DATA<={16'h3006, 16'h034B}; //Y_ADDR_END = 843
13 : LUT_DATA<={16'h3008, 16'h0501}; //X_ADDR_END = 1281
14 : LUT_DATA<={16'h300A, 16'h0380}; //FRAME_LENGTH_LINES = 896 //需要仔细计算的一个参数
15 : LUT_DATA<={16'h300C, 16'h056C}; //LINE_LENGTH_PCK = 1388
16 : LUT_DATA<={16'h3012, 16'h008C}; //COARSE_INTEGRATION_TIME = 252 h00FC 曝光时间
17 : LUT_DATA<={16'h3014, 16'h00E9}; //FINE_INTEGRATION_TIME = 233
18 : LUT_DATA<={16'h30A6, 16'h0001}; //Y_ODD_INC = 1
19 : LUT_DATA<={16'h308C, 16'h007C}; //Y_ADDR_START_CB = 124
20 : LUT_DATA<={16'h308A, 16'h0002}; //X_ADDR_START_CB = 2
21 : LUT_DATA<={16'h3090, 16'h034B}; //Y_ADDR_END_CB = 843
22 : LUT_DATA<={16'h308E, 16'h0501}; //X_ADDR_END_CB = 1281
23 : LUT_DATA<={16'h30AA, 16'h0345}; //FRAME_LENGTH_LINES_CB = 837
24 : LUT_DATA<={16'h3018, 16'h00E9}; //FINE_INTEGRATION_TIME_CB = 233
25 : LUT_DATA<={16'h30A8, 16'h0001}; //Y_ODD_INC_CB = 1
26 : LUT_DATA<={16'h3040, 16'hC000}; //READ_MODE = 0,控制图像翻转
27 : LUT_DATA<={16'h3064, 16'h1982}; //EMBEDDED_DATA_CTRL = 6530
28 : LUT_DATA<={16'h31C6, 16'h8008}; //HISPI_CONTROL_STATUS = 32776
29 : LUT_DATA<={16'h3056, 16'd33} ; // Gr_GAIN
30 : LUT_DATA<={16'h3058, 16'd45} ; // BLUE_GAIN
31 : LUT_DATA<={16'h305a, 16'd33} ; // RED_GAIN
32 : LUT_DATA<={16'h305c, 16'd33} ; // Gb_GAIN
33 : LUT_DATA<={16'h3100, 16'h0003} ; //AE;AG
34 : LUT_DATA<={16'h3046, 16'h0100} ; //flash 输出