Pages: [1]   Go Down
Author Topic: 24LC256 EEPROM - Low Write Delay?  (Read 1932 times)
0 Members and 1 Guest are viewing this topic.
Brazil
Offline Offline
God Member
*****
Karma: 3
Posts: 616
Wusik Dot Com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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
Logged


0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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().
Logged


Brazil
Offline Offline
God Member
*****
Karma: 3
Posts: 616
Wusik Dot Com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys, it all makes sense.  smiley-cool

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
Logged


Pages: [1]   Go Up
Jump to: