Memory Options for Embedded Systems: How to Select the Right Memory Configuration

Choosing memory for an embedded system is one of the most important decisions you'll make. I have years of experience with embedded memory and have gathered details, along with expert tips on choosing the right option for your system.

In this article:

What is embedded memory?

Embedded memory is the memory that an embedded device's processor uses to help it perform its functions and enable the device to work. Memory might be stored on the system-on-a-chip for the embedded device, or it might be separate.

Volatile vs. non-volatile memory

Volatile memory can hold its stored information only as long as it maintains its power supply. Non-volatile memory keeps the stored information even when the power is off.

When power is off, volatile memory loses its data. Random access memory (RAM) is a type of volatile memory.

Engineers use non-volatile memory in embedded systems to store code and other data that the device always needs, including after the system restarts. For example, non-volatile memory often holds configuration settings for the system.

Primary vs. secondary memory in computers

Primary memory is the main internal memory of a computer system. The system's central processing unit (CPU) directly accesses the primary memory. Secondary memory often is in an external storage device. The CPU does not directly access secondary memory.

The CPU can access primary memory quickly, but primary memory is generally volatile memory. That means the device loses that data when it loses power. Secondary memory is non-volatile, which means it retains its data even after it loses power. Compared to primary memory, secondary memory is relatively slow. (Read our guide to learn more about how to choose the best CPU for your embedded system.)

Many embedded systems and microcontroller units that engineers use in embedded systems today have all of their memory directly addressable by the main processor.

Primary memory in embedded systems

The primary memory in embedded systems is generally a type of RAM. The most common types of RAM are dynamic random access memory (DRAM) and static random access memory (SRAM).

Differences between SRAM and DRAM

Both SRAM and DRAM are volatile memory. But there are key differences between the two – especially in their speed and cost.

  • SRAM: SRAM provides extremely fast access times to the processor, about four times faster than DRAM. The memory also retains its data as long as it has electrical power. It uses less power but is more expensive than DRAM. In general, engineers use SRAM in devices where access speed is crucial. SRAM is often embedded on an system on a chip or microcontroller chip.
  • DRAM: DRAM is slower than SRAM and less expensive. It retains data for a short time—generally from a few milliseconds to a few seconds — even when it has constant power. Engineers make DRAM work more like SRAM by using a DRAM controller. The DRAM controller continually refreshes the data stored in DRAM, so the data is not lost. The lower cost of DRAM compared to SRAM means engineers use more DRAM when their device needs large amounts of memory.
  • SDRAM: Synchronous Dynamic Random Access Memory, or SDRAM, is the most commonly used type of DRAM. It is DRAM that synchronizes with the microprocessor clock before it responds. This generally means the processor can perform more instructions in a set period of time.

SRAM vs. DRAM in embedded systems


Many embedded systems use both types of RAM. They may often use a small block of more expensive but faster SRAM along critical paths and a larger block of DRAM for other functions. Many systems will have less than 10% of their total RAM as SRAM.

Memory for embedded systems: SRAM vs. DRAM

 

Memory for embedded systems SRAM vs. DRAM

Download SRAM vs. DRAM comparison chart

What is the role of RAM and ROM in an embedded system?

Engineers use RAM in embedded systems to run programs and for data storage. Engineers use read-only memory, or ROM, to store persistent data.

Types of memory in embedded systems

Types of memory in embedded systems generally fall into two categories: volatile vs. non-volatile. Within those categories are various types of RAM and ROM memories. Here are details on various types of memory within those categories.

RAM
Here are the types of RAM that an embedded system can use:

  • SRAM: The fastest volatile memory, SRAM, is fast enough to operate close to the processor speed. It also requires less power than DRAM, but it is also more expensive. Engineers use it in more limited ways in embedded systems.

    Timo Aarnipuro, Senior Software Engineer for Qt, points out that many SoCs and MCUs have a small amount of internal RAM on the chip. "This is usually a combination of SRAM and CPU cache on SoCs. Some chip families have a selection of variants with different on-chip memory configurations. This allows some flexibility on selecting the variant that has the most suitable amount of fast memory."
  • DRAM: This memory stores the information on capacitors and transistors. The setup inherently leaks info, though the device loses all data unless it is continuously refreshed. DRAM is slower than SRAM but also costs much less.
  • SDRAM: This type of DRAM is synchronous with the embedded system's bus. SDRAM uses much less space on the chip than SRAM. But it uses more power, in part because it must continually refresh.

    "This refresh also introduces delays, albeit very short ones, during normal operation and even when the system is asleep," says Dan Day, an Electrical and Embedded Systems Design Engineer for SGW Designworks, an Idaho-based product design company.

ROM
These are types of non-volatile memory that embedded systems can use:

  • Masked ROM: With this memory, the manufacturers write data onto the memory chip, which is then impossible to change. Masked ROM is extremely low cost. Companies often use masked ROM in mass-produced devices that last for years.

    The disadvantage of masked ROM is that no one can change the data on the chip.
  • Programmable Read-Only Memory (PROM): These are programmable chips that you purchase unprogrammed and program only one time. Companies use them to store firmware and constants in source code.

    “They can be used for storing serial numbers, radio configurations or some other data that is not supposed to be changed by the user," Aarnipuro shares.

    Day says PROM is becoming obsolete, in part, because it requires high voltages to program and operate. Day adds, "Most PROMs require the device manufacturer to perform the one-time programming and (that) can be a logistical headache.” This can be especially true for companies that buy and use the memory in their products.

Other memory options with features of both volatile and non-volatile

Some non-volatile memories have some key features of volatile memories. You can program and reprogram them, but they can also save their contents without electrical power.

  • Electrically Erasable Programmable Read-Only Memory (EEPROM): You can erase these chips and reprogram them through an electrical operation.

    Engineers often use EEPROM in a product’s firmware or for storing firmware as they develop a product. It can be useful for products that may need to update their firmware even after a customer purchases it.

    "This is still used widely," states Qt's Aarnipuro. “EEPROM has a limited number of write-erase cycles—usually something like 10,000."

  • Flash: Developers use flash memory in embedded systems more often than any other non-volatile or hybrid memory. The memory is fast for a device to read and low-cost. Devices use it for storing large files.

    Like EEPROM, it is also electrically reprogrammable. But you erase and reprogram flash memory one sector at a time, compared to byte-by-byte in EEPROM.

    Some System on a Chips (SoCs) have flash memories built into them. For external storage, there are two main kinds of flash memory:
  • NAND flash: Engineers most commonly use this flash memory. It is small and often used in USB flash drives and solid-state disks (SSDs).
  • NOR flash: Faster than NAND, NOR flash is more expensive and doesn't last as long as NAND. Engineers often use NOR flash for Execute-In-Place (XIP) code.
  • NVRAM, or non-volatile random access memory: This type of RAM doesn't lose data when power is lost but can store it permanently. It is expensive but fast. Engineers use this when startup time is crucial. 
  • Ferroelectric Random Access Memory (FRAM): Another type of RAM that doesn't lose data when power is off, it is faster and offers many more write cycles and uses less power. Engineers sometimes use it instead of EEPROM or flash memory. 
  • Phase Change Memory (PCM): Sometimes called PCRAM, this memory is non-volatile and retains data when power is off. Engineers sometimes use it instead of flash memory. It has faster write cycles and uses less power.

    “PCM is a new technology that has very fast read/write performance approaching that of SDRAM," says Day from SGW Designworks. "And data is non-volatile for decades, if not longer."

Other types of external memory

Engineers may also use these external memory options in an embedded system:

  • SSD: Manufacturers often use these in embedded systems. Engineers build the device using flash memory.
  • Secure Digital Card (SD Card): Non-volatile memory that portable devices commonly use. 

Embedded memory hierarchy

Embedded Memory Hierarchy

 

How to pick the right embedded memory configuration for your project

You'll want to consider price, latency, capacity, and other factors in selecting the right memory or combination of memory for your embedded system. Here are some top factors to consider:

  • Speed: Some embedded systems and devices must start-up fast or have other functions that must execute quickly. Be sure the memory you choose for those operations is appropriately fast. Different types of memory have different capacities for speed. SRAM, for example, is much faster than DRAM.
  • Data storage size: Embedded systems often have limited capacity for storing data. Various memory options offer different ways of storing, maintaining, and accessing data. Some also offer ways to provide extra memory with external devices.
  • Latency: The memory or combination of memory you choose will affect your embedded system.
  • Power consumption: Power is often limited in embedded systems and devices. You'll want to choose options that allow the device to perform well while still using limited power.

    "One of the biggest factors that gets the least attention is power delivery and power management," Day adds. "Clean, regulated power delivery is key. And so is the power management approach to your system architecture."
  • Cost: The cost of different types of memory can vary widely. In general, SRAM memory is much more expensive than DRAM. Embedded systems manufacturers must choose memory combinations that allow them to use more expensive memory only where necessary for the system to work as well as possible.
  • Ease of development and debugging: Qt's Aarnipuro points out that you should think about development and debugging of your embedded system when you choose memory. He says that flash memory that is slow to write can lead to extra costs and difficulty in running tests. Not having enough non-volatile memory can make it difficult to debug issues that lead to reboots. “That's because data before reboot is lost from normal DRAM memory," Aarnipuro explains.

    "Ease of development and debugging should be taken into account when it is important to get the product to market in time. This is usually forgotten or disregarded, which is kind of sad for the developers that are working on the product," he adds.

  • Graphical User Interface (GUI) requirements in an embedded device: Many embedded devices have screens or displays users need to see. Screen resolution becomes important and factors into "how much data you need to fetch from the memory," Aarnipuro says. (Read our guide to learn more about how to pick the right display for your embedded device.)
  • Security: “Memory options can pose various levels of security risk to your entire embedded system,” says Rob Wood, Vice President for Hardware and Embedded Security Services at security consultancy NCC Group. The memory devices have computing elements that can have security vulnerabilities.

    "Probe your memory vendors," Wood recommends. "You want them to have a good story about how they avoid vulnerabilities in this vital firmware deep in your system. They need to have a coherent plan to maintain this firmware with ongoing security patches throughout the lifetime of your product."

Choosing memory: A vital decision in embedded systems

The memory and combination of memory you choose for your embedded system will be one of the most important decisions you make for the system. Memory will likely be the second most expensive component after the CPU. You'll want to do extensive testing to understand the types of memory your embedded system will need to operate at its best. It helps to have a design and software development process in place when making these decisions.

Qt can help with memory decisions and everything else to build an embedded system

Choosing the right memory for your embedded system is only one of many decisions you'll make. Qt and its tools can help you as you're making important decisions for your system. Newer software frameworks tend to have better memory consumption than older ones, which is why it’s also a good idea to assess the framework you use and how it’s being developed. Download our Embedded Product Planning and Requirements Guide to help you understand how to approach building an embedded device.

Embedded memory FAQs

Below we cover a few of the most frequently asked questions when it comes to picking memory for an embedded system. 

What is a memory map, and why is it important in embedded systems?

A memory map is a virtual database that details how memory is structured in an embedded system. The memory map tells an embedded device's operating system how much memory is available and how to access needed memory from the proper places. Read our guide to learn how to choose the best operating system for your embedded device.

What is embedded flash memory?

Embedded flash memory is flash memory technology that many portable consumer electronics and other devices use for memory. Manufacturers sometimes install non-removable flash memory within a device. You can also use removable memory cards to add more flash memory.

Flash memory is the least expensive non-volatile memory and very common. Manufacturers of mobile consumer devices use it extensively. Many industries also use it for embedded systems and devices.

What is embedded SRAM?

Embedded SRAM is the static random access memory (SRAM) that an embedded system uses for its memory needs. SRAM is among the fastest memory available but is also expensive. Embedded engineers use it for critical functions that need fast and reliable memory.

Which memories are fastest in embedded systems?

SRAM is probably the fastest memory in embedded systems, but it is also expensive. SRAM is a volatile memory. Among non-volatile memories, NVRAM and PCM are also relatively fast. 

 


 

embedded_guide (1)

The Embedded Product Planning and Requirements Guide

In this guide for IoT and embedded product planning, we examine the most important criteria to consider at the outset, compare a list of the most used technologies, and rate them in easy-to-compare categories.

Download

 


Blog Topics:

Comments