Hello Wiedong,
Both OV5640 and OV5642 share the same I2C ID but at any point in time we are connecting ONLY one device now. In our subsequent revision of schematics, we are going to put them on two different I2C buses.
I checked and found out that the error message was as I had mentioned on 0x3635 register.
Here is the code snippet (This is the code version that is existing in Linux kernel 3.x version):
static struct reg_value ov5640_init_setting_30fps_VGA[] = {
{0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0},
{0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0},
{0x3034, 0x18, 0, 0}, {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0},
{0x3037, 0x13, 0, 0}, {0x3108, 0x01, 0, 0}, {0x3630, 0x36, 0, 0},
{0x3631, 0x0e, 0, 0}, {0x3632, 0xe2, 0, 0}, {0x3633, 0x12, 0, 0},
{0x3621, 0xe0, 0, 0}, {0x3704, 0xa0, 0, 0}, {0x3703, 0x5a, 0, 0},
{0x3715, 0x78, 0, 0}, {0x3717, 0x01, 0, 0}, {0x370b, 0x60, 0, 0},
{0x3705, 0x1a, 0, 0}, {0x3905, 0x02, 0, 0}, {0x3906, 0x10, 0, 0},
{0x3901, 0x0a, 0, 0}, {0x3731, 0x12, 0, 0}, {0x3600, 0x08, 0, 0},
{0x3601, 0x33, 0, 0}, {0x302d, 0x60, 0, 0}, {0x3620, 0x52, 0, 0},
{0x371b, 0x20, 0, 0}, {0x471c, 0x50, 0, 0}, {0x3a13, 0x43, 0, 0},
{0x3a18, 0x00, 0, 0}, {0x3a19, 0xf8, 0, 0}, {0x3635, 0x13, 0, 0},
.....
static int ov5640_init_mode(enum ov5640_frame_rate frame_rate,
enum ov5640_mode mode)
{
......
if (mode == ov5640_mode_INIT) {
pModeSetting = ov5640_init_setting_30fps_VGA;
iModeSettingArySize = ARRAY_SIZE(ov5640_init_setting_30fps_VGA);
ov5640_data.pix.width = 640;
ov5640_data.pix.height = 480;
for (i = 0; i < iModeSettingArySize; ++i, ++pModeSetting) {
Delay_ms = pModeSetting->u32Delay_ms;
RegAddr = pModeSetting->u16RegAddr;
Val = pModeSetting->u8Val;
Mask = pModeSetting->u8Mask;
if (Mask) {
retval = ov5640_read_reg(RegAddr, &RegVal);
if (retval < 0)
goto err;
RegVal &= ~(u8)Mask;
Val &= Mask;
Val |= RegVal;
}
retval = ov5640_write_reg(RegAddr, Val);
if (retval < 0)
goto err;
if (Delay_ms)
msleep(Delay_ms);
......
}
Regards
Vasan