![](https://csdnimg.cn/release/download_crawler_static/88779505/bg1.jpg)
OV5640 Auto FocusCamera Module Application Notes
OV5640 Auto Focus Camera Module Application Notes
(with MIPI Interface)
Last Modified: Feb. 21
nd
, 2012
Document Revision: 2.15
OmniVision Technologies, Inc. reserves the right to make changes without further notice to
any product herein to improve reliability, function or design. OmniVision does not assume
any liability arising out of the application or use of any project, circuit described herein;
neither does it convey any license under its patent nor the right of others.
This document contains information of a proprietary nature. None of this information shall be
divulged to persons other than OmniVision Technologies, Inc. employee authorized by the nature of
their duties to receive such information, or individuals or organizations authorized by OmniVision
Technologies, Inc.
1 Company Confidential
Confidential For 维讯 Only
![](https://csdnimg.cn/release/download_crawler_static/88779505/bg2.jpg)
OV5640 Auto FocusCamera Module Application Notes
内容目录
1. Overview of OV5640 Application....................................................................................................4
2. Hardware Design..............................................................................................................................5
2.1 OV5640 Camera Module Reference Design.............................................................................5
2.2 Host Interface.............................................................................................................................6
2.1.1 Pin Definition.....................................................................................................................6
2.2 Power Supply.............................................................................................................................6
2.3 Deal with Lens...........................................................................................................................7
2.3.1 Light fall off.......................................................................................................................7
2.3.2 Dark corner........................................................................................................................7
2.3.3 Resolution..........................................................................................................................7
2.3.4 Optical contrast..................................................................................................................7
2.3.5 Lens Cover.........................................................................................................................7
2.3.6 Lens Correction..................................................................................................................7
2.3.6.1 Lens Correction:.........................................................................................................7
2.3.6.2 Lens Correction: ........................................................................................................7
3. Hardware Operation.........................................................................................................................8
3.1 Operation Modes........................................................................................................................8
3.1.1 Power Up............................................................................................................................8
3.1.2 Power Down.......................................................................................................................9
3.1.3 Wake up from Power down................................................................................................9
3.1.4 Power OFF ........................................................................................................................9
3.1.5 Hardware Reset................................................................................................................10
3.2 Operations................................................................................................................................10
3.2.1 Cut of power when not used............................................................................................10
3.2.2 Power down when not used.............................................................................................10
3.2.3 OV5640 share I2C bus with other devices.......................................................................10
4. Software Operation.........................................................................................................................11
4.1 1 Lane MIPI Interface..............................................................................................................11
4.1.1 YCbCr Initial Setting........................................................................................................11
4.1.2 YCbCr VGA Preview @ 30fps........................................................................................16
4.1.3 YCbCr 720p Video @ 30fps............................................................................................17
4.1.4 YCbCr 5M Capture @ 7.5fps...........................................................................................18
4.2 2 Lane MIPI Interface..............................................................................................................20
4.2.1 YCbCr Initial Setting.......................................................................................................20
4.2.2 YCbCr VGA Preview @ 30fps........................................................................................25
4.2.3 YCbCr 720p @ 60fps.......................................................................................................26
4.2.4 YCbCr 5M Capture @ 15fps............................................................................................27
4.3 Drive Capability.......................................................................................................................28
4.4 I/O Control...............................................................................................................................28
4.5 MIPI Stream Control...............................................................................................................29
4.5.1 MIPI Stream on................................................................................................................29
4.5.2 MIPI Stream off...............................................................................................................29
4.6 YUV Sequence ........................................................................................................................29
4.7 Mirror and Flip.........................................................................................................................30
4.8 Test Pattern...............................................................................................................................31
4.9 Remove Light Band.................................................................................................................31
2 Company Confidential
Confidential For 维讯 Only
![](https://csdnimg.cn/release/download_crawler_static/88779505/bg3.jpg)
OV5640 Auto FocusCamera Module Application Notes
4.10 User Interface Functions........................................................................................................32
4.10.1 Brightness.......................................................................................................................32
4.10.2 Contrast..........................................................................................................................33
4.10.3 Saturation.......................................................................................................................34
4.10.4 EV..................................................................................................................................37
4.10.5 Light Mode.....................................................................................................................38
4.10.6 Special Effects................................................................................................................39
4.10.7 Night Mode....................................................................................................................41
4.10.8 Banding Filter Selection.................................................................................................41
4.11 Auto Focus.............................................................................................................................42
4.11.1 Embedded Auto Focus Solution....................................................................................42
4.11.2 I2C Commands for Auto Focus......................................................................................42
4.11.3 AF Sequence ..................................................................................................................43
4.11.4 Download firmware.......................................................................................................43
4.11.5 Auto focus.....................................................................................................................43
4.11.6 Release Focus................................................................................................................43
4.12 Capture Sequence..................................................................................................................43
4.12.1 Shutter............................................................................................................................43
4.12.2 Gain................................................................................................................................44
4.12.3 Dummy Lines and Dummy Pixels.................................................................................44
4.12.4 Capture Sequence...........................................................................................................44
4.12.4.1 Auto Focus..............................................................................................................44
4.12.4.2 Read Preview Registers..........................................................................................44
4.12.4.3 Change Resolution to Capture................................................................................44
4.12.4.4 Read Capture Register Values................................................................................44
4.12.4.5 Preview Gain/Exposure to Capture/Gain Exposure...............................................45
4.12.4.6 Gain to Exposure and Capture Banding Filter.......................................................45
4.12.4.7 Write gain/exposure value......................................................................................45
4.12.4.8 Capture...................................................................................................................46
4.12.4.9 Back to Preview......................................................................................................46
4.13 Scale and Zoom.....................................................................................................................46
4.13.1 Scale...............................................................................................................................46
4.13.2 Digital Zoom..................................................................................................................47
Appendix I Sample Code of Camera Driver for 2 Lane MIPI...........................................................49
Revision History.................................................................................................................................65
3 Company Confidential
Confidential For 维讯 Only
![](https://csdnimg.cn/release/download_crawler_static/88779505/bg4.jpg)
OV5640 Auto FocusCamera Module Application Notes
1. Overview of OV5640 Application
OV5640 is a 1/4 inch high performance 5M camera supporting both DVP and MIPI interface. This
document focus on DVP interface application of OV5640. For MIPI interface application of
OV5640, please read “OV5640 Camera Module Application Notes (with MIPI interface)”
OV5640 could be used as
5M Main Camera for Cellular Phone Applications
5M Main Camera for Tablet Applications
4 Company Confidential
Confidential For 维讯 Only
![](https://csdnimg.cn/release/download_crawler_static/88779505/bg5.jpg)
OV5640 Auto FocusCamera Module Application Notes
2. Hardware Design
2.1 OV5640 Camera Module Reference Design
Note:
1. PWND, active HIGH as DOVDD to power down OV5640, should be connected to ground
outside of module if unused
2. RESETB. Active LOW to reset OV5640, should be connected to DOVDD outside of
module if unused
3. AVDD is 2.6-3.0V of sensor analog power (clean). 2.8V is recommended. AVDD must be
2.5V+-5% for OTP write, and OTP read does not have such requirement
4. DVDD is 1.5V±5% of sensor digital power(clean). Using the internal DVDD regulator is
strongly recommended
5. DOVDD. 1.8V recommended is 1.7V-3.0V of sensor digital IO power(clean)
6. sensor AGND and DGND should be separated and connected to a single point outside
module, Do not connect it inside module
7. Capacitors should be close to the related sensor pins
8. MCP, MCN, MDP0 and MDP1 are 1 lane MIPI interface. MCP, MCN, MDP0, MDN0,
MDP1 and MCP1 are 2 lane MIPI interface.
5 Company Confidential
Confidential For 维讯 Only