7 Replies Latest reply on Dec 16, 2018 5:45 PM by YangyangC_06

    CX3, i2c , 2-bytes address, 2-bytes data


      Hi sir,


      i encounter an issue of accessing a image sensor via i2c.. might need a recommendation for properly debugging..




      The register of the sensor has 2 bytes address , and 2 byte value, the slave address is 0x20..


      basically, the sensor indeed returns ACK, right after sending slave address (0x20), there  is no i2c slave address conflict.


      i wanna read 2 bytes data from 2 bytes register, which has 0x3000 address..


      when i send a i2c read commands,  the sensor seems never returnning ACK after 0x21 (read command), attaching the i2c waveform below.



      the i2c waveform above after decode as below.


      [S] 20 30 00 [S] 21#


      S: Start signal

      # -> NAK


      the sensor never returns the data, but NACK..


      error code returned is


      ImageSensorSensorRead Failed addr=0x3000, status = 0x4A




      the actual code being sent as below ..


          for(cnt=0; cnt<3 ; cnt++)   //


              preamble.buffer[1] = CY_U3P_GET_MSB (regAddr);

              preamble.buffer[2] = CY_U3P_GET_LSB (regAddr);

              preamble.buffer[3] = SENSOR_I2C_READ_ADDRESS; /* Slave address: Read operation */

              preamble.buffer[0] = SENSOR_I2C_WRITE_ADDRESS; /* Slave address: write operation */

              preamble.length = 4;

              preamble.ctrlMask = 0x0004;



              status = CyU3PI2cReceiveBytes (&preamble, buf, count,0);







              if (status == CY_U3P_SUCCESS)






      #ifdef SENSOR_DEBUG




                  CyU3PDebugPrint(4,"\r\nImageSensorSensorRead Failed addr=0x%x, status = 0x%x",regAddr, status);



          return status;




      thank you