MEMORY
Memory is an important part of a processor/controller based embedded
systems.
The processors/controllers contain built in memory and this memory is
referred as on-chip memory.
The processors/controllers do not contain any memory inside the chip and
requires external memory to store the algorithm. It is called off-chip
memory.
Working memory is required for holding data temporarily during certain
operations.
So, the different types of memory used in embedded system applications.
1. PROGRAM STORAGE MEMORY (ROM)
The program memory or code storage memory of an embedded system stores the
program instructions.
The code memory retains its contents even after the power to it is; turned off. It is
generally known as non-volatile storage memory.
Depending on the fabrication, erasing and
programming techniques, they are
classified into the different types.
Classification of Program Memory
(ROM)
Masked ROM (MROM)
Masked ROM is a one-time programmable device.
Masked ROM makes use of the hardwired technology for storing data.
The device is factory programmed by masking and metallisation process to store
data.
Advantage: low cost for high volume production.
Different mechanisms are used for the masking process of the ROM:
a. depletion mode transistors are used in ROM.
b. standard transistors or a high threshold transistors are used in ROM.
Masked ROM is a good for storing the embedded firmware for low cost
embedded devices.
Limitation: MROM is permanent in bit storage, it is not possible to alter the bit
information.
Programmable Read Only Memory (PROM) / (OTP)
One Time Programmable Memory (OTP) or PROM is not pre-programmed by the
manufacturer. The end user is responsible for programming these devices.
This memory has nichrome or polysilicon wires arranged in a matrix. These wires
can be functionally viewed as fuses.
It is programmed by a programmer which selectively burns the fuses according to the
bit pattern.
Fuses which are not burned represents a logic “1” whereas fuses which are burned
represents a logic “0”. The default state is logic “1”.
OTP is widely used for commercial production of embedded systems
It is a low cost solution for commercial production.
OTPs cannot be reprogrammed.
Erasable Programmable Read Only Memory (EPROM)
Erasable Programmable Read Only Memory (EPROM) gives the flexibility to re-
program the same chip.
In EPROM, Bit information is stored by a programmer, which applies high voltage
to charge the floating gate ie) FET.
EPROM contains a quartz crystal window for erasing the stored information.
If the window is exposed to ultraviolet rays, the entire memory will be erased.
It needs to be taken out of the circuit board and put in a UV eraser device for 20 to
30 minutes. So it is a tedious and time-consuming process.
Electrically Erasable Programmable Read Only Memory (EEPROM)
EEPROM memory can be altered by using electrical signals at the register/Byte
level.
They can be erased and reprogrammed in-circuit.
These chips include a chip erase mode and data can be erased in a few
milliseconds.
Advantage: greater flexibility for system design.
Limitation: capacity is limited (A few kilobytes).
FLASH
FLASH is the latest and the most popular ROM technology used in embedded designs.
It is a variation of EEPROM technology.
It combines the re-programmability of EEPROM and the high capacity of standard
ROMs.
FLASH memory is organised as sectors (blocks) or pages.
FLASH memory stores information in an array of floating gate MOS- FET transistors.
The erasing of memory can be done at sector level or page level without affecting the
other sectors or pages.
The typical erasable capacity of FLASH is 1000 cycles.
W27C512 from WINBOND is an example of 64KB FLASH memory and SST39LF010 is
an example of 1 Mbit.
NVRAM
Non-volatile RAM is a random access memory with battery backup.
It contains static RAM based memory and a minute battery for providing supply to
the memory in the absence of external power supply.
The memory and battery are packed together in a single package.
The life span of NVRAM is expected to be around 10 years.
DS1644 from Maxim/Dallas is an example of 32KB i NVRAM.
2. READ-WRITE MEMORY/RANDOM ACCESS MEMORY (RAM)
RAM is the data memory or working memory of the controller/processor.
Controller/processor can read from it and write to it.
RAM is volatile - when the power is turned off, all the contents are destroyed.
RAM is a direct access memory- we can access the desired memory location
directly
RAM generally falls into three categories:
* Static RAM (SRAM),
* Dynamic RAM (DRAM)
* Non-volatile RAM (NVRAM)
Static RAM (SRAM)
Static RAM stores data in the form of voltage.
They are made up of flip-flops.
Static RAM is the fastest form of RAM.
An SRAM cell (bit) is used six transistors (or 6 MOSFETs).
Four of the transistors are used for building the latch (flip-flop) part of the memory cell
and two for controlling the access.
SRAM is fast in operation due to its resistive networking and switching capabilities.
This implementation in its simpler form can be visualised as two-cross coupled inverters
with read/ write control through transistors.
The four transistors in the middle form the cross-coupled inverters.
In SRAM implementation, the access to the memory cell is controlled by the line Word Line, which controls the
access transistors (MOSFETs) Q5 and Q6.
The access transistors control the connection to bit lines B & B\.
If we write a value to the memory cell, apply the desired value to the bit control lines
For writing 1, make B = 1 and B\ =0
For writing 0, make B = 0 and B\ =1
Set the Word line to 1
For reading the content of the memory cell, both B and B\ bit lines to 1 and set the Word line to 1.
Limitations: low capacity and high cost. Since a minimum of six transistors are required to build a single memory cell
Dynamic RAM (DRAM)
Dynamic RAM stores data in the form of charge.
They are made up of MOS transistor gates.
Advantages: high density and low cost compared to SRAM.
Disadvantage: the information is stored as charge it gets leaked off with time and to prevent
this they need to be refreshed periodically.
Special circuits called DRAM controllers are used
for the refreshing operation. The refresh operation
is done periodically in milli seconds interval.
The MOSFET acts as the gate for
the incoming and outgoing data and
the capacitor acts as the bit storage unit..
The relative merits and demerits of SRAM and DRAM technology:
SRAM cell DRAM cell
Made up of 6 CMOS transistors (MOSFET) Made up of a MOSFET and a capacitor
Doesn't require refreshing Requires refreshing
Low capacity (Less dense) High capacity (Highly dense)
More expensive Less expensive
Fast in operation. Slow in operation due to refresh requirements.
Typical access time is 10ns Typical access time is 60ns.
Write operation is faster than read operation
NVRAM
Non-volatile RAM is a random access memory with battery backup.
It contains static RAM based memory and a minute battery for providing supply to
the memory in the absence of external power supply.
The memory and battery are packed together in a single package.
NVRAM is used for the non-volatile storage of results of operations or for setting
up of flags, etc.
The life span of NVRAM is expected to be around 10 years.
DS1744 from Maxim/Dallas is an example for 32KB NVRAM.
3. MEMORY ACCORDING TO THE TYPE OF INTERFACE
The various types of interface (connection) of memory with the
processor/controller.
parallel interface: The parallel data lines (D0-D7) for an 8 bit
processor/controller will be connected to D0-D7 of the memory
serial interface: I2C - Pronounced as I Square C. It is a 2 line serial interface
SPI (Serial peripheral interface: 2+n line interface where n stands for the
total number of SPI bus devices in the system. It can also be of a single wire
interconnection (like Dallas 1-Wire interface).
Serial interface is used for data storage memory like EEPROM. The memory
density of a serial memory is usually expressed in terms of kilobits
parallel interface memory is expressed in terms of kilobytes.
Atmel Corporations AT24C512 is an example for serial memory with capacity 512
kilobits and 2-wire interface.
4. MEMORY SHADOWING
The execution of a program or a configuration from a ROM is very slow (120 to 200 ns)
compared to the execution from a RAM (40 to 70 ns).
RAM access is about three times as fast as ROM access.
Shadowing of memory is a technique to solve the execution speed problem in processor-
based systems.
In computer systems, there will be a configuration holding ROM called Basic Input Output
Configuration ROM or BIOS.
In personal computer systems, BIOS stores the hardware configuration information like the
address for various serial ports, other devices, etc. During system boot up, the configuration
information is accessed and it is time consuming.
Now the manufactures included a RAM behind the logical layer of BIOS as a shadow to the
BIOS.
So, during the boot up, BIOS information copies to the shadowed RAM and write protecting
the RAM then disabling the BIOS reading.
But, RAM is volatile and it cannot hold the configuration data which is copied from the BIOS
when the power supply is switched off. Only a ROM can hold it permanently. But for high
system performance it should be accessed from a RAM instead of accessing from a ROM.
5. MEMORY SELECTION FOR EMBEDDED SYSTEMS
Embedded systems require
1. a program memory for holding the control algorithm (For a super-loop based design)
2. embedded OS and the applications designed to run on top of it (for OS based designs),
3. data memory for holding variables and data during task execution
4. memory for holding non volatile data like configuration data, look up table etc
The memory requirement for an embedded system in terms of RAM and ROM
(EEPROM/FLASH/NVRAM) is dependent on the type of the embedded system and the applications for
which it is designed.
Lot of factors need to be considered when selecting the type and size of memory for embedded system.
For example, if the embedded system is designed using SoC or a microcontroller with on-chip RAM and
ROM (FLASH/EEPROM), the application need the on-chip memory may be sufficient for designing the
total system.
First, we identify the system requirement and the type of processor, take a decision on whether the on-
chip memory is sufficient or external memory is required.
Eg- 1: simple electronic toy design - the complexity of requirements are less and data memory
requirement are minimal.
It needs a microcontroller with a few bytes of internal RAM, a few bytes or of FLASH memory and
a few bytes of EEPROM (if required). there is no need for external memory at all.
Eg-2: Embedded system- based on an RTOS - the RTOS requires certain amount of RAM for its
execution and ROM for storing the RTOS image.
The binary code for RTOS kernel containing all the services is stored in a non-volatile memory Like
FLASH as either compressed or non-compressed data.
During boot-up of the device, the RTOS files are copied from the program storage memory to the
RAM for execution.
Based on the run time RAM requirements and program memory' requirements, The supplier of the
RTOS usually gives a rough estimate of RAM and ROM size.
Eg-3: A smart phone device with Windows mobile operating system is an example for embedded
device with OS.
64MB RAM and 128MB ROM are the minimum requirements for miming the Windows mobile
device and it needs extra RAM and ROM for running user applications.
There are two parameters for representing a memory.
1. size of the memory chip: There is no option to get a memory chip with the exact
required number of bytes.
Memory chips come in standard sizes like 512bytes, 1024bytes (1 kb), 2048bytes (2
kb), 4Kb,f 8Kb, 16Kb, 32Kb, 64Kb, 128Kb, 256Kb, 512Kb, 1024Kb (1 mb), etc.
Suppose embedded application requires only 750 bytes of RAM, 1024 bytes is the least
possible option.
While you select a memory size, you consider the address range supported by your
processor.
For example, for a processor/ controller with 16 bit address bus, the maximum number of
memory locations that can be addressed is 216 = 65536 bytes = 64Kb.
2. word size of the memory: The word size refers to the number of memory bits that can
be read/write together at a time. 4, 8, 12, 16, 24, 32, etc. are the word sizes supported
by memory chips.
The word size supported by the memory chip matches with the data bus width of the
processor/controller.
FLASH memory is the popular choice for ROM in embedded applications.
It is a powerful and cost-effective solid-state storage technology for mobile electronics devices
and other consumer applications.
FLASH memory comes in two major variants,
NAND FLASH
NOR FLASH
NAND FLASH is a high-density low cost non-volatile storage memory.
NOR FLASH is less dense and expensive. But it supports the Execute in Place (XIP)
technique for program execution.
The XIP technology allows the execution of code memory from ROM itself without the need
for copying it to the RAM.
It is a good practice to use a combination of NOR and NAND memory for storage memory
requirements
NAND FLASH is used for storing program code
DRAM can be used for copying and executing the program code
NOR FLASH supports XIP and it can be used as the memory for bootloader
EEPROM data storage memory – It is used in serial interface or parallel
interface chip .
If the processor/controller of the device supports serial interface and the amount of
data to write and read to and from the device is less, it is better to have a serial
EEPROM chip.
The serial EEPROM saves the address space of the total system.
The memory capacity of the serial EEPROM is expressed in bits or kilobits.
Eg. 512 bits, lKbits, 2Kbits, 4Kbits, etc.
THE END