Any element that can retain a state with time is called memory. Memory is the most important part of a processing system considering the fact that both the instructions to be executed as well as the data being manipulated are stored in memory. In the fourth post of the series on embedded system design, we will discuss about the memory types and their applications.

Memory Usage

As mentioned earlier, memories are used to store primarily two kinds of information – Program and data.

Program information are the instructions i.e. opcodes that are to be executed by the processor. Generally they are stored in a non-volatile memory that is mapped directly to the address space of the processor. Or they might be stored in external memories (say as files in a partition) and loaded on to a volatile memory just prior to execution of the program.

Data memory can be used to store primarily two kind of information. One is relating to the intermediate data being processed- for e.g. a variable storing a value during course of execution of an algorithm or a Process Control Block in an OS etc. The other is the Stack which is used by the processor to store its return functions and local variables. In either case the memory type is volatile.

Memory Types

The primary differentiation of the memory is based on the volatility i.e. whether the stored data is retained after power cycling the device.  Accordingly, the memory can be either Volatile memory or a non-volatile memory.

Volatile memory

Volatile memories can hold their contents only when power is continuously applied to the memory devices. As soon as the power is removed, the contents in the memories are lost. The primary usage is to store the data/stack as well as storing the program instructions.

Examples of volatile memories include static RAM, dynamic RAM and static dynamic RAM.

Generally the volatile memories used are of type Random Access Memory (RAM) i.e. data at any address in the memory can be accessed by giving the address in the address bus of the memory. Primarily the volatile memory is divided in to two types:

SRAM – Static Random Access Memory

The static RAM is a type of memory that uses bi-stable latching circuitry to store each bit. Due to the design, the memories need not be refreshed. Thus the data stored will be static till the duration of power being applied to the RAM.

The primary advantage of SRAM is its speed. Fast SRAMs can operate on par with the processor speed enabling access times equal to a clock cycle used by the microprocessor. Synchronous SRAMs are the preferred way of implementing Instruction and Data caches in a processor system. Further since there is no need for specialized controllers to refresh the RAM, they are easier to use with low end microcontrollers.

The down side is that the density of the SRAMs is comparatively lower than the DRAMs. Also the cost is comparatively higher.

DRAM – Dynamic Random Access Memory

DRAM stores each bit in a storage cell consisting of capacitor and transistors. Since capacitors lose their charges quickly they need to be recharged. So by design, each bit in the DRAM must be refreshed periodically to maintain its contents and hence the name “Dynamic”. Due to the structural simplicity (only one transistor and a capacitor per bit), DRAM can be packed much denser than SRAM.

Even though they need specialized controller to take care of refreshing, their higher density provides a higher cost to memory ratio compared to SRAM’s.

The most popular type of DRAM used in the SDRAM.

SDRAM – Static Dynamic Random Access Memory

SDRAM is a type of DRAM that ‘Synchronous’ with the system bus. The device needs a SDRAM controller typically a part of the SoC for it to function properly. The data is organized as row and column and an internal state machine that takes care of fetch and refresh logic.

High speed varieties of SDRAM include DDR, DDR2, and DDR3. DDR – Double Data Rate RAMs can transfer data on both edges of the clock and hence the name. DDR2/DDR3 has higher data width and different power requirements even though internally they operate at the same rates as DDR.

Non-volatile memory

Non-volatile memories will retain their contents even when the power to the memory device is removed. This makes them better choice for storing the data that are to be retrieved after the system is restarted. The configurations settings are typically stored in the non-volatile memory. They are typically slower than volatile memory and require complex procedures for reading and writing.

Though there are many other kinds of technologies such as Disk-On-Chip, SSD, MMC Cards etc, are available, the most common non-volatile memories found in embedded systems are as follows

  • Flash memory
  • EEPROM
  • SD cards

Flash memory

Flash memory is a most commonly used type of non volatile memory in the embedded system for their durability and larger number of erase cycles.

Microcontroller unit mostly contains flash memory on which the programs are written for execution. Since flash memory is integrated on-chip with the microcontroller, its usage become easier. Flash memory is generally sector/block erasable, which means one sector/block of the memory can be erased at a time in which each bit erased is moved to a state ‘1’. When it is written, the state is changed from ‘1’ to ‘0’.

Apart from the on-chip flash memories, there are two types of flash memories available for external storage. They are NAND and NOR flash memories

NAND flash

NAND flash memories are the most commonly used types of flash memory. NAND type of flash memory can be written and read in blocks. They are generally smaller and are primarily used in USB flash drives and SSD’s. They have core cells connected in series either as 8 or 16 cells.

NOR flash

NOR flash contains core cells connected in parallel (common ground). Since random access is supported, they are used for storing Execute in Place code.

Though NAND technology is slower compared to NOR flash, it offers higher density and better cost ratio as well as a higher life span up to 10 times more than NOR. Typical interface for flash memory to the processor is the SPI bus.

EEPROM (Electrically Erasable Programmable Read Only Memory)

EEPROM is a special type of memory that supports erasing and programming of each bit of memory unlike the flash technology that supports only block erases.  Further the power consumption is very low for EEPROM. SPI, I2C are the most commonly available interface options for EEPROM.

SD cards (Secure Digital cards)

SD cards are the type of non volatile memory commonly used in portable devices. The SD card itself has a processor inside to take care of the complex interface requirements as well as performing internal operations like error correction, wear levelling etc. SD cards are also used as a boot device is most of the high performance embedded system.  Common SD card interface modes available are SD and SPI.

Memory Selection

Selection of suitable memory is very much essential step in high performance applications, because the challenges and limitations of the system performance are often decided upon the type of memory architecture.

Systems memory requirement depend primarily on the nature of the application that is planned to run on the system. Memory performance and capacity requirement for low cost systems are small, whereas memory throughput can be the most critical requirement in a complex, high performance system.

Following are the factors that are to be considered while selecting the memory devices,

  • Speed
  • Data storage size and capacity
  • Bus width
  • Latency
  • Power consumption
  • Cost

SRAM’s have lower data storage and capacity hence they are suitable for lower end systems where as SDRAM for higher end systems with complex requirements.

Among the high speed types of SDRAM, DDR2 memory modules can have memory capacities from 256MB to 4GB capacities. Most of the DDR2 memory chips come in FBGA (Fine Ball Grid Array) package. The package allows higher memory densities in smaller space with better electrical properties. DDR2 memory uses 1.8V for power, resulting in lower power and cooler operation, whereas the DDR uses 2.5V.

Further there are variations of DDR available that are fine tuned for particular applications. For example, the Graphic DDR (GDDR) memory is designed for higher performance than the standard DDR memory. To achieve this, they operate at additional voltage of 2.0V. But the capacity of GDDR memory devices in comparison to DDR tends to be reduced typically from 256Mb to 512Mb. This enables them to be used in resource intensive video cards. On the other end of the spectrum, Mobile DDR (MDDR) memory devices are optimized for low power applications such as battery operated and handheld devices. In deep power down (DPD) mode of operation, their current can go as low as 10uA.

The data rates are defined by the RAM manufacturer and are based on various factors such as CAS latency, RAS-CAS delay etc. Even a increase of 0.5 cycle, can impact a change of up to 10% of speed.

Again, these high speed varieties of SDRAM needs careful PCB layout with signal integrity considerations including presence of suitable terminations.

Obviously a 32-bit width memory can fetch more data in a same cycle as a 16 bit memory. Thus more the data width, better the transfer rate, provided the data line support is available.

Another factor, when going for non-volatile programmable storage, is deciding the programming model. For example, it could be ISP (In-System Programming) that allows programming the flash but needs the application to be stopped at that time. Or it could be IAP (In-Application Programming) that will allow re-programming of the memory even when the application firmware is running. This is determined by the memory architecture. Nowadays many microcontrollers support both the options and ISP is used for manufacturing and IAP is appropriate for field updates.

Though nowadays the memory controllers available in the SoC primarily dictate the selection of the memory devices, we believe this blog provides a good insight about various memory technologies, their application and selection. In the next blog, we will analyze about the power supply design in an embedded system.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>