Andy
I think your code writes a buffer of data and reads a buffer of data but doesn't control the EEPROM's internal address. That means that (assuming after a power cycle) it will write to the page address 0, 1, 2,3,..n and then read back from the address n+1, n+2, n+3 etc. which will not read back the data that has been written (and the compare will fail).
This means that you need to control the internal address pointer (the first byte of the data sent when writing and also write it just before reading back again, as described in the EEPROM's data sheet).
The uTasker project includes support for the EEPROM that you are using (it also simulates it) and below is the reference code to write and read to/from page 3 (for example).
#define ADD_EEPROM_READ (0xa1 + (3 << 1))
#define ADD_EEPROM_WRITE (0xa0 + (3 << 1))
#define OUR_I2C_CHANNEL 0
static QUEUE_HANDLE I2CPortID = NO_ID_ALLOCATED;
static void fnConfigI2C_Interface(void)
{
I2CTABLE tI2CParameters;
tI2CParameters.Channel = OUR_I2C_CHANNEL;
tI2CParameters.usSpeed = 100;
tI2CParameters.Rx_tx_sizes.TxQueueSize = 64;
tI2CParameters.Rx_tx_sizes.RxQueueSize = 64;
tI2CParameters.Task_to_wake = 0;
if ((I2CPortID = fnOpen(TYPE_I2C, FOR_I_O, &tI2CParameters)) != NO_ID_ALLOCATED) {
static const unsigned char ucSetEEPROMAddress0[] = {ADD_EEPROM_WRITE, 0};
static const unsigned char ucReadEEPROM[] = {16, ADD_EEPROM_READ, OWN_TASK};
fnWrite(I2CPortID, (unsigned char *)ucSetEEPROMAddress0, sizeof(ucSetEEPROMAddress0));
fnRead(I2CPortID, (unsigned char *)ucReadEEPROM, 0);
}
}
Reception handler
if (fnMsgs(I2CPortID) != 0) {
while ((Length = fnRead(I2CPortID, ucInputMessage, MEDIUM_MESSAGE)) != 0) {
static const unsigned char ucSetWriteEEPROM1[] = {ADD_EEPROM_WRITE, 3, 5};
static const unsigned char ucSetWriteEEPROM2[] = {ADD_EEPROM_WRITE, 5, 3, 4, 5, 6, 7, 8, 9, 10};
int x = 0;
while (x < Length) {
fnDebugHex(ucInputMessage[x++], (WITH_LEADIN | WITH_SPACE | 1));
}
fnDebugMsg("\r\n");
fnWrite(I2CPortID, (unsigned char *)&ucSetWriteEEPROM1, sizeof(ucSetWriteEEPROM1));
fnWrite(I2CPortID, (unsigned char *)&ucSetWriteEEPROM2, sizeof(ucSetWriteEEPROM2));
}
}
On first use it reads and display the first 16 bytes in the page, then write 0x05 to address 3, followed by 3,4,5,..0xa to a addresses 5..12.
After a power cycle the values written (to verify they are non-volatile) are shown to be there as expected.

A binary file to do this on the FRDM-K64F is attached, whereby the I2C connections are on PTE24 and PTE25 and the debug interface on OpenSDA COM at 115200Baud.

Regards
Mark
Complete K64 solutions, training and support: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
I2C: http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf