This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EZUSB FX2 I2C EZUSB_WaitForEEPROMWrite() problem

Hi,

I'm trying to access an EEPROM with an EZUSB FX2 dev board. I have written the following code to write to the EEPROM

   eeprom_buf[0]  = LSB(0);
   eeprom_buf[1]  = value;
   eeprom_buf[2] = EZUSB_WriteI2C(0x53, 2, eeprom_buf);
   EZUSB_WaitForEEPROMWrite(0x53);


This writes the device I2C address(0x53), the internal EEPROM address(0) followed by the actual data value. It used to work, but suddenly it doesn't seem to work anymore.

I've checked the actual SDA/SCL lines to see what's going through, and it seems that the problem lies with EZUSB_WaitForEEPROMWrite(). Right before this function is called, the SDA waveform looks fine. It shows 101001100(address 0x53, a WR, and finally an ACK), followed by 000000000(address 0, ACK), followed by 000011100(value 0xE, ACK), then a 1(STOP).

Once I include the EZUSB_WaitForEEPROMWrite() function, the device address(1010011) keeps getting written to the bus over and over again, and the controller keeps receiving a NACK instead. EZUSB_WriteI2C() returns 1, so apparently it is successful.

Does anyone know why? Do I even need to run EZUSB_WaitForEEPROMWrite()?

0