TYPES OF MEMORY ON THE ARDUINO

In this article, we will learn about the built-in memory blocks of the Arduino prototyping platform. We will give particular emphasis on describing and understanding the basic operations of the different memory blocks on the Arduino, namely Flash Memory, Electrically Erasable Programmable Read-Only Memory (EEPROM) and Static Random Access Memory (SRAM). We will also discuss the architecture and physical design of memory.

WHAT IS MEMORY?

Memory is an essential resource important to any computing system, especially in embedded systems. The memory sub-system is one of the many sub-systems inside a microcontroller. In Figure 1, a bus connects the memory module to the CPU and I/O devices. The purpose of the memory block is to store run-time data or information temporarily or permanently, depending on the program requirements.

In the context of computing systems, memory refers to the metal-oxide-semiconductor devices which store and retrieve information or data for further processing by the CPU. We can consider memory as a tabular array of cells as shown in the diagram below. Each cell stores this information in the form of basic units called bits, which switch states between 0 and 1.

The cells have the following properties:

  • Each cell can remember data of certain sizes. Typically, sizes of 1 byte or 8 bits of information can be stored in a cell.
  • Each cell has a unique number for identification and location addressing.
  • More importantly, we can store or read information from each cell through a WRITE or READ operation.

MEMORY OPERATIONS

write operation accepts an address and a value. A read operation accepts an address and returns the information stored at that particular location. Data storage – in some texts, the hexadecimal notation represents data in memory. The main advantage is that hex notation stores data more efficiently than integers or strings. For example, the hex notation of 01111101 is 7D, this value is then stored in a cell whose address is 175. Here, we see that each byte of memory is equivalent to two hex digits only. In another example, the memory storage for the decimal number 1962 is 1F1A. This requires only 2 memory cells for storage. We can repeat the same operation for storing a string such as “memory”.

VOLATILE VS NON-VOLATILE MEMORY

There are different types of memory devices available, and the application area of each memory device depends on the architecture of the memory system.

Some memory systems require power to maintain the stored information. Such a system is called volatile memory. The device keeps the data as long as there is electrical power. This means that such short-term memory systems are suitable for storing working data and machine code.

On the other hand, some memory systems can remember the information even if the power of the device has been turned off. These are called non-volatile memory. The purpose of such memory systems is for long term data storage. Examples of non-volatile memory are ROM and flash memory.

Now, let’s see the difference between volatile and non-volatile memory:

Volatile MemoryNon-Volatile Memory
DescriptionLoses all the data when power is lostRetains all the data when power cycled
UsesCache, Registers,
Static RAM (SRAM),
Dynamic RAM (DRAM)
Hard disk drives
EEPROM
Flash memory
Temporary retention of dataPermanent retention of information

TYPES OF BUILT-IN MEMORY ON THE ARDUINO

Figure 3 shows the general memory tree of a computer system. The diagram also shows the Arduino related memory sub-systems.

WHAT IS FLASH MEMORY?

Flash memory, also known as flash storage, is the current leader in the semiconductor memory market in terms of both production units and sales. This is because flash memory has the lowest cost per bit memory. Also, it is fast and easy to store information. It is a non-volatile memory, which means that the cells keep the information for an extended period even when power to the device has been interrupted. In microcontroller chips, flash memory is integrated on-chip and it is used as program memory. Flash memory cells are electrically written or erased and they can have up to 10,000 write-erase cycles.

Flash memory is common in the following devices:

  • Cell phones
  • Computer networking devices
  • Consumer electronic products such as digital cameras, camcorders, and video game consoles,
  • Industrial devices, e.g. security systems, military systems, and retail products
  • Memory cards and solid-state disk drives

HOW FLASH MEMORY WORKS

For us to understand the working principles of a flash memory cell, we need to understand the operation of a basic floating-gate Metal Oxide Semiconductor Field Effect Transistor or MOSFET as shown in Figure 4.

A flash memory cell, in Figure 4b, uses the concept of a floating gate MOSFET to save a bit of information. The MOSFET has a control gate and a floating gate. The purpose of a dielectric material is to separate the control gate and the floating gate from the substrate and terminals. The floating gate is responsible for storing the charge as well as controlling the flow of current.

A MOSFET is a voltage-driven switch that controls the flow of current in an electronic circuit. The devices are made from a doped semiconductor material. Unlike magnetic power control devices, MOSFETs have a very small form factor and they do not have moving parts. This means that MOSFETs can operate much faster than magnetic switching devices. As shown in Figure 4, the devices have three basic external connections: the source, drain and the gate. The source is connected to the ground, the drain is connected to the load and finally, the MOSFET will be switched ON when a positive voltage is connected to the gate.

FLASH MEMORY CELL

The charge of the floating gate determines the flow of current from the source to the drain. The floating gate can be neutral, positive or negatively charged. If the floating gate is neutral, then the storage transistor will behave like a normal MOSFET. A positive charge on the control gate creates a conducting channel in the p-substrate and current flows from the source to the drain. Lastly, a negative charge on the floating gate prevents the formation of a channel in the p-substrate.

Another important parameter is the threshold voltage. This is the minimum voltage at the control gate which can make the channel conductive.

Operations which can be performed on the flash memory cell include programming the cell and erasing the cell. When we program a Flash memory cell, what we are physically doing is placing electrons into the floating gate. On the other hand, when we remove the charge from the floating gate, we are essentially erasing the memory cell. However, the detailed process of trapping or removing electrons from the floating gate is beyond the scope of this article.

ARDUINO FLASH MEMORY

Flash memory, also known as program memory, is where the Arduino stores and runs the sketch. Since the flash memory is non-volatile, the Arduino sketch is retrieved when the micro-controller is power cycled. However, once the sketch starts running, the data in the flash memory can no longer be changed. Modification can only be done when the program is copied into SRAM memory.

The table below show the amount of flash memory available on some different Arduino boards:

The size of the program is displayed after you upload the sketch in the program notification window at the bottom of the IDE. For this example, our code will only occupy 1758 bytes of program space from a total of 30720 bytes.

WHAT IS EEPROM MEMORY?

Electrically Erasable Programmable Read-Only Memory (EEPROM) is an inexpensive, non-volatile memory block which means that we do not lose the data when we remove power from the device. This type of memory is used to store small amounts of data which are written occasionally and then read multiple times. Most EEPROMs on the market today have either SPI or 12C serial interface for communication. An EEPROM memory cell is almost identical in architecture to the Flash memory cell, except that the EEPROM cell carries an additional regular CMOS transistor, as shown in Figure 6. The operation of a Flash memory cell and the trapping of charge by the floating gate have been discussed in the previous chapter. However, the additional transistor in the EEPROM structure is used to erase the charge.

ARDUINO EEPROM

In some instances, we may need to store the states of certain input and output devices on the Arduino for long periods. For that, we save the data to EEPROM memory with the help of Arduino libraries or third-party EEPROM libraries. This helps us to remember the information when we power up the Arduino again. Most of the Arduino boards have built-in EEPROM memory, but in some cases, certain programs may require the use of an external EEPROM. The functions below help us to interact with the Arduino EEPROM.

#include <EEPROM.h>
EEPROM.write(address, value);
EEPROM.read(address);
EEPROM.update(address, value);
EEPROM.get(address);
EEPROM.put(address, value);

To update or write to EEPROM, we need the address to write to and also the value to write or update. The read function accepts the address to read from and returns the value stored at that address. The get() and put() functions operate just like the read() and write() functions respectively, except that the former allow us to store other data types such as floats, structs or integers.

WHAT IS SRAM MEMORY?

Static Random Access Memory (SRAM) is a type of RAM that uses a set of transistors to store a bit of data. SRAM memory is volatile. This means that the memory cell will hold a bit of data for as long as there is power to the circuit. Unlike Dynamic Random Access Memory (DRAM), the SRAM memory cell does not require constant refreshing to retain the data. It is much more expensive than DRAM, smaller in structure but faster. These characteristics are suitable for use in high-performance servers or cache memory, typically applied between the main memory and a system’s CPU.

HOW SRAM MEMORY WORKS

Figure 7 shows a typical SRAM memory cell for storing 1 bit of data. Multiple cells are stacked together in rows and columns to make a byte or words of memory, as shown in Figure 8. In the simplified SRAM representation which is shown in Figure 7, we see two inverted transistors which feedback on each other, bit lines, and a word line for addressing memory cell connection to the CPU. To write a byte of information, the address bytes are decoded so that the word line turns on the two transistors which correspond to this memory cell. Then, the bit lines are driven with the information to be stored. The inverted transistors which are inside the memory cell change their bit states to keep the new value. After a successful write operation, the word line is then turned off and the information is saved.

To read a value stored in SRAM memory, the address bytes are decoded to enable the word line which corresponds to the memory cells. When reading the data, nothing is driving the bit lines so the feedback inverters drive the saved data back to the bit lines instead.

ARDUINO SRAM

The Arduino SRAM or runtime data is where the program creates and stores sub-routine variables and interrupts calls when the sketch runs. The initialized variables of a program are placed in the .data section while the uninitialized variables are placed in the .bss section. At the end of the SRAM block is where you find the stack. This is where the data that is created during the execution of function calls and interrupts are stored.

The size of the stack increases as the number of interruptions or variables increase. A healthy SRAM is something that has a lot of free memory, as shown in Figure 9a. As the stack grows, free memory becomes depleted and problems related to program execution may occur. Optimizing SRAM in an Arduino is subject of future works.

WHAT HAPPENS IF YOU RUN OUT OF MEMORY?

Improperly programmed Arduinos may run out memory during program execution. Figure 9b shows a stack that has grown to take up most of the free space of the SRAM block. When the Arduino runs out of memory (FLASH, SRAM and EEPROM), the following may occur:

  1. For Flash memory or SRAM: these are the most common and difficult to diagnose. The following can occur if SRAM runs out on the Arduino:
    – The program can fail to execute or it can operate unexpectedly;
    – Corruption of the program or variables yielding unpredictable results;
    – When the stack fails, it will cause an immediate crash.
    – If the program size is larger than the memory, the sketch may fail to upload.
  2. EEPROM: Running out of EEPROM memory is a bit difficult since most programs hardly use EEPROM. If this happens, however, the operation of the main program will not be affected.

Source:

76 thoughts on “TYPES OF MEMORY ON THE ARDUINO

erotik

Reply

Very informative article. Really thank you! Much obliged. Cristionna Marty Federica

November 13, 2020 at 9:41 am

erotik

Reply

Only wanna tell that this is very beneficial , Thanks for taking your time to write this. Dorthea Archibald Pestana

November 13, 2020 at 10:41 am

erotik izle

Reply

Excellent pieces. Keep writing such kind of information on your blog. Joli Andris Sansbury

November 14, 2020 at 7:57 am

erotik

Reply

I consider something genuinely special in this site. Norah Baxie Danica

November 14, 2020 at 8:27 am

sikis izle

Reply

This paragraph is truly a pleasant one it assists new net viewers, who are wishing in favor of blogging. Saba Quent Wina

November 14, 2020 at 7:05 pm

sikis izle

Reply

My brother suggested I may like this blog. He was once totally right. Izabel Sherwin Rosemaria

November 14, 2020 at 7:32 pm

erotik izle

Reply

Way cool! Some extremely valid points! I appreciate you penning this article and the rest of the site is very good. Michelle Padget Krein

November 15, 2020 at 2:55 am

erotik izle

Reply

Very good write-up. I definitely appreciate this website. Arleta Dill Bullion

November 15, 2020 at 3:56 am

erotik izle

Reply

My family members every time say that I am killing my time here at web, except I know I am getting knowledge daily by reading such good posts. Elisa Fredrick Hernardo

November 15, 2020 at 5:26 am

erotik izle

Reply

Excellent article! We will be linking to this particularly great article on our website. Keep up the good writing. Vicky Esteban Cacilie

November 15, 2020 at 11:28 am

sikis izle

Reply

Absolutely pent content, Really enjoyed looking through. Gilemette Parry Tacye

November 15, 2020 at 11:29 am

sikis izle

Reply

Hi there, its pleasant article about media print, we all understand media is a impressive source of facts. Barry Jarid Zita

November 15, 2020 at 11:38 am

erotik

Reply

This site truly has all the info I needed about this subject and didn at know who to ask. Tillie Rex Nora

November 15, 2020 at 8:19 pm

erotik

Reply

Way cool! Some extremely valid points! I appreciate you writing this write-up and the rest of the website is also very good. Daphene Dylan Montfort

November 15, 2020 at 8:21 pm

erotik izle

Reply

I really enjoy the article post. Much thanks again. Awesome. Barbee Emanuele Mitinger

November 15, 2020 at 8:39 pm

erotik izle

Reply

Hello, I enjoy reading through your post. I wanted to write a little comment to support you. Sukey Gard Ermina

November 15, 2020 at 8:40 pm

sikis izle

Reply

You are blessed with a solid ability for writing unique content. I am in agreement with your statements. My thanks for publishing this. Georgetta Rick Colville

November 18, 2020 at 12:31 pm

film

Reply

Wow! At last I got a weblog from where I be able to really obtain helpful data regarding my study and knowledge. Astra Forbes Sjoberg

November 18, 2020 at 7:20 pm

erotik

Reply

Wow, great blog article. Really looking forward to read more. Awesome. Carmon Borden Elsie

November 19, 2020 at 12:05 am

film

Reply

Thanks for helping out, superb info. “You must do the things you think you cannot do.” by Eleanor Roosevelt. Kalie Brok Gariepy

November 19, 2020 at 12:12 pm

film

Reply

As soon as I noticed this site I went on reddit to share some of the love with them.

November 20, 2020 at 2:52 pm

film

Reply

This web site definitely has all of the info I needed about this subject and didn at know who to ask. Marinna Herbert Bryan

November 22, 2020 at 12:12 pm

film

Reply

A big thank you for your blog article. Thanks Again. Want more. Drusie Brendin Sandi

November 22, 2020 at 12:39 pm

film

Reply

Thanks for the blog article. Really thank you! Really Cool. Brande Obed Mar

November 22, 2020 at 3:05 pm

film

Reply

Great article! We will be linking to this particularly great content on our website. Keep up the good writing. Kaycee Emmy Jacobsen

November 23, 2020 at 3:59 am

film

Reply

Simply wanna comment that you have a very decent website, I love the design it really stands out. Malissia Eddy Shaughnessy

November 24, 2020 at 5:06 am

film

Reply

This post will help the internet users for building up new webpage or even a blog from start to end. Goldi Cointon Jacqui

November 26, 2020 at 9:38 am

film

Reply

Very interesting read. Thanks. Learned a thing or two or three. Glenn Jamill Leander

November 28, 2020 at 11:50 am

film

Reply

Very good post. Really looking forward to read more. Awesome. Elfie Damiano Niles

November 28, 2020 at 10:44 pm

film

Reply

Wow because this is really good work! Congrats and keep it up. Lisabeth Spencer Obeded

November 30, 2020 at 9:46 am

film

Reply

Great blog thank you! Feel free to check mine out. Atlante Kelley Ragouzis

December 5, 2020 at 11:30 pm

sikis izle

Reply

Awesome Web page, Carry on the fantastic work. Appreciate it. Denny Puff Felise

December 8, 2020 at 12:28 am

erotik izle

Reply

Fine way of explaining, and nice post to obtain information about my presentation topic, which i am going to convey in school. Ofilia Pietrek Jolanta

December 8, 2020 at 11:57 am

porno

Reply

I am actually glad to glance at this weblog posts which includes tons of useful facts, thanks for providing these information. Lurline Regan Ankney

December 8, 2020 at 4:24 pm

erotik film izle

Reply

What a stuff of un-ambiguity and preserveness of precious know-how about unexpected feelings. Tildi Dallas Paryavi

December 8, 2020 at 5:50 pm

erotik

Reply

Enjoying the information on this site, you have done an excellent job on the blogs. Cari Ryan Claudell

December 8, 2020 at 10:47 pm

sikis izle

Reply

Finding the right blog hosting site and layout for your content is the most difficult part. Britteny Clem Fidel

December 9, 2020 at 12:38 am

erotik film izle

Reply

Everything is very open with a really clear description of the issues. It was truly informative. Your website is very useful. Thanks for sharing. Sheeree Jordon Harland

December 9, 2020 at 5:17 am

porno

Reply

Well I truly enjoyed studying it. This article provided by you is very helpful for correct planning. Chelsae Jarad Tavey

December 9, 2020 at 5:31 am

erotik film izle

Reply

Absolutely indited content, regards for selective information. Chlo Benjie Rollo

December 9, 2020 at 9:36 am

porno

Reply

Great article! We are linking to this particularly great content on our website. Keep up the good writing. Robinia Berkley Thurber

December 9, 2020 at 12:37 pm

erotik film izle

Reply

I like this weblog very much, Its a rattling nice office to read and obtain info. Corrine Meier Latoye

December 9, 2020 at 4:02 pm

porno

Reply

Great article! We will be linking to this great content on our site. Ame Emory Catlin

December 9, 2020 at 7:16 pm

sikis izle

Reply

Good thoughts and great article. You are bang on point. I come from the so-called 3rd world country and I can totally relate to what you are saying. Hephzibah Curry Michon

December 9, 2020 at 11:02 pm

türkçe izle

Reply

I consider something really special in this website. Lilllie Ravi Gaye

December 9, 2020 at 11:41 pm

online

Reply

Hey, thanks for the post. Really looking forward to read more. Really Cool. Victoria Harris Frost

January 12, 2021 at 4:52 pm

erotik

Reply

Respect to post author, some wonderful information . Dorrie Colver Lodovico

January 12, 2021 at 9:40 pm

izle

Reply

Hey, I think your site might be having browser compatibility issues. Zarah Vic Bledsoe

January 13, 2021 at 2:51 pm

hd film izle

Reply

There is definately a great deal to know about this issue. I love all of the points you have made. Pammie Inness Teak

January 14, 2021 at 1:28 am

froleprotrem

Reply

There are some attention-grabbing cut-off dates in this article however I don’t know if I see all of them middle to heart. There may be some validity but I’ll take hold opinion until I look into it further. Good article , thanks and we would like more! Added to FeedBurner as well

January 14, 2021 at 5:11 pm

izle

Reply

Asking questions are actually good thing if you are not understanding something totally, but this article provides fastidious understanding even. Almeria Orlando Upton

January 17, 2021 at 7:36 pm

full hd izle

Reply

These are genuinely great ideas in about blogging. You have touched some pleasant points here. Dulsea Rolland Chappell

January 18, 2021 at 5:28 pm

film izle

Reply

I am regular reader, how are you everybody? This article posted at this web page is truly good. Muriel Marshal Kessel

January 19, 2021 at 8:45 am

7. koğuştaki mucize full izle

Reply

This post gives clear idea in support of the new viewers of blogging, that genuinely how to do blogging and site-building. Nelie Mickie Vedette

January 21, 2021 at 1:00 pm

celebrities

Reply

Hi i am kavin, its my first time to commenting anyplace, when i read this paragraph i thought i could also make comment due to this sensible article. Jillane Early Saxena

January 21, 2021 at 1:44 pm

bedava

Reply

Glad to be one of many visitants on this amazing site : D. Britta Berkeley Vergne

January 25, 2021 at 11:41 pm

cheap flights

Reply

whoah this blog is great i like reading your
articles. Keep up the good work! You already know, lots of persons
are hunting around for this information, you could help them
greatly.

January 29, 2021 at 11:48 am

cheap flights

Reply

Hi to every , as I am really eager of reading this website’s post
to be updated daily. It contains fastidious material.

January 30, 2021 at 5:55 am

bollywood

Reply

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?| Brigid Arie Josler

January 30, 2021 at 6:15 am

altyazili

Reply

Wonderful website. Plenty of useful information here. I am sending it to a few buddies ans also sharing in delicious. And certainly, thanks on your effort! Perri Morgen Ty

January 30, 2021 at 9:29 am

720p

Reply

naturally like your web site but you have to take a look at the spelling on quite a few of your posts. Many of them are rife with spelling problems and I find it very bothersome to tell the truth nevertheless I will surely come back again. Feodora Chalmers Rayner

January 30, 2021 at 11:08 am

720p

Reply

I just like thhe valuable information you supply on your articles. Elva Robb Hippel

January 30, 2021 at 4:09 pm

netflix

Reply

I truly appreciate this blog article. Much thanks again. Want more. Clarine Angelico Stclair

January 30, 2021 at 4:45 pm

dublaj

Reply

Your style is so unique compared to other people I have read stuff from. Many thanks for posting when you ave got the opportunity, Guess I all just book mark this blog. Bobbie Kain Lorinda

January 30, 2021 at 8:00 pm

movies

Reply

your writing really helped me I know what steps to take. Lizabeth Adlai Zeeba

January 30, 2021 at 9:11 pm

access

Reply

Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I will be subscribing to your feed and I hope you write again soon! Afton Oswald Tormoria

January 31, 2021 at 12:41 am

watch

Reply

I am regular visitor, how are you everybody? This article posted at this web page is really pleasant. Hetti Dewain Heinrick

January 31, 2021 at 4:16 am

download

Reply

Software as a Website. Yes, definitely takes the cake. Alicia Hollis Nanice Harriot Gawain Dagney

January 31, 2021 at 8:02 am

movies

Reply

Every weekend i used to pay a quick visit this website, as i wish for enjoyment, as this this web site conations truly pleasant funny information too. Colline Prince Goulette

January 31, 2021 at 8:25 am

720p

Reply

This is my first time go to see at here and i am in fact impressed to read everthing at one place. Shaylyn Marcelo Phelips

January 31, 2021 at 9:02 am

watch

Reply

Thanks-a-mundo for the article post. Really looking forward to read more. Really Great. Pamelina Fons Giesecke

January 31, 2021 at 9:05 am

bollywood

Reply

I really like reading a post that will make men and women think. Also, many thanks for permitting me to comment! Ailee Job Stephania

January 31, 2021 at 2:48 pm

haber

Reply

Hey just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Chrome. Shelli Luis Ditzel Nicol Culver Monto

February 2, 2021 at 5:22 am

0mniartist

Reply

Hello! This is kind of off topic but I need
some guidance from an established blog. Is it very hard to set up
your own blog? I’m not very techincal but I can figure things out pretty
fast. I’m thinking about setting up my own but I’m not sure
where to begin. Do you have any points or suggestions?

Cheers asmr 0mniartist

April 9, 2021 at 1:07 am

0mniartist

Reply

Hi it’s me, I am also visiting this web page regularly,
this website is in fact pleasant and the visitors are genuinely sharing pleasant thoughts.
0mniartist asmr

April 9, 2021 at 9:00 am

0mniartist

Reply

Hey there I am so delighted I found your site, I really found you by accident, while I was searching on Askjeeve for something else, Regardless I am here now and would just like to say cheers for a fantastic post and a all round enjoyable blog (I also love the theme/design), I don’t have time to go
through it all at the moment but I have saved it and also added your
RSS feeds, so when I have time I will be back to read much more,
Please do keep up the great job. 0mniartist asmr

April 9, 2021 at 5:29 pm

Leave A Comment

Your email address will not be published. Required fields are marked *