Selection Techniques for Memory Types in Embedded Applications

The type of memory will determine the operation and performance of the entire embedded system, so the choice of memory is a very important decision. Whether the system is powered by battery or mains, application requirements will determine the type of memory (volatile or non-volatile) and the purpose of use (storing code, data, or both). In addition, the memory size and cost are also important factors to consider during the selection process. For smaller systems, the microcontroller's own memory may meet system requirements, while larger systems may require additional external memory. When selecting a memory type for an embedded system, several design parameters need to be considered, including microcontroller selection, voltage range, battery life, read/write speed, memory size, memory characteristics, erase/write durability, and system total cost.

Figure 1 lists the most commonly used memory types in embedded applications. The following discusses the basic principles that should be followed when choosing a memory.

Basic principles to follow when choosing a memory

1. Internal memory and external memory

In general, after determining the storage space required to store program code and data, the design engineer will decide whether to use internal memory or external memory. In general, internal memory is the most cost-effective but has the lowest flexibility, so design engineers must determine whether the need for storage will grow in the future and whether there is a way to upgrade to a larger code space microcontroller. Based on cost considerations, people usually choose the microcontroller with the smallest memory capacity that can meet the application requirements. Therefore, special care must be taken when predicting the code size, because the increased code size may require the replacement of the microcontroller.

Currently, there are various sizes of external memory devices on the market, and we can easily accommodate the increase in code size by adding memory. Sometimes this means replacing the existing memory with a memory of the same package size but with more capacity, or adding memory on the bus. Even if the microcontroller has internal memory, the system's need for non-volatile memory can be met by adding an external serial EEPROM or flash memory.

2. Boot storage

In larger microcontroller systems or processor-based systems, design engineers can use boot code for initialization. The application itself usually determines whether or not the boot code is needed, and whether it needs special boot memory. For example, if there is no external addressing bus or serial boot interface, internal memory is usually used without special boot devices. However, in some systems without internal program memory, initialization is part of the operating code, so all code will reside in the same external program memory. Some microcontrollers have both internal and external addressing buses. In this case, the boot code will reside in the internal memory and the operation code in the external memory. This is probably the safest method, because you don't accidentally modify the boot code when you change the operating code. In all cases, the boot memory must be non-volatile memory.

3. Configuration memory

For field-programmable gate arrays (FPGAs) or system-on-chips (SoCs), people use memory to store configuration information. This memory must be a non-volatile EPROM, EEPROM, or flash memory. In most cases, the FPGA uses the SPI interface, but some older devices still use the FPGA serial interface. Serial EEPROM or Flash devices are the most commonly used, and EPROM is used less often.

4. Program memory

All systems with processors use program memory, but design engineers must decide whether the memory is internal or external to the processor. After making this decision, the design engineer can further determine the capacity and type of memory. Of course, sometimes microcontrollers have both internal program memory and external address bus. At this time, the design engineer can choose to use either of them, or both. This is why the problem of choosing the best memory for an application is often due to the fact that the selection of the microcontroller becomes complicated and why changing the size of the memory will also lead to changes in the choice of the microcontroller.

If the microcontroller utilizes both internal memory and external memory, the internal memory is typically used to store infrequently changing code, and the external memory is used to store more frequently updated code and data. Design engineers also need to consider whether the memory will be reprogrammed online or replaced with a new programmable device. For applications requiring reprogramming functionality, microcontrollers with internal flash memory are commonly used, but microcontrollers with internal OTP or ROM and external flash or EEPROM also meet this requirement. To reduce costs, external flash memory can be used to store code and data, but care must be taken when storing data to avoid accidental modification of the code.

In most embedded systems, people use flash memory to store programs to upgrade firmware online. Code-stabilized older applications can still use ROM and OTP memory, but due to the versatility of flash memory, more and more application systems are turning to flash memory. Table 1 shows the comparison of the program memory type parameters.

5. Data storage

Similar to program memory, the data memory can be internal to the microcontroller or an external device, but there are some differences between these two conditions. Sometimes the microcontroller internally contains both SRAM (volatile) and EEPROM (non-volatile) data memory, but sometimes it does not contain internal EEPROM. In this case, the design engineer can choose external when there is a large amount of data to be stored. Serial EEPROM or serial flash device. Of course, parallel EEPROM or flash memory can also be used, but usually they are only used as program memory.

When an external high-speed data memory is needed, parallel SRAMs are often selected and external serial EEPROM devices are used to meet the requirements for non-volatile memory. Some designs also use flash memory devices as program memory but retain one sector as a data storage area. This approach can reduce costs, space, and provide non-volatile data storage.

For non-volatile memory requirements, serial EEPROM devices support I2C, SPI, or Microwire communication buses, while serial flash drives typically use the SPI bus. Due to the fast write speed and I2C and SPI serial interface, FRAM is used in some systems. Table 2 compares the advantages and disadvantages of various types of data storage.

6. Volatile and non-volatile memory

The memory can be divided into volatile memory or non-volatile memory, the former will lose data after power off, while the latter can maintain data after power off. Design engineers sometimes use volatile memory with back-up batteries to make them behave like non-volatile devices, but this may be more expensive than simply using non-volatile memory. However, for systems that require very large memory capacity, DRAMs with back-up batteries may be a way to meet design requirements and are cost-effective.

In systems with continuous power supply, either volatile or non-volatile memory can be used, but final decisions must be made based on the possibility of power failure. If the information in memory can be recovered from another source when power is restored, volatile memory can be used.

Another reason to use volatile memory with a battery is speed. Although non-volatile memory devices can retain data when power is off, writing data (one byte, page, or sector) takes longer.

7. Serial memory and parallel memory

After the application system is defined, the choice of microcontroller is a factor that determines the choice of serial or parallel memory. For larger applications, the microcontroller usually does not have enough internal memory. External memory must be used because the external addressing bus is usually parallel and the external program memory and data memory will be parallel.

Smaller applications typically use a microcontroller with internal memory but no external address bus. If an extra data memory is required, an external serial memory device is the best choice. In most cases, this extra external data memory is non-volatile.

According to different designs, the boot memory can be serial or parallel. If the microcontroller does not have internal memory, parallel non-volatile memory devices are the right choice for most applications. However, for some high-speed applications, an external non-volatile serial memory device can be used to boot the microcontroller and allow the main code to be stored in an internal or external high-speed SRAM.

8. EEPROM and Flash

The maturity of memory technology has blurred the line between RAM and ROM. Nowadays, there are some types of memory (such as EEPROM and flash memory) that combine the characteristics of both. These devices read and write like RAM and, like ROM, retain data while power is off, they are all electrically erasable and programmable, but each has its advantages and disadvantages.

From a software perspective, separate EEPROM and flash devices are similar. The main difference between the two is that EEPROM devices can be modified byte by byte, while flash devices support only sector erase and words, pages or fans of the erased cells. Area programming. The reprogramming of flash memory also requires the use of SRAM, so it requires more devices to operate in a longer period of time and thus requires more battery power. The design engineer must also confirm that enough SRAM is available when modifying the data.

Memory density is another factor that determines the choice of serial EEPROM or flash memory. The stand-alone serial EEPROM devices currently available on the market have a capacity of 128 KB or less, and the stand-alone flash memory devices have a capacity of 32 KB or more.

If multiple devices are cascaded together, serial EEPROMs can be used to achieve capacities higher than 128 KB. The high erase/write endurance requirements prompted the design engineer to choose the EEPROM because a typical serial EEPROM could erase/write 1 million times. Flash memory can generally be erased/written 10,000 times, and only a few devices can reach 100,000 times.

Today, most flash memory devices have a voltage range of 2.7V to 3.6V. If the byte addressability or high erase/write durability is not required, flash memory can be used in applications within this voltage range, which can make the cost relatively low.

9. EEPROM and FRAM

The EEPROM and FRAM have similar design parameters, but the FRAM has a very high read/write speed and a fast write speed. However, under normal circumstances, users will still choose EEPROM instead of FRAM. The main reasons are cost (FRAM is expensive), quality level and availability. Design engineers often use lower-cost serial EEPROMs unless durability or speed is a mandatory system requirement.

Both DRAM and SRAM are volatile memories. Although both types of memory can be used as program memory and data memory, SRAM is mainly used for data memory. The main difference between DRAM and SRAM is the longevity of data storage. As long as the power is turned off, the SRAM can maintain its data, but the DRAM has only a very short data life, usually about 4 milliseconds.

Compared with SRAM, DRAM seems to be useless, but the DRAM controller inside the microcontroller makes DRAM performance the same as SRAM. The DRAM controller periodically refreshes the stored data before the data disappears, so the contents of the memory can be kept as long as needed.

Due to the low bit cost, DRAM is often used as program memory, so applications with large memory requirements can benefit from DRAM. Its biggest drawback is its slow speed, but computer systems use high-speed SRAM as a cache to compensate for DRAM speed defects.

Table 3 summarizes the features of the various types of memory mentioned in this article. It should be noted that the suitability of different types of memory is different. Each type has its own advantages and weaknesses, so item-by-item comparisons do not always yield meaningful results.

This article summary

Although we can use almost any kind of memory to meet the requirements of an embedded system, the terminal application and total cost requirements are usually the main factors that affect our decision making. Sometimes, the combination of several types of memory can better meet the requirements of the application system. For example, some PDA designs use both volatile memory and non-volatile memory as program memory and data memory. The permanent program is stored in non-volatile ROM, and the program and data downloaded by the user are stored in a battery-backed volatile DRAM. Regardless of the memory type chosen, design engineers must carefully consider various design factors before determining the memory that will be used in the final application system.


Industrial high standard quality PC+ABS plastic and SMC products for telecommunication, Green Telecom provides a full range of Fiber Access Terminal(FAT) products from 2 cores to 72 cores suitable for customer`s different requirements, main products including Fiber Access Terminal(FAT), Fiber Distribution Box(FDB), Fiber Termination Box(FTB), Fiber Splitter Box(FSB) and etc.

Fiber Distribution Box

Fiber Optic Distribution Box,Fiber Optic Termination Box,Fiber Distribution Box,Optical Termination Box

Chengdu Xinruixin Optical Communication Technology Co.,Ltd , https://www.xrxoptic.com

Posted on