NAND Flash principle

Source: Internet
Author: User


6.1.3) block blocksa Nand Flash (chip, chips) consists of a number of blocks (blocks), the size of the block is generally 128KB, 256KB, 512KB, here is 128KB. Other less than 128KB, such as 64KB, is generally the following will be introduced to the small block of NAND Flash. Blocks block, is NAND Flash's Basic/Minimum unit of erase Operation. 6.1.4) pageEach block contains a lot of pages (page). The size of each page, for now common NAND flash most is 2KB, the latest NAND flash is 4KB, 8KB, etc., this kind of page size is more than 2KB NAND flash, known as Big BlockNand Flash, the corresponding hair Read and Write command address, total 5 cycles (cycle), while the old NAND flash, the page size is 256b,512b, this kind of NAND flash is called Small block, the address period is only 4. pages page, which is the basic unit of read and write operations。 However, there are some Nand flash support for subpage (1/2 pages or 1/4 pages) sub-page read and write operations, but generally very rare.6.1.5) oob/redundant area/spare Areaeach page, corresponding to an area, is called Free Zone (spare area)/redundant zone (redundant area), and Linux systems are generally called OOB (out of Band), this area, is originally based on NAND flash hardware features: Data in the read and write time is relatively easy error, so in order to ensure the correctness of the data, there must be a corresponding detection and error correction mechanism, which is called EDC(Error Detection Code)/So an extra area is designed to place the checksum value of the data. The read and write operations of Oob are generally done with the operation of the page, i.e. Read and write the page, the corresponding study written in the OOB。about the OOB Specific Use, summed up there are:flag is bad fastStoring ECC Datastore some data related to the file system. such as JFFS2 will use these spaces to store some specific information, and the YAFFS2 file system, in the OOB, a lot of information related to their own file system6.1.6) Nandflash Common command Settings

as you can see, if you want to implement read a pageof data, it is necessary send the Read command, and it is divided into Two cycles(Cycle), the corresponding command is sent two times, One is 0x00h, the second is 0x30h., and twice command Center, you need to send the corresponding The address of the page read。correspondingly, other common operations, such as Write a pageThe data (Page program), which is send the 0x80h first, then the address to be written, and then send the 0x10h

Notes: #代表低电平有效6.1.8) Understand the operation sequence diagram of Nandflash with read operation as an example

Notes: This figure is from the Samsung model K9F2G08 's Nand Flash data Sheet (datasheet). Let's take a look at the red vertical line on the side of the ① that I purposely marked. The time at which the red bar is located is the moment before the command 0x00 that sends the first cycle of the read operation. Let's see, at that moment, what values it crosses through several lines, and further understanding why that value is needed. 1) Red vertical line through the first row, is CLE. The pin that is described in the preceding command to enable (CLE) is CLE 1, you are going through the I/O multiplexing port send into NAND FlashOf is an order, not an address or other type of data. Only in this way will CLE 1, make it effective, to notify the internal hardware logic, you will receive the command, the internal hardware logic, will be the command, placed in the command register, in order to achieve the correct operation behind, otherwise, do not go to CLE 1 to make it effective, hardware will be at a loss, I do not know whether you passed the data or the command.2) and the second line, is ce#, that moment of value is 0。 This is simple, since you're going to NAND Flash Send an order, then check it first, so make sure ce# to Low levelTo make it effective, that is, Effective Chip selection。3) The third line is we#, meaning that Write Enable。 Because the next step is to write commands to Nand Flash, sowe# valid, so set to low level. 4) Line fourth, is ALE is low level, while the ALE is high-active, this means that it Invalid。 And the corresponding, described earlier, makes CLE effective, because the data is going to be the command (at this point to send the diagram as shown in the second cycle of the Read command 0x30), not the address. If on some other occasions, like the next to enter an address, make it valid, and make CLE invalidThe5) Line fifth, re#, this is high and invalid. Can be seen until the back 6th Stage, only to become low level, only valid, because then, to happen Read CommandTo reading Data。6) Line Six, is the key to the introduction of the re-use of the input and output I/O port, and at the moment, there is no input data, and then, at different stages, will Enter or output a different data/address。7) line seventh, r/b#, high level, indicates R (ready)/readiness, because in the back of the 5th stage, the hardware inside, in the fourth stage, after accepting the external read command, put the Page's DataA little bit Send to page registerIn this period of time, belong to the system is busyWork, belongs to the busy stage, so, r/b# only become Lowindicates busy busyof the state. Other timing is similar to the understanding.

2. Bad block in NAND FlashNAND Flash, a block containing 1 or more bits is bad, it is called the bad block. The stability of bad blocks is not guaranteed, that is, you cannot guarantee that the data you write is right, or that the write is right, and that it is not necessarily right to read it. With this corresponding normal block, it is certain that the write readout is normal. There are two kinds of bad blocks:(1) There is a bad block at the factory:One is the factory, that is, you buy new, but also useless NAND Flash, you can contain the bad block. This kind of factory has a bad block, known as factory (masked) or initial bad/invalid block, before the factory, will do the corresponding mark, marked as a bad block. (2) bad blocks produced during use:The second class is called in the use of the process, due to the use of the process for a long time, in addition to the erase, error, indicating that this block is broken, but also in the process of running the program, found, and marked as bad block. The location of the specific marker, as above. This type of block is called worn-out bad block. The broken block is used. 2.1 mark of bad blockThe specific mark is that for NAND Flash, which is now a common page size of 2K, is The 1th byte of the OOB start position of the first page in the Block(The old small page, pagesize is the 512B to 256B NAND Flash, the bad block tag is the 6th byte). If not 0xFF, it's a bad block.。 The corresponding is, all normal blocks, good blocks, all the data inside is 0xFF. However, for some of the new Nand Flash now, a lot of ways of marking, some changes, some become the first page of the bad block or the second page, there is a countdown to the last or second page, to mark the bad block. For specific information, please refer to the corresponding Nand Flash data sheet, which will have instructions. For the bad block of the token, in essence, it is only the corresponding flash on some bytes of data is not 0xFF, so, as long as the data, is can read and write. It also means that other values can be written, and the bad block tag information is destroyed. For the factory bad block, it is generally not recommended to erase the information marked good. One of the commands in Uboot is "NAND scrub" to erase everything in the block, including the bad block tag, whether it's factory-ready or the new tag that appears later in the process. In general, this is not recommended. In fact, the best practice is to use "NAND erase" only wipe the good block, for the block has been marked bad block, do not easily erase, otherwise it is difficult to distinguish which is the factory is bad, which is later used in the process of bad.2.2 Management of bad blocksfor the management of bad blocks, the Linux systems, called Bad block Management (BBM, bad block Management), the corresponding will have a table to record good blocks, broken pieces of information, and the bad block is the factory, or later use produced, this table is called bad block table (BBT, Bad Block Table). The NAND flash driver in the Linux kernel MTD architecture, and the NAND flash driver in Uboot, after loading the driver, if you do not join the parameters of the active request to skip the bad block scan, then will go to actively scan the bad block, establish the necessary BBT, in case the bad block after the Use.

The first two cycles send A0~a11, which is the column address, which is the in-page address. The last three cycles are sent A12~a28, which is the line address, that is, the page address. But the program gets the page address to move the address addr right 11 bits instead of 12 bits. began to be very confused. After some exploration, we understand why. First you need to understand the structure of the NAND flash in-page address, which is divided intoMain Field (2K)and theSpare Field (64Byte)two parts, and ourdata is storedput in 2KThe normal data read and write is not in the back 64Byte operation, usingA0~A10 addresses enable addressing of 2K data stores. For k9f2g08u0b in-page structure:

function The addr address passed in by Nand_read_page_ll does not contain an addressing to the Sapre field. So move only 11 bits instead of 12 bits . NAND Flash reads data in pages , and when NAND Flash receives an address, the data after the addr&0x7f address in the page is then output, including spare Field. In the NAND_READ_PAGE_LL function, the column address is 0, reading all the data on this page. So the For loop reads the data, and then jumps out of the loop after reading the contents of the first 2K.

NAND Flash principle

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.