AnsweredAssumed Answered

SCCB and I2C problem

Question asked by contreras.alexander on May 24, 2013
Latest reply on Apr 22, 2015 by tag.aseok
Hi, I want to interface the OV7670 FIFO omnivision camera with STM32F4discovery board I have used an example inside of  STM32F4xx_DSP_StdPeriph_Lib_V1.1.0, the example drives an OV2640/9655 camera so I changed the registers to fit my camera, the start condition occurs with no problem but when I want to write a register then on this part

ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, uint32_t I2C_EVENT)
  uint32_t lastevent = 0;
  uint32_t flag1 = 0, flag2 = 0;
  ErrorStatus status = ERROR;

  /* Check the parameters */

  /* Read the I2Cx status register */
  flag1 = I2Cx->SR1;
  flag2 = I2Cx->SR2;
  flag2 = flag2 << 16;

  /* Get the last event value from I2C status register */
  lastevent = (flag1 | flag2) & FLAG_MASK;

  /* Check whether the last event contains the I2C_EVENT */
  if ((lastevent & I2C_EVENT) == I2C_EVENT)
    /* SUCCESS: last event is equal to I2C_EVENT */
    status = SUCCESS;
    /* ERROR: last event is different from I2C_EVENT */
    status = ERROR;
  /* Return status */
  return status;

I get error, the funny story is that the first time that I ran the code, it works, then I unplug the board and pluged again and now it doesnt work, unpluged some times and pluged again and it works, unplug and plug.....I dont know what is happening, Im sure it is not an electrical problem, the camera module has the 2 pull ups resistor (10Kohm) welded to the plate, the SCCB protocol says "the 9th bit is a DON'T CARE bit" seems like it could take 1 or 0 value ramdomdly, but for I2C protocol that bit is an aknowledge bit, maybe the error I get is due to that bit? if so, then why the example Im using doesnt handle that?

the module camera needs 3V to work but I was measuring the voltage from the STM32F4discovery on the 3V pin and it measure 3.3V is it possible that the camera is damaged because of that? how can I managed the internal regulator of the STM32F4discovery so it can works with 3V tops or where should I connect a battery?
thx in advance
I apologize for the language, im learning