Memory (Part 1)

Part 123456

The intention of this series of posts is to share a number of tips and tricks which will help developing quite big applications. I also plan to explain how I managed to increase the available memory for Arduino applications along with some application examples.

I shall take the good ol’ ATmega328 as a reference for the following explanations and code samples. Please check the adequate documentation if you plan to use other microprocessors.

Firstly, let’s try to recap the various types of memory that we can, or could use from, or with Arduino:

SRAM (So as to say Static Random Access Memory)
This is a volatile read/write memory; it has a unlimited number of read/write cycles. The ATmega328 has 2 Kb of SRAM for storing run time variables. It is possible to add some more SRAM to Arduino, to the cost of SPI or I2C lines, some code, and some delays. MICROCHIP offers a small 8 pins DIP or SOIC chip which can hold up to 32 Kb (25 6Kb) for a cheap price. I plan to cover this option in the next posts.

EEPROM (so as to say Electrically Erasable Read Only Memory)
This is a read write/memory; it has a higher but limited number of write cycles (in the range of x00.000). The ATmega328 has 1 Kb (1024 bytes) of EEPROM. You may use the EEPROM library in order to access this interesting memory space. I personally use it for storing fixed strings such as message strings and default parameters (some sort of built in .ini file!)

This is rewritable non-volatile memory; it has a limited number of write cycles (in the range of x0.000) which is due to strentgh of the energies involved for writting data. The ATmega328 has 32 KB (with 0.5 Kb used for the standard bootloader). This is the pace where the code is loaded. It is separate from the memory which is used for storing variables at run time. It is possible to use this – sometimes precious – memory space, but you will need to download your code with an ICSP adapter. Next is a picture of the AVR ICSP MKII. It plugs to the 6 pins ICSP port next to the reset button and to the PC through a USB cable.

SD Cards make use of FlashRAM of NAND type

FRAM (So as to say Ferroelectric Random Access Memory)
This is rewritable non-volatile memory; its performances are halfway between SRAM and EEPROM. FRAM are fast (set times in the range of tens of nano seconds) and allow unlimited number of rewrite cycles. RAMTRON offers a small 8-pin SOIC chip which can hold up to 256 Kb for a moderate price. I plan to cover this option too in the next posts.

Next post on same subject


  1. Jean-Francois Theoret says:

    Have you ever thought of trying out the atmega644p (aka Sanguino) for larger programs? It gives you twice as much FLASH, RAM & EEPROM. I plan to give it a spin for larger (web server type) applications.

    • Didier says:

      Well, I made the decision to stick to the original Arduino platform…
      Anyway, the atmega644p was far from my expectations. I needed to store 4 vectors of up to 1024 doubles which make 16K bits…, 4 times what the atmega644p offers …

Leave a Reply

You must be logged in to post a comment.