0% found this document useful (0 votes)
40 views

Types of Memory in Embedded Systems

Uploaded by

e218221001003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Types of Memory in Embedded Systems

Uploaded by

e218221001003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Types of Memory in Embedded

Systems
A Comprehensive Overview

Fahmi FERJANI
R&D Mechatronics Engineer
Introduction:

In the realm of modern computer systems, a plethora of memory devices exists. As an


embedded software engineer, it's essential to discern the disparities between these devices and
grasp their effective utilization. It's noteworthy that the evolution of these devices spans
several decades, each rooted in distinct hardware architectures. The nomenclature of these
memory types often reflects their historical development, adding complexity rather than
clarity.
Upon embarking on my journey in Computer Science and embedded systems, one aspect that
continually fascinated me was the intricate workings of computer memory and its data storage
mechanisms. With each step in my career, I encountered a myriad of memory variations,
prompting numerous questions:
- How does computer memory function?
- What accounts for the proliferation of memory types?
- Could a singular memory device suffice for all computing needs?
- Given that ROM is purportedly read-only, how do we write data to hard disks, USB flash
drives, and SSDs?
- If I can swiftly access files from my SSD, why isn't it considered Random Access?
As my understanding of memory deepened, the scattered fragments in my mind began to
coalesce, gradually revealing a more comprehensive picture. This doc endeavors to address
these inquiries, employing straightforward analogies and explanations to elucidate the
working principles, classification, and practical applications of diverse memory types, tailored
for readers at a beginner level.
Before delving into the specifics of various memory types, it's imperative to gain insights into
the fundamental workings of memory.

I- Working principle:
Working Principle: How does computer memory function? Computers store our data in the
form of bits, each capable of holding either a Zero or One. This storage is accomplished
through microscopic switches known as transistors, akin to the switches we employ daily to
control lights. By organizing millions of these switches together, computers retain valuable
information.

Array of Switches:
Consider the representation of characters, such as 'a' in ASCII format, where the decimal 97
translates to binary as "01100001". Various combinations of zeros and ones, facilitated by
eight switches, can encode different characters. With 256 possible combinations, ranging
from all zeros to all ones, a single character requires 8 switches to store its memory. For
instance, to store the letter "a," the computer activates the 2nd, 3rd, and 8th switches while
deactivating the rest. Computers possess the capability to discern the state of each switch,
allowing them to read the stored data. This elucidates the fundamental workings of computer
memory.
Figure 1: Millions of such switches are used together to store useful information.

Memory Addressing:
What are memory addresses? Computer memory is implemented as a list of bytes, each
with a unique address like in the picture above. A good analogy is a set of shelves, each with
a unique name/number. And each shelf is big enough to store ‘X’ number of books.

232 = 4,294,967,296 bytes or 4GB of RAM. That’s the reason most computers these days use
64bit addressing to improve its RAM handling capabilities since

264 = 18,446,744,073,709,551,616 or 18,446,744,073GB of RAM, which is considered more


than enough addressing capability for the coming decades

Figure 2: A 32bit operating system uses 32bit addresses and thus can address 232 bytes.

II- Classification of memory:


A plethora of memory devices are accessible for integration into contemporary computer
systems. For embedded software engineers, comprehending the distinctions among these
devices and their optimal utilization is paramount. In our discourse, we will adopt a software
developer's viewpoint to explore these memory options.
Computer or embedded system memory typically falls into two categories: internal and
external memory, as illustrated in Figure 3 below.

Internal memory, also called "main or primary memory" refers to memory that stores small
amounts of data that can be accessed quickly while the computer is running.
External memory, also called "secondary memory" refers to a storage device that can retain
or store data persistently. They could be embedded or removable storage devices. Examples
include hard disk or solid state drives, USB flash drives, and compact discs.

Figure 3: Memory classification


Keep in mind that the development of these devices took several decades and that their underlying
hardware differs significantly. The names of the memory types frequently reflect the historical nature
of the development process and are often more confusing than insightful. Figure 4 classifies the
internal memory devices we'll discuss as RAM, ROM, or a hybrid of the two.

Figure 4: Common internal memory types in embedded systems

1- Types of RAM
The RAM family includes two important memory devices: static RAM (SRAM) and dynamic
RAM (DRAM). The primary difference between them is the lifetime of the data they store.
SRAM retains its contents as long as electrical power is applied to the chip. If the power is
turned off or lost temporarily, its contents will be lost forever. DRAM, on the other hand, has
an extremely short data lifetime-typically about four milliseconds. This is true even when
power is applied constantly.

In short, SRAM has all the properties of the memory you think of when you hear the word
RAM. Compared to that, DRAM seems kind of useless. By itself, it is. However, a simple
piece of hardware called a DRAM controller can be used to make DRAM behave more like
SRAM. The job of the DRAM controller is to periodically refresh the data stored in the
DRAM. By refreshing the data before it expires, the contents of memory can be kept alive for
as long as they are needed. So DRAM is as useful as SRAM after all.

When deciding which type of RAM to use, a system designer must consider access time and
cost. SRAM devices offer extremely fast access times (approximately four times faster than
DRAM) but are much more expensive to produce. Generally, SRAM is used only where
access speed is extremely important. A lower cost-per-byte makes DRAM attractive
whenever large amounts of RAM are required. Many embedded systems include both types: a
small block of SRAM (a few kilobytes) along a critical data path and a much larger block of
DRAM (perhaps even Megabytes) for everything else.

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.

2- Types of ROM:
Memories in the ROM family are distinguished by the methods used to write new data to
them (usually called programming), and the number of times they can be rewritten. This
classification reflects the evolution of ROM devices from hardwired to programmable to
erasable-and-programmable. A common feature of all these devices is their ability to retain
data and programs forever, even during a power failure.
The very first ROMs were hardwired devices that contained a preprogrammed set of data or
instructions. The contents of the ROM had to be specified before chip production, so the
actual data could be used to arrange the transistors inside the chip. Hardwired memories are
still used, though they are now called "masked ROMs" to distinguish them from other types
of ROM. The primary advantage of a masked ROM is its low production cost. Unfortunately,
the cost is low only when large quantities of the same ROM are required.
One step up from the masked ROM is the PROM (programmable ROM), which is purchased
in an unprogrammed state. If you were to look at the contents of an unprogrammed PROM,
you would see that the data is made up entirely of 1's. The process of writing your data to the
PROM involves a special piece of equipment called a device programmer. The device
programmer writes data to the device one word at a time by applying an electrical charge to
the input pins of the chip. Once a PROM has been programmed in this way, its contents can
never be changed. If the code or data stored in the PROM must be changed, the current device
must be discarded. As a result, PROMs are also known as one-time programmable (OTP)
devices.
An EPROM (erasable-and-programmable ROM) is programmed in exactly the same manner
as a PROM. However, EPROMs can be erased and reprogrammed repeatedly. To erase an
EPROM, you simply expose the device to a strong source of ultraviolet light. (A window in
the top of the device allows the light to reach the silicon.) By doing this, you essentially reset
the entire chip to its initial--unprogrammed--state. Though more expensive than PROMs, their
ability to be reprogrammed makes EPROMs an essential part of the software development
and testing process.
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.

• EPROM (erasable programmable read-only memory) is memory that does not lose its
data when the power supply is cut off. The data can be erased and the chip reprogrammed by
shining an intense ultraviolet (UV) light through a window designed into the memory chip.
This process is known as burning and requires a specific device called a PROM programmer,
which is plugged in to an EPROM burner.A programmed EPROM can retain its data for 10 to
20 years. Some EPROMs can retain data for even longer. The data is retained even when
power is cut off and can be retrieved after the power is turned back on, making it a type of
non-volatile memory.

3- Hybrids :
As memory technology has matured in recent years, the line between RAM and ROM has
blurred. Now, several types of memory combine features of both. These devices do not belong
to either group and can be collectively referred to as hybrid memory devices. Hybrid
memories can be read and written as desired, like RAM, but maintain their contents without
electrical power, just like ROM. Two of the hybrid devices, EEPROM and flash, are
descendants of ROM devices. These are typically used to store code. The third hybrid,
NVRAM, is a modified version of SRAM. NVRAM usually holds persistent data. EEPROMs
are electrically-erasable-and-programmable. Internally, they are similar to EPROMs, but the
erase operation is accomplished electrically, rather than by exposure to ultraviolet light. Any
byte within an EEPROM may be erased and rewritten. Once written, the new data will remain
in the device forever--or at least until it is electrically erased. The primary tradeoff for this
improved functionality is higher cost, though write cycles are also significantly longer than
writes to a RAM. So you wouldn't want to use an EEPROM for your main system memory.

Flash memory combines the best features of the memory devices described thus far. Flash
memory devices are high density, low cost, nonvolatile, fast (to read, but not to write), and
electrically reprogrammable. These advantages are overwhelming and, as a direct result, the
use of flash memory has increased dramatically in embedded systems. From a software
viewpoint, flash and EEPROM technologies are very similar. The major difference is that
flash devices can only be erased one sector at a time, not byte-by-byte. Typical sector sizes
are in the range 256 bytes to 16KB. Despite this disadvantage, flash is much more popular
than EEPROM and is rapidly displacing many of the ROM devices as well.

The third member of the hybrid memory class is NVRAM (non-volatile RAM). Nonvolatility
is also a characteristic of the ROM and hybrid memories discussed previously. However, an
NVRAM is physically very different from those devices. An NVRAM is usually just an
SRAM with a battery backup. When the power is turned on, the NVRAM operates just like
any other SRAM. When the power is turned off, the NVRAM draws just enough power from
the battery to retain its data. NVRAM is fairly common in embedded systems. However, it is
expensive--even more expensive than SRAM, because of the battery--so its applications are
typically limited to the storage of a few hundred bytes of system-critical information that can't
be stored in any better way.

 NVRAM:
Is a type of computer memory that retains its stored information even when the power is
turned off. Unlike traditional random-access memory (RAM) which is volatile and loses data
when power is cut, NVRAM retains its contents. This makes it useful for storing critical
system data that needs to persist across power cycles.
NVRAM is distinct from other types of memory like read-only memory (ROM) and random-
access memory (RAM). NVRAM combines the benefits of both by being non-volatile and
allowing data to be modified. ROM is non-volatile but its content is fixed during and cannot
be modified. RAM is volatile and loses its data when the power is turned off.
One of the main advantages of NVRAM is its ability to retain data even when the power is
turned off. This makes it ideal for storing critical system information such as (basic
input/output system) BIOS settings, boot configurations, and firmware updates. NVRAM also
has fast read and write speeds, making it suitable for use in high-performance computing
systems. Also, NVRAM has a high endurance, meaning it can withstand many read and write
cycles without degrading.
 Flash:
Flash memory is a storage technology that uses a floating gate cell design to remember its
state before being switched off, thereby retaining data regardless of active/inactive power
supply, making it a durable form of read, write, and erase memory.

Flash memory is a type of nonvolatile memory chip utilized for storing and transmitting data
between digital devices and personal computers. It can be electrically reprogrammed and
erased, making it highly versatile. Commonly found in USB thumb drives, MP3 players,
cameras, and solid-state drives, flash technology has become more affordable and resilient in
recent years, leading to its widespread adoption in enterprise IT.

Various forms of flash memory commonly encountered in computers include:

1. Multi-media card (MMC): MMC is a standard format for flash-based memory cards used in
cell phones, cameras, media players, and personal computers for storing digital content such
as text, images, audio, or video.

2. Solid-state drive (SSD): SSDs, employing flash memory, are utilized in computers and
gaming consoles due to their speed and reliability, gradually replacing traditional hard disc
drives (HDDs).

3. BIOS chip: Found on a computer's motherboard, the BIOS chip stores instructions for basic
operations like booting and keyboard control. Modern BIOS chips utilize flash technology
instead of read-only memory (ROM).

4. USB flash drive: This portable data storage device incorporates flash memory and a USB
interface, enabling users to store and transfer digital data between computers, phones, and
cameras.In flash memory, data is stored in memory cells containing floating-gate transistors
that can capture electrons for a certain period. These cells can perform reading, writing, and
erasing operations based on the application of voltage. A charged floating gate represents a
logical 0, while a discharged state indicates a logical 1.Modern storage systems organize
memory cells into pages, allowing for simultaneous retrieval of large amounts of data. NAND
flash, the most common form of flash memory, consists of blocks comprising 32 or 64
pages.In NAND flash, electrons are moved within an oxide medium into a silicone gate, with
the gates retaining electrons interpreted by the computer as 1s and 0s. The chip links
numerous transistors and employs a logic controller to coordinate their operations.

 EEPROM:

EEPROM, or Electrically Erasable Programmable Read-Only Memory, is a type of non-


volatile memory capable of being erased and programmed electrically. It shares similarities
with EPROM (Erasable Programmable Read-Only Memory) but offers the advantage of byte-
by-byte erasure and reprogramming, granting finer control over memory content.

Advantages and disadvantages: EEPROM offers enhanced functionality over EPROM,


allowing for electric erasure and precise byte-level reprogramming. However, this added
functionality comes at a higher cost and longer write cycles compared to RAM (Random
Access Memory), which may limit its suitability for main system memory applications.
III- Comparison :
This table summarizes the features of each type of memory discussed here, but keep in mind
that different memory types serve different purposes. Each memory type has its strengths and
weaknesses. Side-by-side comparisons are not always effective.

Erase Max Erase


Type Volatile? Writeable? Cost (per Byte) Speed
Size Cycles
SRAM Yes Yes Byte Unlimited Expensive Fast
DRAM Yes Yes Byte Unlimited Moderate Moderate
Masked
No No n/a n/a Inexpensive Fast
ROM
Once, with a
PROM No device n/a n/a Moderate Fast
programmer
Limited
Yes, with a device Entire
EPROM No (consult Moderate Fast
programmer Chip
datasheet)
Limited
Fast to read, slow
EEPROM No Yes Byte (consult Expensive
to erase/write
datasheet)

Limited
Fast to read, slow
Flash No Yes Sector (consult Moderate
to erase/write
datasheet)
Expensive
NVRAM No Yes Byte Unlimited (SRAM + Fast
battery)
The table provides a comparative overview of various types of memory, highlighting their
volatile nature, writeability, erase size, maximum erase cycles, cost per byte, and speed. It's
important to note that different memory types serve distinct purposes, with each having its
own set of strengths and weaknesses. While side-by-side comparisons are informative, they
may not always capture the nuanced differences between memory types.

 SRAM: Volatile and writable at the byte level, SRAM offers unlimited erase cycles but
comes at a high cost per byte. It boasts fast read and write speeds.
 DRAM: Like SRAM, DRAM is volatile and writable at the byte level, with unlimited
erase cycles. However, it is more moderately priced per byte and offers moderate speed.
 Masked ROM: Non-volatile and not writable, masked ROMs are inexpensive and provide
fast access.
 PROM: Non-volatile but writable only once with a device programmer, PROMs offer
moderate pricing and fast access.
 EPROM: Non-volatile and writable at the entire chip level, EPROMs come with limited
erase cycles and moderate pricing, offering fast access.
 EEPROM: Non-volatile and writable at the byte level, EEPROMs have limited erase
cycles, are relatively expensive, and offer fast read but slow erase and write speeds.
 Flash: Non-volatile and writable at the sector level, flash memory comes with limited
erase cycles and moderate pricing. It offers fast read but slow erase and write speeds.
 NVRAM: Non-volatile and writable at the byte level, NVRAM combines the features of
SRAM with a battery for data retention. It is relatively expensive but offers fast access.

You might also like