Content originally posted in LPCWare by cmcquaid on Tue Apr 23 10:51:04 MST 2013
Quote: Genesy
Can you give me an example, please?
When the write not work it return the status code 11 that is a TIMEOUT error. Perhaps because in the meantime I read even at a rate of 300ms by an accelerometer always I2C and perhaps write command found the bus busy. How can I fix?
It is not the I2C bus that is busy, it is your EEPROM.
When you get a timeout, that is just the EEPROM's way of saying "try again later".
You can use a variable to keep track of how much data you need to write. Each time through your [FONT=Courier New]while[/FONT] loop, if you have data, try to write to the EEPROM. If the write succeeds, decrement your variable by the amount of data written.