Describes how to select memory types in embedded applications.

Source: Internet
Author: User

The type of memory determines the operation and performance of the entire embedded system. Therefore, the selection of memory is a very important decision. Whether powered by battery or mains, application requirements determine the type of memory (volatile or non-volatile) and purpose of use (storing code, data, or both ). In addition, memory size and cost are also important factors to consider during the selection process. For smaller systems, the memory provided by the microcontroller may meet system requirements, while for larger systems, the external memory may be required. When selecting a storage type for an embedded system, you need to consider some design parameters, the options include microcontroller selection, voltage range, battery life, read/write speed, memory size, memory features, erasure/Write durability, and total system costs.

 

Figure 1 lists the most common memory types in embedded application systems. The following describes the basic principles that should be followed when selecting a memory.

 

Basic principles to be followed when selecting a memory

 

1. Internal memory and external memory

 

Generally, when the storage space required for the stored program code and data is determined, the design engineer will decide whether to use internal memory or external memory. Generally, internal storage has the highest cost performance but the lowest flexibility. Therefore, design engineers must determine whether the storage requirements will increase in the future, and whether there is a way to upgrade to a microcontroller with a larger code space. Based on cost considerations, people usually choose the microcontroller with the smallest storage capacity that can meet application requirements, so you must be especially careful when predicting the size of the Code, because the larger the size of the Code may require the replacement of the microcontroller.

 

There are various external memory devices on the market, so we can easily adapt to the increase in code size by adding memory. Sometimes this means replacing existing memory with memory of the same encapsulation size but larger capacity, or adding storage on the bus. Even if the Microcontroller has internal memory, external serial EEPROM or flash memory can be added to meet the system's demand for non-volatile memory.

 

 

2. Boot memory

 

In a large Microcontroller System or processor-based system, design engineers can use pilot code for initialization. The application usually determines whether the code needs to be guided and whether a dedicated boot memory is required. For example, if there is no external addressing bus or a serial boot interface, internal memory is usually used without a dedicated boot device. But in some systems without internal program memory, Initialization is part of the operation code, so all the code will reside in the same external program memory. Some controllers have both internal memory and external addressing bus. In this case, the pilot code will reside in the internal memory and the operation code will reside in the external memory. This is probably the safest method, because the pilot code will not be accidentally modified when the code is changed. Boot memory must be non-volatile in all cases.

 

3. Configure Storage

 

For field programmable gate array (FPGA) or on-Chip Systems (SOC), people use memory to store configuration information. The memory must be non-volatile EPROM, EEPROM, or flash memory. In most cases, FPGA uses the SPI interface, but some older devices still use the FPGA serial interface. Serial EEPROM or flash memory devices are most commonly used, and EPROM is rarely used.

 

4. program memory

 

All systems with processors use program memory, but the design engineer must decide whether the memory is inside or outside the processor. After this decision is made, the design engineer can further determine the storage capacity and type. Of course, sometimes the Microcontroller has both internal program memory and external addressing bus. At this time, the design engineer can choose to use either of them or both. This is why selecting the best storage for an application is often complicated due to the complexity of the microcontroller selection and the reasons for changing the memory size will also lead to a change in the microcontroller selection.

 

If the microcontroller uses both internal memory and external memory, the internal memory is usually used to store infrequently changed code, while the external memory is used to store frequently updated code and data. Design Engineers also need to consider whether the memory will be reprogrammed online or replaced with new programmable devices. For applications that require re-programming, we usually choose a microcontroller with Internal flash memory, but the microcontroller with internal OTP or ROM and external flash memory or EEPROM also meets this requirement. To reduce costs, external flash memory can be used to store code and data, but you must be careful not to accidentally modify the code when storing data.

In most embedded systems, flash storage programs are used to upgrade firmware online. Older application systems with stable code can still use ROM and OTP memory. However, due to the versatility of flash memory, more and more application systems are turning to flash memory. Table 1 compares program memory parameters.

 

5. Data Storage

 

Similar to program memory, data memory can be located inside the microcontroller or an external device, but there are some differences between the two situations. Sometimes the microcontroller contains both SRAM (volatile) and EEPROM (non-volatile) data memory, but sometimes does not contain the internal EEPROM. In this case, when a large amount of data needs to be stored, design engineers can select External serial EEPROM or serial flash devices. Of course, parallel EEPROM or flash memory can also be used, but they are usually used only as program memory.

 

When external high-speed data storage is required, parallel SRAM is usually selected and external serial EEPROM devices are used to meet non-volatile memory requirements. Some designs also use flash devices as program memory, but retain one sector as the data storage area. This method can reduce costs, space, and provide non-volatile data storage.

 

For non-volatile memory requirements, serial EEPROM devices support I2C, SPI, or Microwire communication bus, while serial flash memory typically uses the SPI bus. FRAM has been applied in some systems due to its fast writing speed and serial interfaces of I2C and SPI. Table 2 compares the advantages and disadvantages of various types of data storage.

 

 

6. Volatile and non-volatile memory

 

Memory can be divided into volatile memory or non-volatile memory. The former will lose data after power failure, while the latter can still maintain data after power failure. Design Engineers sometimes use volatile memory with a backup battery to make it act like a non-volatile device, but this may be more expensive than simply using non-volatile memory. However, for systems requiring a very large memory capacity, DRAM with a backup battery may be a cost-effective method to meet design requirements.

In a system with continuous energy supply, both volatile and non-volatile memory can be used, but the final decision must be made based on the possibility of power failure. If the information in the memory can be recovered from another source during power recovery, you can use volatile memory.

 

Another reason for choosing volatile memory to be used with battery is speed. Although non-easy-to-lose memory parts can maintain data during power failure, it takes a long time to write data (one byte, page, or sector.

 

 

7. serial memory and Parallel Memory

 

After the application system is defined, the choice of the microcontroller is a factor that determines the choice of serial or parallel storage. For large application systems, the microcontroller usually does not have enough internal memory. In this case, external memory must be used because the external addressing bus is usually parallel, external program memory and data memory will also be parallel.

 

A small application system usually uses a microcontroller with internal memory but without an external address bus. If additional data storage is required, external serial storage is the best choice. In most cases, this extra external data memory is non-volatile.

 

According to different designs, the pilot memory can be sequential or parallel. If the microcontroller does not have internal memory, parallel non-volatile memory is the right option for most application systems. However, for some high-speed applications, external non-volatile serial memory devices can be used to direct the microcontroller and allow the primary code to be stored in internal or external high-speed SRAM.

8. EEPROM and flash memory

 

The maturity of memory technology makes the boundaries between RAM and Rom very vague, and now there are some types of memory (such as EEPROM and flash) combined with the characteristics of both. These devices read and write like Ram and keep data like Rom when power is down. They can all be erased and programmable, but each has their own advantages and disadvantages.

 

From the software point of view, the independent EEPROM and flash memory devices are similar. The main difference between the two is that the eeprom devices can be modified literally, flash devices only support sector erasure and programming the word, page, or sector of the erased unit. The re-programming of flash memory also requires the use of SRAM, so it requires more devices to work in a longer period of time, thus consuming more battery energy. The design engineer must also confirm that there is sufficient capacity of SRAM available when modifying the data.

 

Memory density is another factor that determines the choice of Serial EEPROM or flash memory. Currently, the size of independent serial EEPROM devices available on the market is kb or less, and the size of independent flash devices is 32 kb or more.

 

If multiple devices are connected together, you can use serial EEPROM to achieve a capacity higher than kb. High erasure/Write durability requirements enable design engineers to select the EEPROM, because the typical serial EEPROM can be erased/written 1 million times. Flash memory can be wiped/written 10 thousand times, and only a few devices can reach 0.1 million times.

 

Today, most flash devices have a voltage range of 2.7v to 3.6 V. If you do not require byte addressing capabilities or high erasure/Write durability, flash memory can be used for application systems within this voltage range, making the cost relatively low.

 

9. EEPROM and fram

 

The design parameters of EEPROM and fram are similar, but fram has a high number of reads and writes, and the writing speed is fast. However, in general, the user will still choose EEPROM instead of fram, mainly because of the cost (FRAM is expensive), quality level and supply. Design Engineers often use low-cost serial EEPROM unless durability or speed is mandatory for the system.

 

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

 

DRAM seems useless compared to SRAM, but the DRAM controller located inside the microcontroller makes DRAM performance the same as that of SRAM. The DRAM controller periodically refreshes the stored data before the data disappears, so the stored content can be kept for a long time as needed.

 

Because of low bit costs, DRAM is usually used as program memory, applications with large storage requirements can benefit from dram. Its biggest disadvantage is its slow speed, but the computer system uses high-speed SRAM as the high-speed buffer memory to compensate for DRAM speed defects.

 

Table 3 summarizes the features of various types of memory mentioned in this article. It should be noted that different types of memory are suitable for different situations, and each type has its own advantages and weaknesses, so the comparison by item is not always meaningful.

 

 

Summary

 

Although we can use almost any type of memory to meet the requirements of embedded systems, the requirements for terminal applications and total costs 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 storage. Store permanent programs in non-volatile Rom, and store programs and data downloaded by users in volatile dram that is supported by battery. Regardless of the storage type selected, the design engineer must carefully consider various design factors before determining that the storage will be used for the final application system.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.