Nor flash operations

Source: Internet
Author: User

Flash is a non-volatile memory. In terms of principle, technology and structure, Flash is significantly different from Rom, prom, EPROM, and EEPROM Memory. It is a fast erase memory that can be programmed in the field quickly. This feature makes flash widely used for bios, Online Data erasure, power loss protection data, and partition protection data.

Flash Memory features
Due to the particularity of its internal structure, flash memory is mainly characterized by the operating modes of its internal state machine (internal state machine) and command sequences, therefore, flash needs more complex software support.
All operations except read array data, such as manufacturer ID (manufacture ID) and device ID identification, and partition write protection (sector protection) /Write protection (Sector unprotection), chip Erase/sector erase, write data/check, reset, and other operations must be performed through the command register in the device) start the embedded algorithm (embeded algorithms.
BCS/SCS
Intel has defined operating procedures and a set of corresponding commands for flash chip operations since its early 8-bit flash chip 28f008, which is generally referred to as "28f008" or "008 ". Later, it was officially named as the basic command set for flash operations, that is, BCS. The main points are as follows:
The flash memory chip is normally read at random. The flash memory chip is like a general ROM chip. The access address determines the specific storage unit;
Unless the chip is in the write state, writing to any chip unit means sending commands to the chip. Therefore, access to its controller is not the access to its storage unit;
Depending on the command code, the state machine in the flash memory chip enters different states, so that different operations can be performed.
BCS has the following commands:
Read array ). Write 0xff to any address of the chip to enable the chip to "reset" to enter the "read storage array" State. In this state, the CPU can randomly read data from the flash memory chip to access normal memory. The initial status after the flash memory chip is powered on is random reading.
Read Status Register ). Write 0x70 to any address of the chip, indicating that the Status Register should be read from the chip, and then the content of the Status Register can be read from any address of the chip.
Writing (Program) requires writing several storage units of the chip. Write 0x40 to the starting address of the target block, indicating that the write mode is required, or "programming mode ". After entering the write mode, you can randomly write the target block, just like writing static RAM. Each unit can only be written once. (To write data to a unit again, you must first erase the block where the unit is located before performing the operation ).
Clear Status Register ). Write 0x50 to any address of the chip to clear the Status Register.
Write a single byte or word. Write 0x40 or 0x10 to the Unit to be written, and then write specific data.
Block erase ). Write 0x20 (or 0x28) to any address in the target block, indicating that all contents of a block in the chip must be erased.
Erase suspends ). Write 0xb0 to any address in the target block, indicating that the erasure operation must be suspended. If necessary, you can write 0xd0 to any address in the target block to restore the erasure.
Block erasure confirmation, or continue erasure. Write 0xd0 to any address in the target block, indicating that all content in a block in the chip needs to be erased, or the erased operation is resumed after the erasure is paused.
When a command is sent to the chip, the highest bit (bit 7) of the Status Register is 0. After the operation is completed, the bit is set to 1 by the hardware.
With the development of Flash technology, Intel later expanded BCS, called SCs (scaleable command set), that is, "extensible command set ". The chip lock (Set/clear lock bit) and buffer write are added. Command functions such as chip configuration and full-chip erasure.
The operations described above by BCS and SCS are only applicable to intel flash chips or Intel BCS/SCS specification chips.
JEDEC ID
At the early stage of Flash technology development, only one intel team produced a single flash chip. Later on, the flash memory chip manufacturers often made their products compatible with Intel, so Intel's BCS became a de facto standard. However, with the increase of flash chip manufacturers, there are more and more types and specifications of Flash chips. On the one hand, BCS is insufficient, and on the other hand, some manufacturers use different BCS procedures. For example, if the chip ID is read, the chip produced by AMD needs to write 0xaa5 to address 0 on the chip. In fact, Intel and AMD are the main flash chip manufacturers. In this case, especially for general-purpose computer systems, before operating the flash chip, we must first find out which chip is produced by which vendor. Therefore, it is necessary to have a "neutral" approach supported by all flash chip vendors so that computer software can read the information from the chip. Therefore, the so-called "jedec id" and corresponding commands are available:
Read chip ID (read ID ). Write 0x90 to any address on the chip, indicating that the identity information solidified in the chip needs to be read from the chip, such as who produces the ID and what model it is called "jedec id ". This information does not occupy the address of the flash chip in the memory space. After that, the CPU can read the information one byte from the address 0 on the chip.
CFI
Too little information is provided by jedec id. Therefore, the "common flash interface" (CFI) came into being. This is an operation procedure and standard defined by the storage chip industry to obtain physical and structural parameters of the flash chip.
CFI stipulates that each vendor can use its own operating procedure and command set, but it must have a uniform number and provide this number under the software query. In addition, the flash memory chip supports two sets of operating procedures and command sets at the same time for the software to choose to use. At the same time
Thinking different!
The flash memory chip must provide more information, including: What is the power supply voltage of the chip, and whether the erasure/write operation requires additional power, chip capacity, divided into several erased blocks, typical values and maximum values of various operations, and so on. To this end, a standard data structure is defined to provide detailed information. All flash memory chips supporting CFI should be able to provide information according to the format of the data structure when receiving the query, CFI information block. In addition, additional parameters and information can be provided together with the supported operating procedures and command sets.
The CFI query procedure and command are as follows:
Write 0x98 to the chip address 0x55, and then read the data from the chip address 0x10. If the read content is "Q", "r", and "Y" in sequence, the chip supports CFI.
Then, the sequential IP address from the chip is 0x13 ~ 0x30 reads the fixed part of the CFI information block.
In addition to the fixed part, there is an unsigned integer array. Its size depends on the storage range on the chip into several erasure intervals. Each unsigned integer in the array describes an erasure interval. There can be several erased blocks of the same size in an erasure interval.
If the 16-bit unsigned short integer p read from the address 0x15 and 0x16 is not 0, there is a "master algorithm expansion table" at the address P on the chip ". This is the parameter and other information that matches the "main algorithm" (that is, the main operating procedures and command set in the chip.
If the 16-bit unsigned short integer t read from the address 0x19 and 0x20 is not 0, there is an "algorithm expansion table" at the address T on the chip ". This is the parameter and other information that matches the "secondary algorithm" (that is, another set of operating procedures and command sets supported by the chip.

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.