1 Reply Latest reply on Sep 20, 2018 1:33 AM by user_1377889

    I2C ACK Polling

    user_199038981

      Hi,

      With PSoC 5, I2C Master UDB configuration, I am interfacing to a Microchip 244AA64F EEPROM. My goal is to write information to the EEPROM, then read back to verifty. So far I have only been successful by using a fixed CyDelay() with a minimum of 4 milliseconds. The Microchip data sheet has a flowchart for ACK polling which I've attempted but my status from I2C is always I2C_MSTR_ERR_LB_NAK, then becomes I2C_MSTR_BUS_BUSY and never becomes I2C_MSTR_NO_ERROR.

       

      Once the write has been performed a I2C_1_MasterSendStop()_is sent. Then I would like to somehow poll that the write cycle has completed and continue on.  The Microchip datasheet states that while a write cycle is in progress, the chip will not submit an ACK and recommends sending a start condition until the ACK is returned. This is how I've implemented it (unsuccessfully).

       

      status = I2C_1_MasterSendStart(0x50, I2C_1_WRITE_XFER_MODE) ;

      while(status != I2C_1_MSTR_NO_ERROR)

      {

           I2C_1_MasterSendStart(0x50, I2C_1_WRITE_XFER_MODE) ;

      }

       

      Is there a simple, tried and true method for polling?

      Thanks, Nick