2 Replies Latest reply on Mar 31, 2017 12:52 AM by userc_38957

    CyU3PI2cReceiveBytes error

      Hi!  I use CyU3PI2cReceiveBytes function and it returns sometimes error.


      I tried the following things, but these could not solve the problem.

      • Change retryCount (last parameter of CyU3PI2cReceiveBytes) to 10.

              if CyU3PI2cReceiveBytes returns error,

      • CyU3PBusyWait(0xFFFF) and call CyU3PI2cReceiveBytes again.
      • CyU3PUsbStall(0, CyFalse, CyFalse) and call CyU3PI2cReceiveBytes again.

      If CyU3PI2cReceiveBytes function returns error, how to retry? Or How to avoid error?


      (I don't know which error happened, because it is a little bit hard to debug. )

        • 1. Re: CyU3PI2cReceiveBytes error

          Did you try waiting for the ACK from the device? You can use the API CyU3PI2cWaitForAck (If the slave is taking more time to respond). Please monitor the I2C bus as well to check if the clock is okay. 


          We have an example in our SDK-UsbI2cRegMode, where we talk to on-board EEPROM slave (CYUSB3KIT-003). We have checked it to work fine, you can refer the same to see how we have implemented.

          • 2. Re: CyU3PI2cReceiveBytes error

            Thank you Nishant. I tried to wait for ACK from the device by CyI3PI2cWaitForAck but I could not solve it.
            I researched on detail and noticed that it depended on the physical condition. In this case, USB3.0 cable seems to be not good. When I replaced to good cable, it has never happened. Thank you for your response. If same situation happened, I will try CyI3PI2cWaitForAck again.