Go Down

Topic: 24LC256 EEPROM - Low Write Delay? (Read 2087 times) previous topic - next topic

WilliamK Govinda

Guys, I'm using the 24LC256 EEPROM from SparkFun.com, and I wish to know if its possible to lower the delay it takes to write a single byte. Below is the code I'm using, but from the PDF details I see there's an option to check the chip if its ready to continue or not, after you write a byte to it.

Code: [Select]
  void writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data )
  {
    Wire.beginTransmission(deviceaddress);
    Wire.send((int)(eeaddress >> 8));   // MSB
    Wire.send((int)(eeaddress & 0xFF)); // LSB
    Wire.send(data);
    Wire.endTransmission();
    delay(5);
  }


From: http://10kohms.com/arduino-external-eeprom-24lc256

Thanks for any help, WilliamK

florinc

5ms is the max guaranteed time for a write cycle, according to the datasheet: http://ww1.microchip.com/downloads/en/devicedoc/21203m.pdf
You can lower it, but you take a chance (your data may not be written).

kg4wsv

I haven't seen any Arduino code to check the write status, but as you've seen the data sheet says it's possible.

I worked around the problem by latency hiding.  I used multiple EEPROMs and wrote to them sequentially, and interspersed some computation between the write sequences.

-j

liudr

kg4wsv, thanks for sharing. That's a smart way!

WilliamK, I've been looking for a while and couldn't find a thing. The I2C library in arduino is like an onion, layer after layer. There's like wire, TWI, etc. I couldn't find anywhere to access status bit on the bus. I think I made a post and didn't get much response. My guts feeling is that it is not possible unless you want to modify the library. Currently the I2C library just takes a whole bunch of bytes, and only writes the bytes when the communication is terminated by the call Wire.endTransmission().

WilliamK Govinda

Thanks guys, it all makes sense.  8)

Well, my current project can live with the latency, but it would sure be nice if it didn't have it. ;-)

In any event, I will deal with this later on.

Wk

Go Up