10 Replies Latest reply on Apr 30, 2020 5:24 AM by GaK_4661021

    CX3 SDK-1.3: Facing issue with I2C Communication

    GaK_4661021

      Hi,

       

      I am facing an issue while reading the register of the OV5640 Camera sensor (I2C slave device in my setup) from firmware with "CyU3PI2cReceiveBytes" API through I2C. However, The camera module is working fine as I am able to stream it from Windows Host.

       

      CyU3PI2cReceiveBytes returns CY_U3P_ERROR_FAILURE. I have further debugged the issue with "CyU3PI2cGetErrorCode" and it returns CY_U3P_I2C_ERROR_NAK_BYTE_0. Please find the code snippet below,

       

      devAddr = 0x3C;

       

      preamble.length = 4;

       

      preamble.buffer[0] = devAddr;
      preamble.buffer[1] = 0x30;
      preamble.buffer[2] = 0x2A;
      preamble.buffer[3] = devAddr | 0x01 ;
      preamble.ctrlMask  = 0x0004;

       

      status = CyU3PI2cReceiveBytes (&preamble, buffer, 1, 0);
      CyU3PThreadSleep(1);
      if (status != CY_U3P_SUCCESS)
      {
               CyU3PI2cGetErrorCode(&errorCode);
               return errorCode;
      }
      Can anyone point out the probable issue? Am I doing anything wrong with I2C communication?