8 types of memory every embedded engineer should know about!

As I began my journey as an embedded engineer, I started coming across several types of memories. As my journey continued I learned about each of them and this post explains the 8 essential ones that every embedded engineer should know about.

The 8 essential memories can be divided into 2 categories namely primary and secondary memory as shown in the picture.

Memory types
Memory types

Thus they include the following

  1. SRAM
  2. DRAM
  3. Masked ROM
  4. PROM
  5. EPROM 
  6. EEPROM
  7. flash memory and 
  8. NVRAM

You can look at this article to learn more about primary and secondary memories. 

Let’s take a look at each one and try to understand their basics.

Primary vs secondary memory

Memory can be broadly classified into 2 types namely

  • Primary memory &
  • Secondary memory.

The real difference between primary and secondary memories is the speed/volatility tradeoffs.

Primary memory

Primary memory is very fast, but it cannot hold data without power. Once you plug out the power the memory contents are erased. The popular name for Primary memory is, yes you guessed it correct, RAM (stands for Random Access Memory).

Secondary Memory

Secondary memory does not care if the power is present or not, it can happily hold its contents. But compared to Primary memory, they are relatively slow. Popular implementations include the Hard disks, SSDs, USB Flash drives, and SD cards.

Primary memory types

In this section let’s take a brief look at the 2 most important types of primary memory/RAM used in embedded systems namely SRAM and DRAM. They are both volatile memories used as primary storage on embedded systems. But each has its place in microcontroller design. The main difference between them comes from their speed/cost tradeoffs.

1. Static Random Access Memory (SRAM)

This is the faster of the 2, approximately 4 times faster than the DRAM. Since it needs more transistors per bit of data, it is also more expensive compared to DRAMs.  

2. Dynamic Random Access Memory (DRAM)

The reason behind its name comes from the fact that the data stored in this RAM needs to be refreshed every few milliseconds or else it will end up being erased. Yes even if the power is being applied continuously the data still needs to be refreshed. This action is taken care of by a special device named DRAM controllers. 

The reason behind this dynamic behavior is because of the capacitor present in its design. 

Earlier the SRAM was called just RAMs but later after the introduction of DRAMs, the term “static” got introduced into its name in order to differentiate it from the DRAM technology!

Let’s have a look at the key differences between the 2 types of RAM.

Difference between SRAM and DRAM

Let’s see the pros and cons of each type, their key differences, and their appropriate application areas.

 SRAMDRAM
Construction PrincipleIt uses a cross-coupled flip flop configuration of transistorsIt uses a capacitor transistor circuit to hold data
CostRelatively more expensive, it needs more transistors per bit of data it can storeRelatively less expensive, as fewer transistors per bit of storage are needed
Speed4X more than DRAM4X less speed
VolatilityAs long as power is ON, it can store data since it uses no capacitorsData needs to be continuously refreshed (usually in the order of 4 times a second) since the capacitors leak power.
Power consumptionLessMore
Addition components neededNoneDRAM controllers are needed to make it work like an SRAM. This controller offloads the data refreshing duties of a microprocessor and hence a DRAM coupled with a DRAM controller behaves more like an SRAM from the processor’s perspective.
Application areasApplications/scenarios that need very fast memoryBudget applications that do not need the speed of SRAMs

Embedded microcontrollers these days usually have a mix of both SRAMs and DRAMs. SRAMs are usually a small percentage of the total RAM (less than 10%), and it’s the first primary storage that the processor sees. Once the SRAM is full, the DRAM comes into the picture to store data. If the hardware designer needs they can always more SRAM to their design to get more speed. 

These are the major differences between SRAM and DRAM. I hope the next time you read a data sheet for a microcontroller you will know exactly what they mean by SRAM and DRAM!

Secondary Memory types

In this section, let’s take a look at the 6 types of secondary storage used in embedded systems and appropriate places to use them in.

3. Masked ROM

The main characteristic of this device is the fact that the data is written onto the device as it gets manufactured and it is impossible to change them. This is done by designing the chip in such a manner so that it already contains the necessary data. 

Function and Application areas

They usually serve the function of storing the bootloaders in microcontrollers and to store microcode on microprocessors. This type of storage is generally used in mass-produced, long term devices where each penny counts. The IC area per bit for masked ROMs is generally lower compared to other types and hence they are favored by manufacturers.  Also since the area occupied is smaller, the overall device/chip’s size is also reduced. Examples include the processors and microcontrollers that we use in our projects which are usually produced in huge numbers and they are produced usually decades

4. PROM

PROM stands for Programmable Read-Only Memory. These are programmable chips, the main characteristic being it can only be programmed one time. That is it cannot be erased or reprogrammed. They are also known as One Time Programmable devices or OTPs for short. 

Function and Application areas

They are used to store the firmware and constants in the source code. These are used on devices that are still mass-produced but have a relatively shorter life as compared to the devices that use Masked ROMs. The shorter lifetime is generally due to the fact that the technology for this device is rapidly developing and they will be replaced by newer models on a yearly basis and hence not a good idea to actually design custom ROMs as the cost/benefit trade-off doesn’t work in the manufacturer’s favor. home appliances like TV, washing machine and microwave ovens. 

5. EPROM

EPROM stands for Erasable Programmable Read-Only Memory. These chips usually have a small glass window on top and if you expose them to direct sunlight that will erase the chip’s data. They can then be programmed again with fresh data.

Function and Application areas

Similar to PROM they are also used to store firmware and constants in the source code. But this kind of chip is usually used in the development phase of the software as erasing and reprogramming the chips is a vital part of the development cycle. Once the development is complete, the hardware designers usually change this chip to a PROM and hence the application areas and examples of PROMs apply also to the EPROMs

6. EEPROM

EEPROM stands for Electrically Erasable Programmable Read-Only Memory. These chips can be erased and reprogrammed using electricity as opposed to exposing them to UV rays as EPROMs.

Functions and application areas

They can be used for 3 different functionalities

  1. Storing firmware during the development phase of the product
  2. Storing runtime constants after production.
  3. Storing updatable firmware after production.

Masked ROMs, PROMs, and EPROMs are true ROMs as they can only be read but EEPROMs are considered a hybrid between read-only and read-write memory as individual bits can be reprogrammed by the microcontroller and yet the data is non-volatile, unlike RAMs. (This article explains this idea in more detail) This quality is particularly useful in situations where even after the product reaches the customer’s hand, the manufacturer may need to update the firmware and hence is a desirable quality.

7. Flash memory

This memory is the most popular one that you might come across on a day to day basis as an embedded developer. It has all the qualities of EEPROMs except one. EEPROMs are reprogrammable one bit at a time, while flash storage is a reprogrammable one block at a time. The block size (X number of bytes) usually can be found on the given chip’s specifications. 

Functions and application areas

The main advantage of flash memory is that it is cost-effective (per byte) compared to EEPROMs and hence are used for storing large files. Usually, microcontrollers, these days use them for storing firmware of large sizes and other constant data and large lookup tables as needed by the application.

8. NVRAM or Non Volatile Random Access Memory

This is a special type of RAM that can store data permanently. It’s basically an SRAM with a power supply (usually a coin cell like CR2302). This type of storage on the PC world has a special name called “RAM disks”. Imagine the speed of a RAM and non-volatility of data like ROM combined together, that is exactly what this type of storage aims at accomplishing! The downside is that SRAM per byte is very expensive compared to any of the types mentioned above and hence not very cost-effective. 

Functions and application areas

This type of RAM is usually used in applications where startup time is extremely important, and we cannot afford to lose even microseconds of time trying to load a program from slower storages like flash or EEPROM. They are usually accompanied by a backup memory (that stores the original code and compile-time data) of one of the types about so that when the time comes to replace the battery, all the runtime data can be backed up to another(slower) non volatile memory (like EEPROM or flash memory) and once the battery is replaced, it can load the code and data from this memory and start working again from where it left off. Examples include anything that can be done using EEPROMs and flash memories. 

These are the basics of the 8 essential types of memory used in Embedded Systems.

Hope this post was helpful! 

You can email us or contact us through this link if you have any questions or suggestions.

If you liked the post, feel free to share this post with your friends and colleagues! 

Relevant Articles

Computer Memory Explained Through Analogies and Illustrations
Microcontroller Timers, Their Types and Applications
9 Essential Microcontroller Peripherals Explained
200 Embedded and IoT Software Engineering Interview Questions – Part 1

EI

We’re passionate about inventing embedded devices and we hope you are too! This blog deals with a wide variety of topics from C programming to IOT to networking certifications and more. Hope you enjoy your time spent here and hope you get some value out of our blog!

You may also like...