I was wondering if I could use a 24LG256 EEPROM chip like RAM with my Arduino Nano, or just to store and recall big bitmaps that are giving me the dreaded "Not enough space" error. My project is a retro game hand-held, that combines some other game projects, like flappy bird, space invaders etc.
I think the answer is yes, there will be a way, but also no, probably not in the way I suspect you are thinking.
EEPROM is not RAM. Adding it won't increase the small amount of RAM that your Nano has. EEPROM has limited write-cycles, so you need to use it with care.
The EEPROM chip you mentioned uses an i2c interface, which will make it far far slower than the Nano's RAM or it's built-in Flash memory.
You will almost certainly need to load bitmaps from EEPROM into the Nano's RAM before use.
I'm assuming by "Arduino Nano" you mean the classic Nano (ATMEGA328). But there are many models of Nano these days, with different chips and capabilities. As a beginner, it would be simpler to choose a model with more RAM so that you don't need to try to add extra RAM using additional chips. Most other Nano models have far more RAM than the classic Nano.
The only Arduino. that allows you to add extra memory that is mapped into the memory space, is the Arduino Mega. You can't do this trick with anything else, and it has to be static memory not anything else.
However, you can add extra memory as an external device. This has to be static memory and is accessed by your code switching some pins and reading this external memory. It is useful if you have large arrays you want to access. I have used this technique to add memory for holding sound buffers when doing sound effects work.
If you want to do anything similar to this I can dig out the schematics and example code to show you how to do this.
Sorry to be so vague. Just to clarify I wanted to write a program to flash it with all my sprite, logo and custom text bitmap etc. Then have Nano load into its SRAM for the display buffer, before sending to the 128x64 OLED (I am using the Adafruit SSD1306 library) Then clearing the buffer so the Nano doesn't have to remember these big bitmaps. Thanks for all the quick replies!
That is relative easy but you have a fair amount of software to control it and external hardware. What you would do is write the address to the ‘address latch’ then read or write 8 data bytes.
A much simpler way is to use FRAM either in SPI or I2C format. I use a I2C part that is 32K x 8 with a cost less then a pack of cigarettes. The I2C versions needs 2 connections, SCL and SDA and 2 more for power. The SPI needs at least 3, MISO, MOSI, CLK but preferably 4 lines, the 4th being CS\ Chip Select plus power. I cannot determine for sure what is best as I have no idea of what else is connected to the processor.
Fram for all practical purposes has unlimited write and reads without any delays. It can be used on a byte by byte basis. There are many libraries to support this.
The 3A lines allow you to select the address so you can add 8 in total for 256K x 8. There are also larger parts available. The W allows you to write protect the contents.
They like EEPROM they remember when the power is removed for a lot of years.
Thanks!
I think I will get one of those. If I get a few I can use them in other projects too. The only reason I was asking about the EEPROM was because its what I have in the way of storage in my IC box at the moment.
Thanks for the help, I really appreciate it. I will look into getting some FRAM.
If you are using a classic Nano (atmega328 processor), make sure you get FRAM memory that is compatible with 5V logic levels.
The SPI version is going to be much faster, I2C on a Nano runs at a maximum of 400KHz, SPI can run at 8MHz.
The tests I've done using an SPI FRAM at 8MHz on a Nano will display 24 images/second compared to 26.5 images/second when the images are stored in PROGMEM. At 1MHz SPI this drops to 20.5 images/second. Using the Adafruit_SSD1306 and Adafruit_FRAM_SPI libraries with a 128x64 display, reading the images from FRAM directly into the display buffer.
Note we use the very cheap and easy to use (because they are DIL chips) static memory chips 23LC1024 Also note it uses the TSCP or programming header on the Arduino board.
Now the block diagram of how a delay is implemented