There are three pools of memory in the microcontroller used on avr-based Arduino boards :
- Flash memory (program space), is where the Arduino sketch is stored.
- SRAM (static random access memory) is where the sketch creates and manipulates variables when it runs.
- EEPROM is memory space that programmers can use to store long-term information.
Flash memory and EEPROM memory are non-volatile (the information persists after the power is turned off). SRAM is volatile and will be lost when the power is cycled.
The ATmega328 chip found on the Uno has the following amounts of memory:
- Flash 32k bytes (of which .5k is used for the bootloader)
- SRAM 2k bytes
- EEPROM 1k byte
The ATmega2560 in the Mega2560 has larger memory space :
- Flash 256k bytes (of which 8k is used for the bootloader)
- SRAM 8k bytes
- EEPROM 4k byte
SPI FLASH VS EEPROM:
- EEPROM have smaller capacity (typically in Kbit size) will Flash have a larger capacity (typically in Mbit size)
- SPI bus is more commonly seen in Flash device due to high serial speed (in MHz range, e.g. 40/60MHz)
- Flash has divided memory into three levels of granularity, namely: pages, blocks, sectors(This apply to Atmel DataFlash/Adesto DataFlash)
- EEPROM data memory is seen as a block of continuous memory, each data with respective address. Each data byte is access by its respective memory address.