I'm using the 28F069 with the EEPROM cat24c128 from OnSemiconductors.
The only changes I made to the code was to change:
#define I2C_NUMBYTES 3
The example Example_2806xI2C_eeprom.c works for 1 or 2 bytes only. Once you go over 2 byte the program spins waiting to get out of BUSY. Never get the STOP condition to continue with the read function.
Reading the specs for the I2C I noticed that the FIFO is 4 deep, but we are transmitting 5 bytes; 2 bytes for the EEPROM address and 3 bytes in the for() loop.
I2caRegs.I2CDXR = msg->MemoryHighAddr //byte 1
I2caRegs.I2CDXR = msg->MemoryLowAddr; //byte 2
// for (i=0; i<msg->NumOfBytes-2; i++)
for (i=0; i<msg->NumOfBytes; i++) // NumOfBytes = 3
{
I2caRegs.I2CDXR = *(msg->MsgBuffer+i); //3 byte sent here
}
//The TX FIFO has been overwritten
// Send start as master transmitter
I2caRegs.I2CMDR.all = 0x6E20;
Does anyone have a version that works?
Thank you.