Find, Search, Reprint, Submit Articles For Free

Why do microcontrollers need Flash and EEPROM? What do they do?

The data during the operation of the single-chip microcomputer is stored in RAM (random access memory), and the data in RAM cannot be retained after power down. So how to make the data not be lost after power down? This requires the use of EEPROM or FLASHROM and other memory to achieve.

The full name of EEPROM is "Electrically Erasable Programmable Read-Only Memory", that is, Electrically Erasable Programmable Read-Only Memory. It is relative to the UV erasable rom. But today there are many EEPROM variants, which have become a general term for a type of memory.

EEPROM in a narrow sense:

The feature of this kind of rom is that it can randomly access and modify any byte, and can write 0 or 1 to each bit. This is the most traditional type of EEPROM. The data will not be lost after power failure, can be stored for 100 years, and can be erased and written 100w times. It has high reliability, but the circuit is complicated/cost is also high. Therefore, the current EEPROMs are tens of kilobytes to hundreds of kilobytes, and rarely exceed 512K.


Flash belongs to EEPROM in a broad sense because it is also an electrically erasable ROM. But in order to distinguish it from the general erasable EEPROM in bytes, we call it Flash.

Since the two are similar, why should there be both Flash and EEPROM in the microcontroller?

Usually, the Flash in the single-chip microcomputer is used to store the running code and cannot be changed during the running; the EEPROM is used to save the user data, which can be changed during the running, for example, the alarm time of a clock is initialized to 12:00, and later It is changed to 6:00 during operation, which is stored in EEPROM, so you don’t need to be afraid of power failure. Even if you re-power on, you don’t need to readjust to 6:00.

But the biggest difference is actually: FLASH operates according to sectors, EEPROM operates according to bytes, the addressing methods of the two are different, and the structure of the storage unit is also different. The circuit structure of FLASH is simpler, and the same capacity occupies a smaller chip area, and the cost is It is naturally lower than EEPROM, so it is suitable for program memory, and EEPROM is more used as non-volatile data memory. Of course, FLASH can also be used as data memory, but the operation is more troublesome than EEPROM, so a more "humane" MCU design will integrate FLASH and EEPROM two non-volatile memories, while cheap designs often only have FLASH, which can be powered in the early days. The rewritable MCUs are all EEPRM structures, and production is basically discontinued.

In the internal circuit of the chip, FLASH and EEPROM are not only different circuits, but also different address spaces, and naturally different operation methods and instructions, whether in von Neumann structure or Harvard structure. Technically, both the program memory and the non-volatile data memory can only use the FALSH structure or the EEPROM structure, and even use "flexible" technical means to simulate the "data storage area" in the program storage area, but even so, the two are still conceptually Different, this is a matter of basic common sense.

EEPROM: Electrically erasable programmable read-only memory. The operating characteristics of Flash are in full compliance with the definition of EEPROM. It is undoubtedly EEPROM. When the first Flash was launched, it was clearly marked as EEPROM in the data manual. This is also true in most Flash manuals today. As indicated, the relationship between the two is "white horse" and "horse". As for why the industry has to distinguish between the two, the main reason is that the operating method of Flash EEPROM is completely different from traditional EEPROM, and the secondary reason is for the simplicity of the language. In informal documents and spoken language, Flash EEPROM is referred to as Flash. It is the white horse's "white" attribute rather than its "horse" attribute to distinguish Flash from traditional EEPROM.

Flash is characterized by simple structure, higher capacity can be obtained under the same process and same wafer area and faster operation speed under large data volume, but the disadvantage is that the operation process is troublesome, especially when small data volume is repeatedly rewritten, so The Flash structure in MCU is suitable for program memory that does not need to be rewritten frequently.

In many applications, some small amounts of data need to be rewritten frequently and need to be powered off. The traditional EEPROM is very suitable here. Therefore, many MCUs have designed two EEPROM structures, FLASH and traditional, in order to obtain cost and The balance of functions greatly facilitates the user. With the popularity of ISP and IAP, especially in MCU systems where the program storage address space and data storage address space overlap, more and more MCU manufacturers now use program memory that supports IAP to simulate the data memory corresponding to EEPROM. A workaround for implementing non-volatile data storage at low cost. In order to obtain the "equivalent" of the dual EEPROM process in commercial promotion, many manufacturers of Flash program memory "simulation" (note that the technical concept is not true) EEPROM data memory have declared that their products are equipped with EEPROM Strictly speaking, this is not rigorous, but businessmen have business goals and methods. Using Flash to "simulate" EEPROM can obtain greater commercial benefits. Therefore, in fact, they are the initiators of technical confusion.

In terms of cost, it is cost-effective to "simulate" EEPROM with Flash. On the contrary, no one will do it. What about using EEPROM to simulate Flash? This may be caused by some MCUs where program storage space and data storage space are continuous. Among such MCUs, especially low-end MCUs with small storage capacity still use EEPROM as non-volatile memory, which is lower in cost than the dual-process design of Flash and traditional EEPROM, but this phenomenon is only limited to the premise of small capacity under. Due to the popularity of Flash technology, many businessmen and technicians who are not rigorous enough now call program memory Flash. For those MCUs that only use traditional EEPROM technology, they don’t know how to understand, so they incorrectly call EEPROM program memory "simulated Flash" , The fundamental reason is that they did not understand that Flash is only a memory structure rather than the purpose of memory. The wrong premise naturally leads to wrong conclusions. Commercially speaking, using EEPROM to emulate Flash is a stupid behavior that no one will actually do. This goes against the principle of pursuing the best interests of business and is technically not feasible, and for technicians. The essential problem is that Flash is a type of memory rather than the program memory in the MCU. Even if the program memory of the MCU is Flash, the inverse proposition does not hold.

(Wanna learn more about EEPROM? visit here)


Flash , EEPROM

Author's articles

Other articles