Other Parts Discussed in Thread: PCF8574
Hello everyone,
I wrote my own library to handle i2c based on your eeprom example which uses interrupts and API for 79D. This is code in main loop:
while(1)
{
counter++;
uint16_t data[] = {0x0F, 0x1F, 0x2F, 0x3F, 0x4F};
I2C_lib_MasterWriteRead(&I2cMaster, SLAVE_ADDRESS, data, 5, 0);
while (I2cMaster.status != I2CM_STATUS_READY);
I2C_lib_MasterWriteRead(&I2cMaster, SLAVE_ADDRESS, data, 0, 5);
while (I2cMaster.status != I2CM_STATUS_READY);
I2C_lib_MasterWriteRead(&I2cMaster, EEPROM_ADDRESS, data, 2, 1);
while (I2cMaster.status != I2CM_STATUS_READY);
}
This code works perfectly when I2C is running on 400 kHz. But when I set I2C speed on 100 kHz it freezes on while loop after one transaction. It's working on 100 kHz when I put some delay between WriteRead functions, like:
for(i = 0; i < 100000); i++)
counter++
But as I said, it's working on 400 kHz. I can see SDA line on my scope and on my logic analyzer. When running on 400 kHz everything is ok like start, ack and stop conditions.
I have no idea why it doesn't work on 100 kHz. I am using API which TI provided and I am using interrupts so single bits shouldn't bother me I suppose...
I appreciate any help.
BR,
Dawid.
PS: my code is in an attachment.