I'm trying to interface an external EEPROM using the I2C/TWI protocol using the Wire library. I found http://www.arduino.cc/playground/Code/I2CEEPROM which contains some functions to interact with an external EEPROM. However, I discovered several problems with the Wire library:
If more than BUFFER_LENGTH (32) bytes are sent during a transmission, the rest of the data is silently ignored. This is documented nowhere in the library reference.
There's a huge amount of copying data from buffer to buffer performed. When Wire.send() is called, the data is copied into a transmit buffer in Wire. When endTransmission is called, this is copied again to a buffer in twi.c. In total five buffers of 32 bytes are allocated, a total of 160 bytes of the 1kB of RAM available in an ATmega168. That's over 15% of the total memory just for copying data around. Couldn't at least some buffers be reused, and couldn't there be synchronous send methods that simply sends the data from the calling function's arrays?
Then to my problem:
An EEPROM can write anything from 1 byte to 128 bytes in a constant time of ~5ms time. The buffering of the Wire library limits it to writing 30 bytes at a time. Is there any way of overcoming the spending of five times the required time in order to write a full page? Is there any alternative library available that would allow synchronous writing, without the huge amount of buffers allocated? Is it for example possible to split a full page write into separate transmissions, or does the EEPROM detect the end of transmission in between?
Thanks for any help!