Question about I2C EEPROM - 256kbit

Hello,

I've seen this EEPROM:

http://www.sparkfun.com/commerce/product_info.php?products_id=525

and this tutorial:

http://www.ghettohax.com/2009/02/i2c-eeprom-for-arduino.html

I would like too use it to have some external storage space.

In the second alinia there is:

"I found code and tutorial for using I2C EEPROMs on the Arduino which was perfect since it would only take up 2 pins (pin 4 and 5) and I could put up to 8 EEPROMs on a single bus."

What does putting 8 EEPROMS one one bus mean?

Is it also possible to put multiple EEPROMS is series to get more storage space?

Thanks in advance.

The device has three address pins, giving eight possible I2C addresses.
By tying the address pins high or low, you can set the range of addresses each device responds to.

When he’s saying 8 on one bus, he means the I2C bus. So you can plug in 8 of those EEPROM (all must have different addresses) with the same wires, just jumping from 1 eeprom to the next.

I’ve got a setup with 5 EEPROM at the moment, just for testing and whatnot, but here’s an example of what it’s like to write to them all.

This writes the text from TEST to the first byte on the eeprom (location 0, or BEGIN) and then prints it back to you on the Serial port.
Here’s an example of how the address works. (it may or may not be the same for yours) A2 A1 and A0 are the address pins.

A2 A1 A0
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | = 0x50
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | = 0x51
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | = 0x52
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | = 0x53
| 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | = 0x54
| 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | = 0x55
| 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | = 0x56
| 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | = 0x57

#include <Wire.h> // specify use of Wire.h library.

// address in 24ATC02 values from 0 to 255. 

int BEGIN = 0;
int ADDR[] = {
  0x50, 0x51, 0x52, 0x53, 0x54};
char* TEST[] = {
  "Chip0", "Chip1", "Chip2", "Chip3", "Chip4"};


void setup() 
{ 
  Wire.begin(); // join i2c bus (address optional for master) 
  Serial.begin(9600);  // setup serial for output 
  // send test message "Arduino"
  for(int x = 0; x < 6; x++){
    Wire.beginTransmission(ADDR[x]); // connect to 24LC08 device address 
    Wire.send(BEGIN); // beginning address within EEPROM
    Wire.send(TEST[x]);
    Wire.endTransmission(); 
    delay(10);
  }

} 

void loop() 
{ 

  for(byte x = 0; x < 6; x++)
  {
    Wire.beginTransmission(ADDR[x]); // link to 24LC08
    Wire.send(BEGIN); // must act as a position pointer
    Wire.endTransmission();
    delay(10);
    Wire.requestFrom(ADDR[x], 5); // request 7 bytes from slave device 24LC08
    delay(10);
    // below will loop until 7 bytes are received. 

    while(Wire.available()) // slave may send less than requested 
    { 
      char c = Wire.receive(); // receive a byte as character 
      Serial.print(c); // print the character 
    } 
    Serial.print("\n"); // next line
  }


  delay(10000); // wait one second. 
}

Thanks for the replies :), I get the EEPROM addresses now.

I want to use these EEPROMS to temporarily store an image coming from my C328 camera. The image has a maximum size of 40 KB. What is the write and read speed approximately?

Thanks for the example.

Cheers.

The data sheet says:-

5msmax.writecycletime

So for 40K it will take 1024 * 40 * 5 = 204800 mS That is about three and a half minutes. :(

Also you will need to split this over two chips as there is only 32K bytes in 256 K bits.

As you might gather this is not the chip for the job. How about a 256K bit SRAM 23K256?

Wow… That takes a long time. I’ve already ordered two of these IC’s… (well the will be useful probably for another project).

How about a 256K bit SRAM 23K256?

I assume this will also take a long time to write/read, so I don’t know if this is the best solution. I need fast read/ write features.

Cheers.

Hello,

So for 40K it will take 1024 * 40 * 5 = 204800 mS That is about three and a half minutes.

I was testing writing to EEPROM http://www.sparkfun.com/datasheets/IC/24LC256.pdf and yeah it´s slow, but I am performing byte per byte writes. Im not sure but if you choose to write an entire page than byte per byte (seems that chip keep info into a buffer prior to write, not sure) you average time will not decrease?

Cheers,

Rodrigo

One thing I've thought about (but not tested) is using multiple EEPROMs. Since that 5ms delay is in software, assuming the software has enough other work to do and/or enough other EEPROMs, write a byte/chunk to EEPROM 1, make another write to EEPROM 2, then EEPROM 3, and so on. This way you could (theoretically) write continuously to your "bank" of EEPROMs.

Checking on the page write capability is a good suggestion, too.

IIRC, it is possible to check the status of the write, so instead of blocking for the worst-case 5ms, you could always poll the device to see if it's done, then make the next write. Could be a bit faster...

-j

On an Atmega 168/328 the maximum reliable I2C clock rate is 400 khz... per Atmels spec sheet. At that rate, the 'theoretical maximum' transfer rate would be around 44 kilobytes per second... and thats for very big transfers which have no page boundaries or chip address spaces to cross.

If that's not fast enough, I2C memory, whether its EEPROM or Static RAM, is plainly out of the question, and you will need to investigate other options.


In actual practice you'll almost always get somewhat less than theoretical maximum.

I've been developing a non-volatile static RAM shield (just got my first batch of PCBs last weekend!).

I started out using the Wire library, and was able to write 23 kBytes per second. But Wire is written for broadly general purpose uses.

So I wrote my own I2C routines, specialized to my purpose. and was able to write 38 kBytes per second. But, alas, it could not co-exist with Wire.

So I compromised, and re-wrote the library to stay out of the way of Wire. I can now write 33 kBytes per second, hoping to get it back up to 38, yet still be compatible with Wire.

In other words, you are looking at less than 40 kBytes per second transfer rate using I2C on an Atmega.

Quote: How about a 256K bit SRAM 23K256? I assume this will also take a long time to write/read,

No this device has an SPI interface that will go up to 20MHz at 3V and will store data as quickly as you can write to it. There is also a page mode and a sequential mode so you can speed it up even more.

The downside of SRAM is that it's RAM, and will clear when the power goes off...

This Atmel dataflash is interesting; it's flash, but it has 2 SRAM buffers. One can write until a buffer is full, issue a write command, and immediately start writing to the other buffer. It's also an SPI interface, so plenty fast.

-j

The downside of SRAM is that it's RAM, and will clear when the power goes off

yes but this is not an issue for the original application being talked about here:-

I want to use these EEPROMS to temporarily store an image coming from my C328 camera