-
Where did you get the camera module(s)?
UCTRONICS -
Model number of the product(s)?
Mini 5MP Plus OV5642 -
What hardware/platform were you working on?
STM32 -
Instructions you have followed. (link/manual/etc.)
link -
Problems you were having?
jpeg header missing -
The dmesg log from your hardware?
-
Troubleshooting attempts you’ve made?
Same code works for OV2642
I have successfully used the OV2462 Arducam module but I am having trouble with the 5MP version. I can’t seem to get the jpeg header to appear. Again OV2642 works fine so all hardware and SPI/I2C lines work fine and just the initialization procedures change. The module is correctly identified as the OV5642 via I2C and the 0x55 check is also successful. I have added the necessary delays that were suggested in a similar post.
Here is my init code:
comStatus ArduCAM_Init(void) {
BYTE wr;
// OV5642
#ifdef __5MP
Delay(500);
wr = 0x80;
if (!I2C_Write(CAMERA_ADDRESS, 0x3008, 1, 1, &wr))
return camInitErr;
Delay(100);
if (!wrSensorRegs16_8(OV5642_QVGA_Preview))
return camInitErr;
Delay(500);
if (!wrSensorRegs16_8(OV5642_JPEG_Capture_QSXGA))
return camInitErr;
Delay(500);
if (!wrSensorRegs16_8(ov5642_320x240)) //ov5642_320x240 ov5642_2592x1944
return camInitErr;
Delay(1000);
wr = 0xa8;
if (!I2C_Write(CAMERA_ADDRESS, 0x3818, 1, 1, &wr))
return camInitErr;
Delay(100);
wr = 0x10;
if (!I2C_Write(CAMERA_ADDRESS, 0x3621, 1, 1, &wr))
return camInitErr;
Delay(100);
wr = 0xb0;
if (!I2C_Write(CAMERA_ADDRESS, 0x3801, 1, 1, &wr))
return camInitErr;
Delay(100);
wr = 0x08;
if (!I2C_Write(CAMERA_ADDRESS, 0x4407, 1, 1, &wr))
return camInitErr;
Delay(100);
wr = 0x00;
if (!I2C_Write(CAMERA_ADDRESS, 0x5888, 1, 1, &wr))
return camInitErr;
Delay(100);
wr = 0xFF;
if (!I2C_Write(CAMERA_ADDRESS, 0x5000, 1, 1, &wr))
return camInitErr;
write_reg(0x03, 0x02); // VSYNC_LEVEL_MASK
Delay(100);
wrSensorRegs16_8(ov5642_320x240);
Delay(1000);
clear_fifo_flag();
Delay(100);
write_reg(0x01, 0x00);
Delay(100);
#else
// OV2642
write_reg(0x00, 0x55);
if (read_reg(0x00)!=0x55)
return camInitErr;
wr = 0x01;
if (!I2C_Write(CAMERA_ADDRESS, 0xff, 0, 1, &wr))
return camInitErr;
wr = 0x80;
if (!I2C_Write(CAMERA_ADDRESS, 0x12, 0, 1, &wr))
return camInitErr;
if (!wrSensorRegs8_8(OV2640_JPEG_INIT))
return camInitErr;
if (!wrSensorRegs8_8(OV2640_YUV422))
return camInitErr;
if (!wrSensorRegs8_8(OV2640_JPEG))
return camInitErr;
wr = 0x01;
if (!I2C_Write(CAMERA_ADDRESS, 0xff, 0, 1, &wr))
return camInitErr;
wr = 0x00;
if (!I2C_Write(CAMERA_ADDRESS, 0x15, 0, 1, &wr))
return camInitErr;
if (!wrSensorRegs8_8(OV2640_1600x1200_JPEG)) //OV2640_1600x1200_JPEG OV2640_160x120_JPEG
return camInitErr;
#endif
return OK;
}
thanks