I have been trying to get my camera modules working for a few days now without any success. None of my two camera modules doesn't seem to respond to anything over I2C which leads me to believe that they are broken, and that would be quite weird since they are new...
I have the camera modules OV5642 module, (OV5642 datasheet) and the camera module OV7725 datasheet (I haven't found any PIN out for the OV7725 since they aren't printed on the board so I've just assumed that they are the same as the ones given in the OV5642 module, which might be wrong)
Code: Select all
#define OV7725_WRITE_ADDR 0x42
#define OV7725_READ_ADDR 0x43
#define BLUE_REG 0x01
static unsigned char rxbuf[10];
static unsigned char txbuf[10];
/* I2C1 interface */
static const I2CConfig i2ccfg1 = {
OPMODE_I2C,
100000,
STD_DUTY_CYCLE,
};
void ov7725_Init(void)
{
msg_t status;
i2cStart(&I2CD1, &i2ccfg1);
txbuf[0] = BLUE_REG;
i2cAcquireBus(&I2CD1);
status = i2cMasterTransmit(&I2CD1, OV7725_READ_ADDR, txbuf, 1, rxbuf, 1);
i2cReleaseBus(&I2CD1);
if (rxbuf[0] == 0x80)
for(;;); /* Received default blue register data */
}
The status returned from i2cMasterTransmit is always MSG_RESET (-2) and I don't know how what the problem might be
The I2C is working as I can see the data and clock signal working as the attached pictures are showing. I've tried lowering the I2C clock speed to 100 KHz instead of 400 KHz and I've attached pull-up resistors on both lines.
I've also attached an external clock of 17MHz that is generated from Timer1 / PWM to the modules but that didn't seem to help at all since I don't really think it's needed to begin with.
I haven't really bothered with the DCMI interface yet since I am not even getting any response from the devices over I2C.
(Ofcourse when I've tried the ov5642 I've used the slave address specified in that datasheet and the register addresses / default values)..
Any suggestions what might be wrong?