Microcontrollers have memories for storing programs, and those for saving data. The memory for programs stores the programs for the microcontroller to operate correctly. The programs should not be rewritten during operation of a microcontroller.
Microcontrollers have memories for storing programs, and those for saving data. The memory for programs stores the programs for the microcontroller to operate correctly. The programs should not be rewritten during operation of a microcontroller. It’s supposed to be in the memory even if the microcontroller was turned off. On the other hand, data stored in the memory may change, since the microcontroller changes them as necessary. It’s acceptable to lose the data in the memory at the same time as a power supply is shut off. Thus, the memories in a microcontroller are roughly classified into two kinds. They are called Read Only Memory (ROM) and Random Access Memory (RAM).
I explain about ROM this time.
Especially, about a flash ROM indispensable to
ROM is a read-only memory. Data cannot be easily rewritten to it. Some ROMs cannot be rewritten at all once they are shipped out from manufacturers. However, data can be written in most ROMs in many microcontrollers, by performing specified procedure. In this case, the program in the ROM remains even if the microcontroller is turned off and can be read out next time when the microcontroller operates. Thus, the memory that can hold data is called non-volatile memory. A flash ROM is one of the non-volatile memories as well.
Next, before starting the explanation about a flash ROM,
let's check out the basic knowledge of a transistor.
The transistor used for the integrated circuit of a semiconductor has three terminals.
These terminals are shown as symbols in the below figure.
From a viewpoint of the direction of current, the terminal on the side for injecting current in a transistor is called ‘drain’. The terminal on the side for pulling out current from a transistor is called ‘source’. Moreover, what controls the value of the current flowing through a transistor is called ‘gate’. The higher the electric potential of the gate, the more current flows into the source from the drain. (Here, the NMOS transistor is described. We will leave out description about details here. However, the semiconductor integrated circuit has one more kind of transistor called a PMOS transistor. With a PMOS transistor, the roles of a drain and a source are opposite by looking at the direction of current flow. )
Now, various structures are used for a memory cell of a flash ROM. The most fundamental composition has a floating gate. A floating gate is like a pocket for putting in coins. If an electron is put in there, the electron will stay in there. This electron remains into the floating gate even after a microcontroller is turned off. It is the basic mechanism of a non-volatile memory.
The memory cell of a flash ROM stores two values of the data, 0 and 1.
Which data is stored is decided according to whether an electron or a hole is in the floating gate. A transistor does not turn on if the electron is in the floating gate; because a current does not flow (this state is 0). On the other hand, if a hole is in the floating gate, a transistor will send current. This is in the state of 1. Thus, 0 or 1 can be decided whether a current flows into a transistor or not.
Then, how is an electron put into the floating gate? To do so, a memory cell needs to be put on the specific environment that does not occur during the normal operation. Otherwise, it may accidentally write in during the normal operation.
Set the gate voltage to the potential 3 to 5 times higher than the normal value. Then, electrons jump into the floating fate by being pulled by the potential. If a gate voltage drops to the usual potential, the electron in a floating gate will not go anywhere, but will stop there.
On the other hand, if the potential relations are carried out reversely and the source is made into high potential, an electron will jump out of the floating gate to the direction of source shortly. As a result, the electron hole (hole) will remain in the floating gate. Since the hole has an electric charge of plus, current flows through a transistor.
After all, writing to a flash ROM means an operation whether to put an electron into a floating gate, or to pull out an electron.
Semiconductor memories generally consist of a cell matrix, a row decoder, a column decoder and a sense circuit. This composition is the same for ROM and RAM.
A cell matrix consists of individual memories (this is called a memory cell) that hold data, rows and columns. The memory cell stores 1-bit information, either of 0 or 1.
A decoder is used in order to choose one arbitrary cell in this cell matrix. A decoder has a row decoder for choosing one row on the matrix, and a column decoder for one column.
The cell data chosen by the row decoder and the column decoder is to be judged by the sense circuit. The sense circuit judges whether the data is “1” or “0”. The flash ROM also has the same structure.
A flash ROM is a type of non-volatile memories. There is a reason for specially calling it "flash." Please think about a camera flash. It’s a device that produces a short flash to illuminate an object in a dark place. It instantaneously illuminates wide area.
A flash ROM sets data of all cells (cell matrix) in a memory to 1 at once. That is, it gets electrons out from the floating gate of all the memory cells at a stretch, and leaves holes. ‘Flash’ is named from the image of momentary flash of lighting. The first inventor of this idea is a Toshiba engineer.
The data in a flash ROM is rewritten in the way as follows. First, the flash ROM before rewriting has many cells with the data of 1 or 0. Then, th operation setting the data of all the cells to 1 is carried out at once . Finally, the data 0 is written in alternatively. This operation is performed for each single cell. Changing the data of a cell from 0 to 1 is done by setting all the cells to 1. Single specific cell cannot be changed from 0 to 1.
The once microcontroller had a mask ROM. The data of each cell in a program ROM was directly written in the process of manufacturing a microcontroller at a manufacturer's factory. Once data is written, data cannot be rewritten. This memory is called a mask ROM.
The advantage of the mask ROM was that a program cannot be changed under any condition. However, it could be a problem. Program is written by a human being, so it could have an error. If the program does not work properly, the program needs to be changed. Changing a program of a mask ROM is not easy. To write a program in the mask ROM, users had to order the manufacturer. Extra expenses are caused and it takes one or two months to receive the mask ROM. Microcontrollers that users can rewrite a program by themselves were needed. The flash ROM fulfilled the requirement. Once program is completed, users can immediately use the microcontroller by writing program by themselves. So they can debug the program right after that. If there is an error, they can fix it and write it to the microcontroller again.
(There was a rewritable ROM historically called EPROM before a flash ROM. This ROM used light (ultraviolet rays), in order to set all the data of a cell to 1.)
There is further advantage of a flash ROM. Users can keep using the same microcontroller by changing the programs to be compatible with updates. That can reduce the number of inventory items and makes it easy to control the inventory. Moreover, the program can be rewritten while the flash ROM is mounted on the substrate, users do not have to take the set to pieces.
When the microcontrollers with flash ROM came on the market, they are relatively expensive, so they were mainly used for development processes and trial productions. However, using flash ROMs can eliminate a cost for a mask generating ROM pattern, and the total cost using flash ROMs has become lower than mask ROMs because of improvement of the semiconductor process. These factors have contributed to the wide spread of flash ROM usage these days.
Now you could say there is no microcontroller
that does not contain a flash ROM.
Flash memories are indispensable for microcontrollers.