之前调过一款摄像头,是MT9V034, 最近在调的是OV7725摄像头,感觉OV7725摄像头比MT9V034要难,特别是寄存器配置,要想玩转一款摄像头,必须要熟悉它的寄存器配置,而且要亲自去调试,然后才能对它有很好的理解。下面是自己的一点见解,可能不完全对,不过希望对初学者有所帮助吧。
一、将所有寄存器的值复位到默认值状态。
寄存器地址 寄存器名称 寄存器值
0x12 COM7 0x80 //复位
二、 设置图像输出格式。
寄存器地址 寄存器名称 寄存器值
0x12 COM7 0X40 //QVGA(320*240 ),YUV输出格式
0x29 HOutSize 0X50 // QVGA(320*240), 0x28 (160)
0x2C VOutSize 0X78 // QVGA (320*240),0x3C (120)
0x17 HSTART 0X3F //QVGA(320*240 )
0X18 HSIZE 0X50 //QVGA(320*240 )
0X19 VSTRT 0X03 //QVGA(320*240 )
0X20 VSIZE 0X78 //QVGA(320*240 )
----------------------------------------------------------------------------------------------------------------------------------
12 | COM7 | 00 | RW | Common Control 7 Bit[7]: SCCB Register Reset 0: No change 1: Resets all registers to default values Bit[6]: Resolution selection 0: VGA 1: QVGA Bit[5]: BT.656 protocol ON/OFF selection Bit[4]: Sensor RAW Bit[3:2]: RGB output format control 00: GBR4:2:2 01: RGB565 10: RGB555 11: RGB444 Bit[1:0]: Output format control 00: YUV 01: Processed Bayer RAW 10: RGB 11: Bayer RAW |
1、自动曝光
寄存器地址 寄存器名称 寄存器值
0X0D COM4 0X40 //整个窗口进行自动曝光
--------------------------------------------------------------------------------------------------------------------------
0D | COM4 | 41 | RW | Common Control 4 Bit[7:6]: PLL frequency control 00: Bypass PLL 01: PLL 4x 10: PLL 6x 11: PLL 8x Bit[5:4]: AEC evaluate window 00: Full window 01: 1/2 window 10: 1/4 window 11: Low 2/3 window Bit[3:0]: Reserved |
-------------------------------------------------------------------------------------------------------------------------
13 | COM8 | 8F | RW | Common Control 8 Bit[7]: Enable fast AGC/AEC algorithm Bit[6]: AEC - Step size limit 0: Step size is limited to vertical blank 1: Unlimited step size Bit[5]: Banding filter ON/OFF Bit[4]: Enable AEC below banding value Bit[3]: Fine AEC ON/OFF control Bit[2]: AGC Enable Bit[1]: AWB Enable Bit[0]: AEC Enable |
0X24 AEW 0X40 //控制自动曝光强弱
---------------------------------------------------------------------------------------------------------------------------------------------
24 | AEW | 75 | RW | AGC/AEC - Stable Operating Region (Upper Limit) |
----------------------------------------------------------------------------------------------------------------------------------------------------
25 | AEB | 63 | RW | AGC/AEC - Stable Operating Region (Lower Limit) |
---------------------------------------------------------------------------------------------------------------------------------------------------------------
26 | VPT | D4 | RW | AGC/AEC Fast Mode Operating Region Bit[7:4]: High nibble of upper limit of fast mode control zone Bit[3:0]: High nibble of lower limit of fast mode control zone |
0XA6 SDE 0X24 //使能控制图片亮暗的寄存器
---------------------------------------------------------------------------------------------------------------------------------------
A6 | SDE | 00 | RW | Special Digital Effect Control Bit[7]: Reserved Bit[6]: Negative image enable Bit[5]: Gray scale image enable Bit[4]: V fixed value enable Bit[3]: U fixed value enable Bit[2]: Contrast/Brightness enable Bit[1]: Saturation enable Bit[0]: Hue enable |
0X9B BRIGHT 0X08 //定义自动曝光时图片的亮度增益,此值越大,图片越亮
--------------------------------------------------------------------------------------------------------------------------
9B | BRIGHT | 00 | RW | Brightness Control |
-----------------------------------------------------------------------------------------------------------------------------------
AB | SIGN | 06 | RW | Sign Bit for Hue and Brightness Bit[7:4]: Reserved Bit[3]: Brightness sign bit Bit[2]: Reserved Bit[1]: Sign bit for HueSin (in Cr’ equation) Bit[0]: Sign bit for HueSin (in Cb’ equation) |
-----------------------------------------------------------------------------------------------------------------------
0D | COM4 | 41 | RW | Common Control 4 Bit[7:6]: PLL frequency control 00: Bypass PLL 01: PLL 4x 10: PLL 6x 11: PLL 8x Bit[5:4]: AEC evaluate window 00: Full window 01: 1/2 window 10: 1/4 window 11: Low 2/3 window Bit[3:0]: Reserved |
0x13 COM8 0Xcc // 关闭自动曝光(AEC)
------------------------------------------------------------------------------------------------------------------------------------
13 | COM8 | 8F | RW | Common Control 8 Bit[7]: Enable fast AGC/AEC algorithm Bit[6]: AEC - Step size limit 0: Step size is limited to vertical blank 1: Unlimited step size Bit[5]: Banding filter ON/OFF Bit[4]: Enable AEC below banding value Bit[3]: Fine AEC ON/OFF control Bit[2]: AGC Enable Bit[1]: AWB Enable Bit[0]: AEC Enable |
08 | AECH | 00 | RW | Exposure Value – AEC MSBs Bit[7:0]: AEC[15:8] (see register AECfor AEC[7:0 Automatically updated based on chip output format |
0x10 AEC 0X40 //曝光值得低8位
---------------------------------------------------------------------------------------------------------------------------------------------------
10 | AEC | 40 | RW | Exposure Value Bit[7:0]: AEC[7:0] (see register AECHfor AEC[15:8]) |