2 Replies Latest reply on Mar 27, 2017 1:01 AM by userc_38701

    Avoid I2C_MasterStatus() Continuous Polling on I2C

      Hi All,


           I am using Cypress PSoC 5LP for communicating with sensor over I2C Bus.


      PSoC acts as master while sensor act as slave device.


      PSoC sends read command to sensor. Sensor responds after 80ms with 3 Bytes reading.(Hold master SCK Line pull low)


      I am getting the data properly without any error.




      Stat = I2C_MasterReadBuf(DeviceAddress, pBuffer, NumBytes, I2C_MODE_COMPLETE_XFER);


      if(Stat == I2C_MSTR_NO_ERROR)


                   while (0u == (I2C_MasterStatus() & I2C_MSTAT_RD_CMPLT))
                         /* Waits until master completes Read operation */




      As per the code snippet master polls in while loop for almost 80ms till data comes.


      How can I avoid this polling?


      Is there is any other API which tells when data is available now read it?


      Thanks & Regards,


      Pratik Pawar