4 Replies Latest reply on Jun 11, 2019 7:23 AM by ThM_3776866

    FX-3 I2C getting NACK If the Slave Sending ACK.

    ThM_3776866

      Hi all,

       

      I working on Fx-3 I2C interface. Fx-3  acts as master and stv0913 (Demod) and RDA5815S (Tuner) acts as slave.

       

      In cypress I2C code as below.

       

      CyU3PReturnStatus_t I2C_Write (  uint8_t slaveAddr, uint32_t count, uint8_t *buf)

      {

      CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

      CyU3PI2cPreamble_t preamble;

       

       

      CyU3PDebugPrint (1, "I2C Write operation - dev:0x%x, size: %d,\r\n",(slaveAddr<<1), count);

       

       

      /* Update the preamble information. */

      preamble.length    = 1;

      preamble.buffer[0] = ((slaveAddr<< 1) | I2C_Operation_Write );

      preamble.ctrlMask  = 0x0000;

      status = CyU3PI2cTransmitBytes (&preamble, buf, count, 100);

       

      if (status != CY_U3P_SUCCESS)

      {

      return status;

      }

       

      /* Wait for the write to complete. */

       

      status = CyU3PI2cWaitForAck(&preamble, 100);

      if (status != CY_U3P_SUCCESS)

      {

      return status;

      }

      /* An additional delay seems to be required after receiving an ACK. */

      CyU3PThreadSleep (1);

       

      return CY_U3P_SUCCESS;

      }

       

      Note 1: this function i am using 2 API

                 1. status = CyU3PI2cTransmitBytes (&preamble, buf, count, 100);

                 2. status = CyU3PI2cWaitForAck(&preamble, 100);

       

      1. This code is working fine for Demod I2C write operation ( I am able to wirte the data to specific memory and i can read the data from same memory). the above 2 API gives status as CY_U3P_SUCCESS.

       

      2.   If i am try to writing data to tuner i am getting CY_U3P_SUCCESS after calling status = CyU3PI2cTransmitBytes (&preamble, buf, count, 100); API. But I am getting status value 74 after calling status = CyU3PI2cWaitForAck(&preamble, 100); this API.

       

      Note 2: 1. if i am sending only I2C_slave address with count value=0 its working fine.

                1. if i am sending  I2C_slave address with count >0 its not working.

       

      I probed the I2C bus with CRO. i am getting ACK at 9th clock cycle of every byte i attached the Image also ( slave address is 0x18).

      tuner.png

       

      Note 3: If i am writing the data to tuner to some register, i am getting status value 74 (CyU3PI2cWaitForAck) means NACK. But i am able to read the same register its giving the correct value what i sent in previously.

       

      Q1. why i am getting error code 74? if slave responding a ACK signal.

       

      Thank you

       

       

      With Best Regards,

      Thrimurthi M