Understanding memory types in Arduino Uno


Arduino Uno, or any other microcontroller for that matter, generally has 3 types of memory −

Flash

  • This is where Arduino sketch is stored.

  • Any variable defined using PROGMEM or the F() macro is also stored here. Note that such variables are immutable by default, i.e., their values can't be changed at runtime.

  • Flash memory is non-volatile (i.e., the stored content is not lost even after power is turned off)

  • It is slower to access than SRAM, but since it is much larger in size than SRAM, some immutable strings/ arrays can be stored here to avoid overflow of SRAM.

  • It generally has 10,000 read/write cycles.

SRAM

  • This is where the normal variables of the sketch are created, stored and manipulated.

  • SRAM is volatile, i.e., the stored content is lost as soon as the power is turned off

  • SRAM is very quick to access.

  • It has practically unlimited read/write access.

EEPROM

  • Like Flash, EEPROM is also a non-volatile memory.

  • EEPROM can be used to store long term information irrespective of the sketch in the Flash (like some config variables to be used across sketches)

  • EEPROM is the slowest to access among all three memory types.

  • It generally has 100,000 read/write cycles

Arduino Uno has ATmega328P, which has the following specifications −

  • Flash − 32 kb

  • SRAM − 2 kb

  • EEPROM − 1 kb

Updated on: 24-Jul-2021

375 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements