June Wednesday 20

Bookmark and Share

Related Articles...

MILWAUKEE WI Arduino Meet Up Make Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Arduino Make Space Acquired!

Email :

COASMailBox @ gmail.com

WISCONSIN NEW TECHNOLOGY  & INDUSTRY CENTER Embedded Computing Maker Group - Learning, Building, Meetup, Startup Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Raspberry Pi Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Internet of Things (IoT) Meet Up Make Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Make Space Acquired!

Full Advanced Fabrication Facility, machine Shop, Welding, Electronics Lab Equipment Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Machine Repair, & Installation  - Tier 1 Business Support

Machine Technician Mechanic 20+ Years  Personal Experienced In Industrial Factory Machine Servicing, Rebuilding, Installation And Repair - Plus A 35+ Years Experienced Computer Engineer Service Technician Team Ready For Your Outsourced Market Advantage Needs!

Hartung Industrial - Member - CGI Science & Technology Group

Email :

COASMailBox @ gmail.com

2018 June REVIEW


Arduino Memory

2017 | by Gene Casanova

Senior Systems/Network/Internet/Robotics Engineer

Arduino UNO

There are three memory resources in the microcontroller used on an Arduino systemboard:

  1. "Flash memory" ("Program Memory") The memory a program is stored in on-chip. The program is retained when electrical power is removed.
  2. SRAM (static random access memory); where a program creates and manipulates variables when it runs.
  3. EEPROM, a long term storing memory.

BEWARE - 'Flash memory' and 'EEPROM memory' are non-volatile; meaing content is retained after power is removed fromt he device.

SRAM is volatile and will be lost when the electrical power is removed.

ATmega328 MPU

The 'ATmega328' microcontroller, the Arduino UNO REV3 is based on, fhas the following amounts of memory:

Flash  32K bytes (0.5k is used for the "Arduino bootloader")
SRAM 2K bytes
EEPROM 1K byte

The 'ATmega2560' in the 'Arduino Mega2560' has larger memory space:

Flash  256k bytes (8k is used for the "Arduino bootloader")
SRAM 8K bytes
EEPROM 4K byte

Notice The small amount of SRAM available in the Arduino UNO.  It is easy to use it all by having lots of strings in a program.

For example, with a declaration like:

char message[] = "Tasmania Cradle Mountain is an Amazing And Unique Environment On Earth I Enjoy Experinecing With A Special Person; ..y

each character is 1 byte, plus the '\0' terminator; therefore the example above requires 119 bytes of SRAM.  It does not take much to fill SDRAM to the 2048 capacity; especially when large amounts of text is being sent to a display, or a large lookup table.

When SRAM becomes filled, a program may fail in unexpected ways; it will appear to upload successfully, but not run, or run strangely.  To check if this is happening, try commenting out the source code line in question, or shorten suspected strings or other data structures in the source code.  If the programs then runs successfully, then filled SDRAM probably was the cause of prorgam failure.  There are a few things to address SDRAM problems:

Flash Memory

Flash memory is used to store a program and any initialized data.

A program can execute from flash, but data cannot be modified in flash memory from the executing program.

To modify any data loaded with a program into flash memory, it must first be copied to SRAM.

Flash memory is the same memory technology used for SD flash memory cards.  It is non-volatile; a program will be retained when electrical power is removed.  Flash memory has a finite lifetime of about 100,000 write cycles!

BEWARE: Upload 10 programs a day, every day, for 27 years, the microcontroller flash memory has passed its expected life and should be taken out of service and through away.


SRAM (Static Random Access Memory), can be read and written to from an executing program.

Static Data - This is a block of reserved space in SRAM for all the global and static variables from an executing program.  For variables with initial values, the runtime system copies the initial value from Flash when the program starts.

Heap - The heap is for dynamically allocated data items.  The heap grows from the top of the static data area up as data items are allocated.

Stack - The stack is for local variables and for maintaining a record of interrupts and function calls.  The stack grows from the top of memory down towards the heap.  Every interrupt, function call and/or local variable allocation causes the stack to grow.  Returning from an interrupt or function call will reclaim all stack space used by interrupt or function.

BEWARE: Most memory problems occur when the stack and the heap collide.  When this happens, one or both of these memory areas will be corrupted with unpredictable results. In some cases it will cause an immediate crash. In others, the effects of the corruption may not be noticed until much later.


The microcontroller on the Arduino and Genuino systemboards have EEPROM memory.

EEPROM memory retains content when electrical power is removed from the systemboard, or microcontroller chip.

The microcontrollers on the various Arduino and Genuino systemboards, have different amounts of EEPROM:

1024 bytes on the ATmega328

512 bytes on the ATmega168 and ATmega8,

4 KB (4096 bytes) on the ATmega1280 and ATmega2560.

The Arduino and Genuino 101 systemboards have an emulated EEPROM space of 1024 bytes.

Use The Technology Wisely & Keep It Simple

- Cheers!

Gene Casanova

Cyber Security Since 1979 - Consulting Available | IoT Full Stack And App Developer

CGI Computer Wares | EST 1979

Send E-MailCONTACT: [click]@CGIComputerWares.com