749 lines
22 KiB
C
749 lines
22 KiB
C
#ifndef _OV5640_SETTINGS_H_
|
|
#define _OV5640_SETTINGS_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "ov5640_regs.h"
|
|
|
|
static const ratio_settings_t ratio_table[] = {
|
|
// mw, mh, sx, sy, ex, ey, ox, oy, tx, ty
|
|
{ 2560, 1920, 0, 0, 2623, 1951, 32, 16, 2844, 1968 }, //4x3
|
|
{ 2560, 1704, 0, 110, 2623, 1843, 32, 16, 2844, 1752 }, //3x2
|
|
{ 2560, 1600, 0, 160, 2623, 1791, 32, 16, 2844, 1648 }, //16x10
|
|
{ 2560, 1536, 0, 192, 2623, 1759, 32, 16, 2844, 1584 }, //5x3
|
|
{ 2560, 1440, 0, 240, 2623, 1711, 32, 16, 2844, 1488 }, //16x9
|
|
{ 2560, 1080, 0, 420, 2623, 1531, 32, 16, 2844, 1128 }, //21x9
|
|
{ 2400, 1920, 80, 0, 2543, 1951, 32, 16, 2684, 1968 }, //5x4
|
|
{ 1920, 1920, 320, 0, 2543, 1951, 32, 16, 2684, 1968 }, //1x1
|
|
{ 1088, 1920, 736, 0, 1887, 1951, 32, 16, 1884, 1968 } //9x16
|
|
};
|
|
|
|
#define REG_DLY 0xffff
|
|
#define REGLIST_TAIL 0x0000
|
|
|
|
static const uint16_t sensor_default_regs_backup[][2] = {
|
|
{SYSTEM_CTROL0, 0x82}, // software reset
|
|
{REG_DLY, 10}, // delay 10ms
|
|
{SYSTEM_CTROL0, 0x42}, // power down
|
|
|
|
//enable pll
|
|
{0x3103, 0x13},
|
|
|
|
//io direction
|
|
{0x3017, 0xff},
|
|
{0x3018, 0xff},
|
|
|
|
{DRIVE_CAPABILITY, 0xc3},
|
|
{CLOCK_POL_CONTROL, 0x21},
|
|
|
|
{0x4713, 0x02},//jpg mode select
|
|
|
|
{ISP_CONTROL_01, 0x83}, // turn color matrix, awb and SDE
|
|
|
|
//sys reset
|
|
{0x3000, 0x20}, // reset MCU
|
|
{REG_DLY, 10}, // delay 10ms
|
|
{0x3002, 0x1c},
|
|
|
|
//clock enable
|
|
{0x3004, 0xff},
|
|
{0x3006, 0xc3},
|
|
|
|
//isp control
|
|
{0x5000, 0xa7},
|
|
{ISP_CONTROL_01, 0xa3},//+scaling?
|
|
{0x5003, 0x08},//special_effect
|
|
|
|
//unknown
|
|
{0x370c, 0x02},//!!IMPORTANT
|
|
{0x3634, 0x40},//!!IMPORTANT
|
|
|
|
//AEC/AGC
|
|
{0x3a02, 0x03},
|
|
{0x3a03, 0xd8},
|
|
{0x3a08, 0x01},
|
|
{0x3a09, 0x27},
|
|
{0x3a0a, 0x00},
|
|
{0x3a0b, 0xf6},
|
|
{0x3a0d, 0x04},
|
|
{0x3a0e, 0x03},
|
|
{0x3a0f, 0x30},//ae_level
|
|
{0x3a10, 0x28},//ae_level
|
|
{0x3a11, 0x60},//ae_level
|
|
{0x3a13, 0x43},
|
|
{0x3a14, 0x03},
|
|
{0x3a15, 0xd8},
|
|
{0x3a18, 0x00},//gainceiling
|
|
{0x3a19, 0xf8},//gainceiling
|
|
{0x3a1b, 0x30},//ae_level
|
|
{0x3a1e, 0x26},//ae_level
|
|
{0x3a1f, 0x14},//ae_level
|
|
|
|
//vcm debug
|
|
{0x3600, 0x08},
|
|
{0x3601, 0x33},
|
|
|
|
//50/60Hz
|
|
{0x3c01, 0xa4},
|
|
{0x3c04, 0x28},
|
|
{0x3c05, 0x98},
|
|
{0x3c06, 0x00},
|
|
{0x3c07, 0x08},
|
|
{0x3c08, 0x00},
|
|
{0x3c09, 0x1c},
|
|
{0x3c0a, 0x9c},
|
|
{0x3c0b, 0x40},
|
|
|
|
{0x460c, 0x22},//disable jpeg footer
|
|
|
|
//BLC
|
|
{0x4001, 0x02},
|
|
{0x4004, 0x02},
|
|
|
|
//AWB
|
|
{0x5180, 0xff},
|
|
{0x5181, 0xf2},
|
|
{0x5182, 0x00},
|
|
{0x5183, 0x14},
|
|
{0x5184, 0x25},
|
|
{0x5185, 0x24},
|
|
{0x5186, 0x09},
|
|
{0x5187, 0x09},
|
|
{0x5188, 0x09},
|
|
{0x5189, 0x75},
|
|
{0x518a, 0x54},
|
|
{0x518b, 0xe0},
|
|
{0x518c, 0xb2},
|
|
{0x518d, 0x42},
|
|
{0x518e, 0x3d},
|
|
{0x518f, 0x56},
|
|
{0x5190, 0x46},
|
|
{0x5191, 0xf8},
|
|
{0x5192, 0x04},
|
|
{0x5193, 0x70},
|
|
{0x5194, 0xf0},
|
|
{0x5195, 0xf0},
|
|
{0x5196, 0x03},
|
|
{0x5197, 0x01},
|
|
{0x5198, 0x04},
|
|
{0x5199, 0x12},
|
|
{0x519a, 0x04},
|
|
{0x519b, 0x00},
|
|
{0x519c, 0x06},
|
|
{0x519d, 0x82},
|
|
{0x519e, 0x38},
|
|
|
|
//color matrix (Saturation)
|
|
{0x5381, 0x1e},
|
|
{0x5382, 0x5b},
|
|
{0x5383, 0x08},
|
|
{0x5384, 0x0a},
|
|
{0x5385, 0x7e},
|
|
{0x5386, 0x88},
|
|
{0x5387, 0x7c},
|
|
{0x5388, 0x6c},
|
|
{0x5389, 0x10},
|
|
{0x538a, 0x01},
|
|
{0x538b, 0x98},
|
|
|
|
//CIP control (Sharpness)
|
|
{0x5300, 0x10},//sharpness
|
|
{0x5301, 0x10},//sharpness
|
|
{0x5302, 0x18},//sharpness
|
|
{0x5303, 0x19},//sharpness
|
|
{0x5304, 0x10},
|
|
{0x5305, 0x10},
|
|
{0x5306, 0x08},//denoise
|
|
{0x5307, 0x16},
|
|
{0x5308, 0x40},
|
|
{0x5309, 0x10},//sharpness
|
|
{0x530a, 0x10},//sharpness
|
|
{0x530b, 0x04},//sharpness
|
|
{0x530c, 0x06},//sharpness
|
|
|
|
//GAMMA
|
|
{0x5480, 0x01},
|
|
{0x5481, 0x00},
|
|
{0x5482, 0x1e},
|
|
{0x5483, 0x3b},
|
|
{0x5484, 0x58},
|
|
{0x5485, 0x66},
|
|
{0x5486, 0x71},
|
|
{0x5487, 0x7d},
|
|
{0x5488, 0x83},
|
|
{0x5489, 0x8f},
|
|
{0x548a, 0x98},
|
|
{0x548b, 0xa6},
|
|
{0x548c, 0xb8},
|
|
{0x548d, 0xca},
|
|
{0x548e, 0xd7},
|
|
{0x548f, 0xe3},
|
|
{0x5490, 0x1d},
|
|
|
|
//Special Digital Effects (SDE) (UV adjust)
|
|
{0x5580, 0x06},//enable brightness and contrast
|
|
{0x5583, 0x40},//special_effect
|
|
{0x5584, 0x10},//special_effect
|
|
{0x5586, 0x20},//contrast
|
|
{0x5587, 0x00},//brightness
|
|
{0x5588, 0x00},//brightness
|
|
{0x5589, 0x10},
|
|
{0x558a, 0x00},
|
|
{0x558b, 0xf8},
|
|
{0x501d, 0x40},// enable manual offset of contrast
|
|
|
|
//power on
|
|
{0x3008, 0x02},
|
|
|
|
//50Hz
|
|
{0x3c00, 0x04},
|
|
|
|
{REG_DLY, 300},
|
|
{REGLIST_TAIL, 0x00}, // tail
|
|
};
|
|
|
|
static const uint16_t sensor_fmt_jpeg[][2] = {
|
|
{FORMAT_CTRL, 0x00}, // YUV422
|
|
{FORMAT_CTRL00, 0x30}, // YUYV
|
|
{0x3002, 0x00},//0x1c to 0x00 !!!
|
|
{0x3006, 0xff},//0xc3 to 0xff !!!
|
|
{0x471c, 0x50},//0xd0 to 0x50 !!!
|
|
{REGLIST_TAIL, 0x00}, // tail
|
|
};
|
|
|
|
static const uint16_t sensor_fmt_raw[][2] = {
|
|
{FORMAT_CTRL, 0x03}, // RAW (DPC)
|
|
{FORMAT_CTRL00, 0x00}, // RAW
|
|
{REGLIST_TAIL, 0x00}
|
|
};
|
|
|
|
static const uint16_t sensor_fmt_grayscale[][2] = {
|
|
{FORMAT_CTRL, 0x00}, // YUV422
|
|
{FORMAT_CTRL00, 0x10}, // Y8
|
|
{REGLIST_TAIL, 0x00}
|
|
};
|
|
|
|
static const uint16_t sensor_fmt_yuv422[][2] = {
|
|
{FORMAT_CTRL, 0x00}, // YUV422
|
|
{FORMAT_CTRL00, 0x30}, // YUYV
|
|
{REGLIST_TAIL, 0x00}
|
|
};
|
|
|
|
static const uint16_t sensor_fmt_rgb565[][2] = {
|
|
{FORMAT_CTRL, 0x01}, // RGB
|
|
{FORMAT_CTRL00, 0x61}, // RGB565 (BGR)
|
|
{REGLIST_TAIL, 0x00}
|
|
};
|
|
|
|
static const uint8_t sensor_saturation_levels[9][11] = {
|
|
{0x1d, 0x60, 0x03, 0x07, 0x48, 0x4f, 0x4b, 0x40, 0x0b, 0x01, 0x98},//-4
|
|
{0x1d, 0x60, 0x03, 0x08, 0x54, 0x5c, 0x58, 0x4b, 0x0d, 0x01, 0x98},//-3
|
|
{0x1d, 0x60, 0x03, 0x0a, 0x60, 0x6a, 0x64, 0x56, 0x0e, 0x01, 0x98},//-2
|
|
{0x1d, 0x60, 0x03, 0x0b, 0x6c, 0x77, 0x70, 0x60, 0x10, 0x01, 0x98},//-1
|
|
{0x1d, 0x60, 0x03, 0x0c, 0x78, 0x84, 0x7d, 0x6b, 0x12, 0x01, 0x98},//0
|
|
{0x1d, 0x60, 0x03, 0x0d, 0x84, 0x91, 0x8a, 0x76, 0x14, 0x01, 0x98},//+1
|
|
{0x1d, 0x60, 0x03, 0x0e, 0x90, 0x9e, 0x96, 0x80, 0x16, 0x01, 0x98},//+2
|
|
{0x1d, 0x60, 0x03, 0x10, 0x9c, 0xac, 0xa2, 0x8b, 0x17, 0x01, 0x98},//+3
|
|
{0x1d, 0x60, 0x03, 0x11, 0xa8, 0xb9, 0xaf, 0x96, 0x19, 0x01, 0x98},//+4
|
|
};
|
|
|
|
static const uint8_t sensor_special_effects[7][4] = {
|
|
{0x06, 0x40, 0x2c, 0x08},//Normal
|
|
{0x46, 0x40, 0x28, 0x08},//Negative
|
|
{0x1e, 0x80, 0x80, 0x08},//Grayscale
|
|
{0x1e, 0x80, 0xc0, 0x08},//Red Tint
|
|
{0x1e, 0x60, 0x60, 0x08},//Green Tint
|
|
{0x1e, 0xa0, 0x40, 0x08},//Blue Tint
|
|
{0x1e, 0x40, 0xa0, 0x08},//Sepia
|
|
};
|
|
|
|
static const uint16_t sensor_regs_gamma0[][2] = {
|
|
{0x5480, 0x01},
|
|
{0x5481, 0x08},
|
|
{0x5482, 0x14},
|
|
{0x5483, 0x28},
|
|
{0x5484, 0x51},
|
|
{0x5485, 0x65},
|
|
{0x5486, 0x71},
|
|
{0x5487, 0x7d},
|
|
{0x5488, 0x87},
|
|
{0x5489, 0x91},
|
|
{0x548a, 0x9a},
|
|
{0x548b, 0xaa},
|
|
{0x548c, 0xb8},
|
|
{0x548d, 0xcd},
|
|
{0x548e, 0xdd},
|
|
{0x548f, 0xea},
|
|
{0x5490, 0x1d}
|
|
};
|
|
|
|
static const uint16_t sensor_regs_gamma1[][2] = {
|
|
{0x5480, 0x1},
|
|
{0x5481, 0x0},
|
|
{0x5482, 0x1e},
|
|
{0x5483, 0x3b},
|
|
{0x5484, 0x58},
|
|
{0x5485, 0x66},
|
|
{0x5486, 0x71},
|
|
{0x5487, 0x7d},
|
|
{0x5488, 0x83},
|
|
{0x5489, 0x8f},
|
|
{0x548a, 0x98},
|
|
{0x548b, 0xa6},
|
|
{0x548c, 0xb8},
|
|
{0x548d, 0xca},
|
|
{0x548e, 0xd7},
|
|
{0x548f, 0xe3},
|
|
{0x5490, 0x1d}
|
|
};
|
|
|
|
static const uint16_t sensor_regs_awb0[][2] = {
|
|
{0x5180, 0xff},
|
|
{0x5181, 0xf2},
|
|
{0x5182, 0x00},
|
|
{0x5183, 0x14},
|
|
{0x5184, 0x25},
|
|
{0x5185, 0x24},
|
|
{0x5186, 0x09},
|
|
{0x5187, 0x09},
|
|
{0x5188, 0x09},
|
|
{0x5189, 0x75},
|
|
{0x518a, 0x54},
|
|
{0x518b, 0xe0},
|
|
{0x518c, 0xb2},
|
|
{0x518d, 0x42},
|
|
{0x518e, 0x3d},
|
|
{0x518f, 0x56},
|
|
{0x5190, 0x46},
|
|
{0x5191, 0xf8},
|
|
{0x5192, 0x04},
|
|
{0x5193, 0x70},
|
|
{0x5194, 0xf0},
|
|
{0x5195, 0xf0},
|
|
{0x5196, 0x03},
|
|
{0x5197, 0x01},
|
|
{0x5198, 0x04},
|
|
{0x5199, 0x12},
|
|
{0x519a, 0x04},
|
|
{0x519b, 0x00},
|
|
{0x519c, 0x06},
|
|
{0x519d, 0x82},
|
|
{0x519e, 0x38}
|
|
};
|
|
|
|
|
|
/* 1920x1080 YUV422 3.5fps Pclk_out=19.2MHz */
|
|
static const uint16_t sensor_default_regs[][2] = {
|
|
{0x3103,0x11}, // system clock from pad, bit[1]
|
|
{0x3008,0x82}, // software reset, bit[7]
|
|
|
|
{REG_DLY, 10}, // delay 10ms
|
|
|
|
{0x3008,0x42}, // software power down, bit[6]
|
|
{0x3103,0x03}, // system clock from PLL, bit[1]
|
|
{0x3017,0xff}, // FREX, Vsync, HREF, PCLK, D[9:6] output enable
|
|
{0x3018,0xff}, // D[5:0], GPIO[1:0] output enable
|
|
|
|
//pll and clock setting
|
|
{0x3034,0x18}, // MIPI 10-bit
|
|
{0x3035,0x21}, //
|
|
{0x3036,0x46}, // 0x46->30fps
|
|
{0x3037,0x13}, // PLL root divider, bit[4], PLL pre-divider, bit[3:0]
|
|
{0x3108,0x01}, // PCLK root divider, bit[5:4], SCLK2x root divider, bit[3:2], SCLK root divider, bit[1:0]
|
|
{0x3824,0x01}, //
|
|
|
|
{0x3630,0x36}, //
|
|
{0x3631,0x0e}, //
|
|
{0x3632,0xe2}, //
|
|
{0x3633,0x12}, //
|
|
{0x3621,0xe0}, //
|
|
{0x3704,0xa0}, //
|
|
{0x3703,0x5a}, //
|
|
{0x3715,0x78}, //
|
|
{0x3717,0x01}, //
|
|
{0x370b,0x60}, //
|
|
{0x3705,0x1a}, //
|
|
{0x3905,0x02}, //
|
|
{0x3906,0x10}, //
|
|
{0x3901,0x0a}, //
|
|
{0x3731,0x12}, //
|
|
{0x3600,0x08}, //
|
|
{0x3601,0x33}, //
|
|
// {0x302d,0x60);//
|
|
{0x3620,0x52}, //
|
|
{0x371b,0x20}, //
|
|
{0x471c,0x50}, //
|
|
{0x3a13,0x43}, //
|
|
{0x3a18,0x00}, //
|
|
{0x3a19,0x88}, //
|
|
{0x3635,0x13}, //
|
|
{0x3636,0x03}, //
|
|
{0x3634,0x40}, //
|
|
{0x3622,0x01}, //
|
|
{0x3c01,0x34}, //
|
|
{0x3c04,0x28}, //
|
|
{0x3c05,0x98}, //
|
|
{0x3c06,0x00}, //
|
|
{0x3c07,0x08}, //
|
|
{0x3c08,0x00}, //
|
|
{0x3c09,0x1c}, //
|
|
{0x3c0a,0x9c}, //
|
|
{0x3c0b,0x40}, //
|
|
// {0x3820,0x41);// binning
|
|
// {0x3821,0x41);// binning
|
|
{0x3814,0x31}, //
|
|
{0x3815,0x31}, //
|
|
{0x3800,0x00}, //
|
|
{0x3801,0x00}, //
|
|
{0x3802,0x00}, //
|
|
{0x3803,0x04}, //
|
|
{0x3804,0x0a}, //
|
|
{0x3805,0x3f}, //
|
|
{0x3806,0x07}, //
|
|
{0x3807,0x9b}, //
|
|
{0x3808,0x02}, //
|
|
{0x3809,0x80}, //
|
|
{0x380a,0x01}, //
|
|
{0x380b,0xe0}, //
|
|
{0x380c,0x07}, //
|
|
{0x380d,0x68}, //
|
|
{0x380e,0x03}, //
|
|
{0x380f,0xd8}, //
|
|
{0x3810,0x00}, //
|
|
{0x3811,0x10}, //
|
|
{0x3812,0x00}, //
|
|
{0x3813,0x06}, //
|
|
{0x3618,0x00}, //
|
|
{0x3612,0x29}, //
|
|
{0x3708,0x64}, //
|
|
{0x3709,0x52}, //
|
|
{0x370c,0x03}, //
|
|
{0x3a00,0x78},
|
|
{0x3a02,0x03}, //
|
|
{0x3a03,0xd8}, //
|
|
{0x3a08,0x01}, //
|
|
{0x3a09,0x27}, //
|
|
{0x3a0a,0x00}, //
|
|
{0x3a0b,0xf6}, //
|
|
{0x3a0e,0x03}, //
|
|
{0x3a0d,0x04}, //
|
|
{0x3a14,0x03}, //
|
|
{0x3a15,0xd8}, //
|
|
{0x4001,0x02}, //
|
|
{0x4004,0x02}, //
|
|
{0x3000,0x00}, //
|
|
{0x3002,0x1c}, //
|
|
{0x3004,0xff}, //
|
|
{0x3006,0xc3}, //
|
|
{0x300e,0x58}, //
|
|
// {0x302e,0x00);//
|
|
|
|
{0x302c,0x42}, //bit[7:6]: output drive capability: 00: 1x 01: 2x 10: 3x 11: 4x
|
|
|
|
/* pixel_format */
|
|
{0x4300, 0x30}, // YUV422 0x30:YUYV 0x31:YVYU 0x32:UYVY 0x33:VYUY
|
|
{0x501f, 0x00}, // bit[2:0]: 000:YUV422, 001:RGB, 010:dither, 011: RAW(DPC), 100:SNR RAW, 101: RAW(CIP)
|
|
|
|
//{0x4300, 0x40}, // YUV420 0x40:YY_YU 0x41:YY_YV 0x42:YY_UY 0x43:YY_VY 0x44:YU_YY 0x45:YV_YY 0x46:UY_YY 0x47:VY_YY
|
|
//{0x501f, 0x00}, // bit[2:0]: 000:YUV422, 001:RGB, 010:dither, 011: RAW(DPC), 100:SNR RAW, 101: RAW(CIP)
|
|
|
|
//{0x4300, 0x20}, // YUV444:YUVYUV
|
|
//{0x501f, 0x00}, // bit[2:0]: 000:YUV422, 001:RGB, 010:dither, 011: RAW(DPC), 100:SNR RAW, 101: RAW(CIP)
|
|
|
|
//{0x4300, 0x00}, // RAW:BGGR
|
|
//{0x501f, 0x05}, // bit[2:0]: 000:YUV422, 001:RGB, 010:dither, 011: RAW(DPC), 100:SNR RAW, 101: RAW(CIP)
|
|
|
|
{0x4713,0x03}, //
|
|
{0x4407,0x04}, //
|
|
{0x440e,0x00}, //
|
|
{0x460b,0x35}, //
|
|
{0x460c,0x20}, //
|
|
{0x4837,0x22},
|
|
{0x5000,0xa7}, //
|
|
{0x5001,0xa3}, //
|
|
|
|
//ov5640_write_register(iic_id, 0x4740,0x21);//hsync,vsync,clock pol,reference to application note,spec is wrong
|
|
|
|
//AWB
|
|
{0x3406,0x00}, //0x00); // LA ORG
|
|
{0x5180,0xff}, //0xff); // 0xff 0xff
|
|
{0x5181,0xf2}, //0x50); // 0xf2 0x50
|
|
{0x5182,0x00}, //0x11); // 0x00 0x11
|
|
{0x5183,0x14}, //0x14); // 0x14 0x14
|
|
{0x5184,0x25}, //0x25); // 0x25 0x25
|
|
{0x5185,0x24}, //0x24); // 0x24 0x24
|
|
{0x5186,0x16}, //0x1c); // 0x09 0x1c
|
|
{0x5187,0x16}, //0x18); // 0x09 0x18
|
|
{0x5188,0x16}, //0x18); // 0x09 0x18
|
|
{0x5189,0x6e}, //0x6e); // 0x75 0x6e
|
|
{0x518a,0x68}, //0x68); // 0x54 0x68
|
|
{0x518b,0xe0}, //0xa8); // 0xe0 0xa8
|
|
{0x518c,0xb2}, //0xa8); // 0xb2 0xa8
|
|
{0x518d,0x42}, //0x3d); // 0x42 0x3d
|
|
{0x518e,0x3e}, //0x3d); // 0x3d 0x3d
|
|
{0x518f,0x4c}, //0x54); // 0x56 0x54
|
|
{0x5190,0x56}, //0x54); // 0x46 0x54
|
|
{0x5191,0xf8}, //0xf8); // 0xf8 0xf8
|
|
{0x5192,0x04}, //0x04); // 0x04 0x04
|
|
{0x5193,0x70}, //0x70); // 0x70 0x70
|
|
{0x5194,0xf0}, //0xf0); // 0xf0 0xf0
|
|
{0x5195,0xf0}, //0xf0); // 0xf0 0xf0
|
|
{0x5196,0x03}, //0x03); // 0x03 0x03
|
|
{0x5197,0x01}, //0x01); // 0x01 0x01
|
|
{0x5198,0x04}, //0x05); // 0x04 0x05
|
|
{0x5199,0x12}, //0x7c); // 0x12 0x7c
|
|
{0x519a,0x04}, //0x04); // 0x04 0x04
|
|
{0x519b,0x00}, //0x00); // 0x00 0x00
|
|
{0x519c,0x06}, //0x06); // 0x06 0x06
|
|
{0x519d,0x82}, //0x79); // 0x82 0x79
|
|
{0x519e,0x38}, //0x38); // 0x38 0x38
|
|
//Color // LA ORG
|
|
{0x5381,0x1e}, //0x1e); // 0x1e 0x1e
|
|
{0x5382,0x5b}, //0x5b); // 0x5b 0x5b
|
|
{0x5383,0x14}, //0x08); // 0x08 0x08
|
|
{0x5384,0x05}, //0x0a); // 0x0a 0x05
|
|
{0x5385,0x77}, //0x7e); // 0x7e 0x72
|
|
{0x5386,0x7c}, //0x88); // 0x88 0x77
|
|
{0x5387,0x72}, //0x7c); // 0x7c 0x6d
|
|
{0x5388,0x58}, //0x6c); // 0x6c 0x4d
|
|
{0x5389,0x1a}, //0x10); // 0x10 0x20
|
|
{0x538a,0x01}, //0x01); // 0x01 0x01
|
|
{0x538b,0x98}, //0x98); // 0x98 0x98
|
|
//Sharpness/Denoise
|
|
{0x5300,0x08},
|
|
{0x5301,0x30},
|
|
{0x5302,0x30},
|
|
{0x5303,0x10},
|
|
{0x5308,0x25}, //sharpness/noise auto
|
|
{0x5304,0x08},
|
|
{0x5305,0x30},
|
|
{0x5306,0x1c},
|
|
{0x5307,0x2c},
|
|
{0x5309,0x08},
|
|
{0x530a,0x30},
|
|
{0x530b,0x04},
|
|
{0x530c,0x06},
|
|
|
|
//Gamma
|
|
{0x5480,0x01}, //??? // LA ORG
|
|
{0x5481,0x06}, //0x08); // 0x08 0x06
|
|
{0x5482,0x12}, //0x14); // 0x14 0x15
|
|
{0x5483,0x1e}, //0x28); // 0x28 0x28
|
|
{0x5484,0x4a}, //0x51); // 0x51 0x3b
|
|
{0x5485,0x58}, //0x65); // 0x65 0x50
|
|
{0x5486,0x65}, //0x71); // 0x71 0x5d
|
|
{0x5487,0x72}, //0x7d); // 0x7d 0x6a
|
|
{0x5488,0x7d}, //0x87); // 0x87 0x75
|
|
{0x5489,0x88}, //0x91); // 0x91 0x80
|
|
{0x548a,0x92}, //0x9a); // 0x9a 0x8a
|
|
{0x548b,0xa3}, //0xaa); // 0xaa 0x9b
|
|
{0x548c,0xb2}, //0xb8); // 0xb8 0xaa
|
|
{0x548d,0xc8}, //0xcd); // 0xcd 0xc0
|
|
{0x548e,0xdd}, //0xdd); // 0xdd 0xd5
|
|
{0x548f,0xf0}, //0xea); // 0xea 0xe8
|
|
{0x5490,0x15}, //0x1d); // 0x1d 0x20
|
|
|
|
//UV
|
|
{0x5580,0x06},
|
|
{0x5583,0x40},
|
|
{0x5584,0x10},
|
|
{0x5589,0x10},
|
|
{0x558a,0x00},
|
|
{0x558b,0xf8},
|
|
{0x501d,0x40},
|
|
|
|
// {0x5587,0x05);
|
|
// {0x5588,0x09);
|
|
//Lens Shading
|
|
{0x5800,0x15}, //0xa7); //LA org
|
|
{0x5801,0x10}, //0x23); //0x23 0x17
|
|
{0x5802,0x0D}, //0x14); //0x14 0x10
|
|
{0x5803,0x0D}, //0x0f); //0x0f 0x0e
|
|
{0x5804,0x0F}, //0x0f); //0x0f 0x0e
|
|
{0x5805,0x15}, //0x12); //0x12 0x11
|
|
{0x5806,0x0A}, //0x26); //0x26 0x1b
|
|
{0x5807,0x07}, //0x0c); //0x0c 0x0b
|
|
{0x5808,0x05}, //0x08); //0x08 0x07
|
|
{0x5809,0x05}, //0x05); //0x05 0x05
|
|
{0x580A,0x07}, //0x05); //0x05 0x06
|
|
{0x580B,0x0B}, //0x08); //0x08 0x09
|
|
{0x580C,0x07}, //0x0d); //0x0d 0x0e
|
|
{0x580D,0x03}, //0x08); //0x08 0x06
|
|
{0x580E,0x01}, //0x03); //0x03 0x02
|
|
{0x580F,0x01}, //0x00); //0x00 0x00
|
|
{0x5810,0x03}, //0x00); //0x00 0x00
|
|
{0x5811,0x07}, //0x03); //0x03 0x03
|
|
{0x5812,0x07}, //0x09); //0x09 0x09
|
|
{0x5813,0x03}, //0x07); //0x07 0x06
|
|
{0x5814,0x01}, //0x03); //0x03 0x03
|
|
{0x5815,0x01}, //0x00); //0x00 0x00
|
|
{0x5816,0x03}, //0x01); //0x01 0x00
|
|
{0x5817,0x06}, //0x03); //0x03 0x03
|
|
{0x5818,0x0D}, //0x08); //0x08 0x09
|
|
{0x5819,0x08}, //0x0d); //0x0d 0x0b
|
|
{0x581A,0x06}, //0x08); //0x08 0x08
|
|
{0x581B,0x06}, //0x05); //0x05 0x05
|
|
{0x581C,0x07}, //0x06); //0x06 0x05
|
|
{0x581D,0x0B}, //0x08); //0x08 0x08
|
|
{0x581E,0x14}, //0x0e); //0x0e 0x0e
|
|
{0x581F,0x13}, //0x29); //0x29 0x18
|
|
{0x5820,0x0E}, //0x17); //0x17 0x12
|
|
{0x5821,0x0E}, //0x11); //0x11 0x0f
|
|
{0x5822,0x12}, //0x11); //0x11 0x0f
|
|
{0x5823,0x12}, //0x15); //0x15 0x12
|
|
{0x5824,0x46}, //0x28); //0x28 0x1a
|
|
{0x5825,0x26}, //0x46); //0x46 0x0a
|
|
{0x5826,0x06}, //0x26); //0x26 0x0a
|
|
{0x5827,0x46}, //0x08); //0x08 0x0a
|
|
{0x5828,0x44}, //0x26); //0x26 0x0a
|
|
{0x5829,0x26}, //0x64); //0x64 0x46
|
|
{0x582A,0x24}, //0x26); //0x26 0x2a
|
|
{0x582B,0x42}, //0x24); //0x24 0x24
|
|
{0x582C,0x24}, //0x22); //0x22 0x44
|
|
{0x582D,0x46}, //0x24); //0x24 0x24
|
|
{0x582E,0x24}, //0x24); //0x24 0x28
|
|
{0x582F,0x42}, //0x06); //0x06 0x08
|
|
{0x5830,0x60}, //0x22); //0x22 0x42
|
|
{0x5831,0x42}, //0x40); //0x40 0x40
|
|
{0x5832,0x24}, //0x42); //0x42 0x42
|
|
{0x5833,0x26}, //0x24); //0x24 0x28
|
|
{0x5834,0x24}, //0x26); //0x26 0x0a
|
|
{0x5835,0x24}, //0x24); //0x24 0x26
|
|
{0x5836,0x24}, //0x22); //0x22 0x24
|
|
{0x5837,0x46}, //0x22); //0x22 0x26
|
|
{0x5838,0x44}, //0x26); //0x26 0x28
|
|
{0x5839,0x46}, //0x44); //0x44 0x4a
|
|
{0x583A,0x26}, //0x24); //0x24 0x0a
|
|
{0x583B,0x48}, //0x26); //0x26 0x0c
|
|
{0x583C,0x44}, //0x28); //0x28 0x2a
|
|
{0x583D,0xBF}, //0x42); //0x42 0x28
|
|
|
|
//EV
|
|
{0x3a0f,0x30},
|
|
{0x3a10,0x28},
|
|
{0x3a1b,0x30},
|
|
{0x3a1e,0x26},
|
|
{0x3a11,0x60},
|
|
{0x3a1f,0x14},
|
|
|
|
/* WIDTH 1920*1080*/
|
|
|
|
{0x3035,0x21}, //0x11:60fps 0x21:30fps 0x41:15fps 0xa1:7.5fps
|
|
{0x3036,0x54}, // PLL
|
|
|
|
{0x3820,0x46},
|
|
{0x3821,0x00},
|
|
{0x3034,0x1a},
|
|
{0x3037,0x13},
|
|
{0x3108,0x01},
|
|
{0x3824,0x01},
|
|
|
|
{REG_DLY, 10}, // delay 10ms
|
|
|
|
//timing
|
|
//1920x1080
|
|
{0x3808,0x07}, //H size MSB
|
|
{0x3809,0x80}, //H size LSB
|
|
{0x380a,0x04}, //V size MSB
|
|
{0x380b,0x40}, //V size LSB
|
|
|
|
{0x380c,0x09}, //HTS MSB
|
|
{0x380d,0xc4}, //HTS LSB
|
|
{0x380e,0x04}, //VTS MSB
|
|
{0x380f,0x60}, //VTS LSB
|
|
|
|
//banding step
|
|
{0x3a08,0x00}, //50HZ step MSB
|
|
{0x3a09,0x54}, //50HZ step LSB
|
|
{0x3a0a,0x00}, //60HZ step MSB
|
|
{0x3a0b,0x46}, //60HZ step LSB
|
|
{0x3a0e,0x0d}, //50HZ step max
|
|
{0x3a0d,0x10}, //60HZ step max
|
|
|
|
{0x3503,0x00}, //AEC enable
|
|
{0x350c,0x00},
|
|
{0x350d,0x00},
|
|
{0x3c07,0x07}, //light meter 1 thereshold
|
|
{0x3814,0x11}, //horizton subsample
|
|
{0x3815,0x11}, //vertical subsample
|
|
{0x3800,0x01}, //x address start high byte
|
|
{0x3801,0x50}, //x address start low byte
|
|
{0x3802,0x01}, //y address start high byte
|
|
{0x3803,0xb2}, //y address start low byte
|
|
{0x3804,0x08}, //x address end high byte
|
|
{0x3805,0xef}, //x address end low byte
|
|
{0x3806,0x05}, //y address end high byte
|
|
{0x3807,0xf9}, //y address end low byte
|
|
{0x3810,0x00}, //isp hortizontal offset high byte
|
|
{0x3811,0x10}, //isp hortizontal offset low byte
|
|
{0x3812,0x00}, //isp vertical offset high byte
|
|
{0x3813,0x04}, //isp vertical offset low byte
|
|
|
|
// {0x5308,0x65); //sharpen manual
|
|
// {0x5302,0x00); //sharpen offset 1
|
|
{0x4002,0x45}, //BLC related
|
|
{0x4005,0x18}, //BLC related
|
|
|
|
{0x3618,0x04},
|
|
{0x3612,0x2b},
|
|
{0x3709,0x12},
|
|
{0x370c,0x00},
|
|
{0x3a02,0x04}, //60HZ max exposure limit MSB
|
|
{0x3a03,0x60}, //60HZ max exposure limit LSB
|
|
{0x3a14,0x04}, //50HZ max exposure limit MSB
|
|
{0x3a15,0x60}, //50HZ max exposure limit LSB
|
|
|
|
{0x4004,0x06}, //BLC line number
|
|
{0x3002,0x1c}, //reset JFIFO SFIFO JPG
|
|
{0x3006,0xc3}, //enable xx clock
|
|
{0x460b,0x37}, //debug mode
|
|
{0x460c,0x20}, //PCLK Manuale
|
|
{0x4837,0x16}, //PCLK period
|
|
{0x5001,0x83}, //ISP effect
|
|
// {0x3503,0x00);//AEC enable
|
|
|
|
{0x302c,0x42}, //bit[7:6]: output drive capability: 00: 1x 01: 2x 10: 3x 11: 4x
|
|
{0x3a18,0x00}, //
|
|
{0x3a19,0x80}, //
|
|
|
|
/* DVP */
|
|
{0x471b, 0x02}, //bit0: hsync mode enable
|
|
{0x471d, 0x02}, //bit1-0: vsync mode
|
|
{0x4740, 0x21}, //bit5: pclk polarity, bit1: hsync polarity, bit0: vsync polarity
|
|
|
|
/* BT601 */
|
|
//{0x4711, 0x00}, //HSYNC Mode left padding
|
|
//{0x4712, 0x00}, //HSYNC Mode right padding
|
|
//{0x471b, 0x03}, //bit0: hsync mode enable
|
|
//{0x471d, 0x02}, //bit1-0: vsync mode
|
|
//{0x4740, 0x22}, //bit5: pclk polarity, bit1: hsync polarity, bit0: vsync polarity
|
|
|
|
/* BT656 */
|
|
//{0x4715, 0x01}, //bit3-0: CCIR656 dummy line number at beginning of frame
|
|
//{0x4719, 0x00}, //bit1-0: SAV/EAV option
|
|
//{0x4730, 0x21}, //CCIR656 CTRL00
|
|
//{0x4731, 0x00}, //bit0: blanking toggle data order option
|
|
//{0x4732, 0xff}, //CCIR656 FS
|
|
//{0x4733, 0xfe}, //CCIR656 FE
|
|
//{0x4734, 0xfd}, //CCIR656 LS
|
|
//{0x4735, 0xfc}, //CCIR656 LE
|
|
//{0x4736, 0x00}, //bit3-2: blanking toggle data0 [9:8], bit1-0: blanking toggle data1[9:8]
|
|
//{0x4737, 0x00}, //blanking toggle data0
|
|
//{0x4738, 0x00}, //blanking toggle data1
|
|
//{0x4740, 0x22}, //bit5: pclk polarity, bit1: hsync polarity, bit0: vsync polarity
|
|
|
|
/* test pattern */
|
|
//ov5640_write_register(iic_id, 0x4741,0x07);
|
|
|
|
{0x5025,0x00},
|
|
|
|
//ov5640_write_register(iic_id, 0x3031,0x08); //disable internal LDO
|
|
// {0x4005,0x1a);
|
|
// //power down release
|
|
{0x503d,0x00}, //0xd2 square test pattern
|
|
{0x3008,0x02},
|
|
};
|
|
|
|
|
|
#endif
|