NandFlash bad block management method

A bad block and block number technology, applied in the field of NandFlash bad block management, can solve the problems of increased memory capacity and large memory, and achieve the effects of strong adaptability, high production efficiency and strong versatility

Active Publication Date: 2013-02-13
FEITIAN TECHNOLOGIES
4 Cites 16 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0004] The inventor finds in the process of realizing the present invention that there are at least the following defects in the prior art: the method of directly ...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention discloses a NandFlash bad block management method and belongs to the field of memories. The method comprises the following steps of: performing initial bad block scanning, looking for a substitutive block for the scanned bad block, generating corresponding record and writing the record in a bad block substitution region, creating a bitmap list after the initial bad block scanning, performing bitmap marking on the record in the bad block substitution region, judging whether the block related in the operation request is bad block according to the mark in the bitmap when receiving a block operation request, if so, looking for the substitutive block of the bad block and operating the substitutive block, if not, operating the current block, adding or amending the record in the bad block record if the bad block appears during the operation process, and adding the mark of the new bad block in the bitmap list. The NandFlash bad block management method has the beneficial effects of supporting high capacity NandFlash chips under the condition of occupying small internal memory and improving the access speed of the NandFlash chips.

Application Domain

Technology Topic

Image

  • NandFlash bad block management method
  • NandFlash bad block management method
  • NandFlash bad block management method

Examples

  • Experimental program(3)

Example Embodiment

[0048] Example one
[0049] See figure 1 The embodiment of the present invention provides a NandFlash bad block management method, and the method specifically includes:
[0050] Step S1: Check whether the initial bad block scan flag is set, if yes, go to step S3 directly, otherwise go to step S2;
[0051] Step S2: Perform an initial bad block scan, find replacement blocks for the scanned bad blocks, and generate a corresponding record to write into the bad block replacement area, and set the initial bad block scan flag after the initial bad block scan is completed;
[0052] Step S3: Create a bitmap, set the values ​​of all data bits in the bitmap to the first preset value, read the records in the bad block replacement area, and compare the bitmap with the The value of the data bit corresponding to each bad block is set to the second preset value for bitmap marking, and the block operation request is waited for after the bitmap marking is completed;
[0053] Wherein, the creation of the bitmap specifically refers to the creation of a bitmap according to the number of blocks in NandFlash. Preferably, in this embodiment, each bit in the bitmap represents the state of a block in NandFlash, and it is obvious that one Bit indicates that the state of one block in NandFlash is the most memory-saving solution, and the present invention is not limited to indicate the number of bits used by one block in NandFlash.
[0054] Step S4: When a block operation request is received, it is checked whether the value of the data bit corresponding to the block number involved in the block operation request in the bit table is the first preset value, if yes, step S5 is executed, otherwise, step S5 is executed. S6;
[0055] Preferably, in this embodiment, when a block operation request is received, before checking whether the value of the data bit corresponding to the block number involved in the block operation request in the bit map is the first preset value Including determining whether the block number involved in the block operation request is legal;
[0056] Correspondingly, if it is valid, check whether the value of the data bit corresponding to the block number involved in the block operation request in the bitmap is the first preset value; if it is invalid, it will prompt that the block number is invalid and the operation failed; If the NandFlash contains the block number involved in the operation request, the block number is legal, and if the NandFlash does not contain the block number involved in the operation request, the block number is illegal.
[0057] Step S5: Operate the current block, and execute step S7;
[0058] Step S6: Search for the record corresponding to the block number involved in the block operation request in the bad block replacement area to obtain the replacement block of the current block, operate on the replacement block, and execute step S7;
[0059] Step S7: Judge whether there is a new bad block during the operation, if yes, execute step S8, otherwise it prompts that the operation is successful and the process ends;
[0060] Step S8: Find a replacement block for the new bad block, generate a corresponding record and write it into the bad block replacement area, and set the value of the data bit corresponding to the new bad block in the bitmap to a second preset value, The operation is performed on the replacement block of the new bad block, and step S7 is returned to.
[0061] Specifically, in this embodiment, the searching for a replacement block for the new bad block and generating a corresponding record before writing the bad block replacement area may further include: determining whether the new bad block is a replacement block of a certain bad block ;
[0062] Correspondingly, if yes, look for a replacement block for the new bad block, and modify the corresponding record in the bad block replacement area, if not, look for a replacement block for the new bad block, and generate a corresponding record to write the bad block replacement Area.

Example Embodiment

[0063] Example two
[0064] The embodiment of the present invention provides a NandFlash bad block management method. The method specifically includes four parts: initial bad block scanning, bitmap creation and marking, block operation, and bitmap update. This embodiment separately performs initial bad block scanning and Bitmap creation and marking are described as a process, and block operations and bitmap update are described as a process.
[0065] See figure 2 , The initialization process of bad block scanning and bitmap creation and marking includes the following steps:
[0066] Step 101: Check whether the initial bad block scan flag is set, if yes, go to step 114, otherwise go to step 102;
[0067] Wherein, the initial bad block scan flag is used to identify whether the initial bad block scan is completed, the initial scan flag is in a reset state when the NandFlash leaves the factory, and is set when the initial bad block scan is completed.
[0068] Step 102: Locate the first block in NandFlash;
[0069] Step 103: Determine whether there is a bad block mark in the OOB area of ​​the current block, if yes, go to step 104, otherwise go to step 111;
[0070] The size of each page of NandFlash is 512+16 (or 256+8, 2048+64) bytes, of which 512 bytes are the area for storing data, 16 bytes are called OOB (Out of Band) area, usually stored in OOB area Bad block mark and signature 512-byte ECC check code, etc.
[0071] Step 104: Check whether the bad block replacement area is full, if yes, go to step 105, otherwise go to step 106;
[0072] Step 105: Prompt that the bad block replacement area is full, set the NandFlash unavailable flag, wait for the block operation request to be received, and go to step 201;
[0073] Wherein, the NandFlash unavailable flag is used to identify whether the NandFlash is available. The NandFlash unavailable flag is in a reset state when the NandFlash leaves the factory, and is set when it is detected that there are too many bad blocks in the NandFlash.
[0074] Step 106: Determine whether there are available replacement blocks, if yes, go to step 108, otherwise go to step 107;
[0075] Usually NandFlash uses 7% to 10% of its blocks as replacement blocks.
[0076] Step 107: Prompt that there is no available replacement block, set the NandFlash unavailable flag, wait for the block operation request to be received, and perform step 201;
[0077] Step 108: Find the currently available replacement block;
[0078] Step 109: Determine whether the OOB area of ​​the currently available replacement block has a bad block flag, if yes, go back to step 106, otherwise go to step 110;
[0079] Step 110: Write the current block number and the currently available replacement block number as a record into the bad block replacement area;
[0080] Specifically, the structure of the record in the bad block replacement area may be: bad block block number (current block block number) replacement block block number, for example, the third block of the NandFlash is a bad block, and the replacement block is For the 1000th block of NandFlash, the record of the third block of NandFlash in the bad block replacement area is: 0x0003 0x03E8.
[0081] Step 111: Determine whether there are any unscanned blocks in NandFlash, if yes, go to step 112, otherwise go to step 113;
[0082] Step 112: Locate the next block of the current block, and return to step 103;
[0083] Step 113: Set the initial bad block scan flag, and go to step 114;
[0084] Step 114: Create a bitmap according to the number of blocks in NandFlash, and set the values ​​of all data bits in the bitmap to the first preset value;
[0085] In order to occupy as little memory space as possible, preferably, in this embodiment, each bit in the bitmap represents the status of a block, that is, each byte can represent the status of 8 blocks, for example, if the NandFlash There are 1024 blocks in total, then the size of the bitmap is 1024bit, which is 128 bytes;
[0086] The first preset value may be a value different from the second preset value below. Specifically, in this embodiment, the first preset value is 1, for example, in a bitmap The byte data of the state of the first 8 blocks (the 0th block to the 7th block) in NandFlash is set to 1111 1111 in this step.
[0087] Step 115: Determine whether there are unscanned records in the bad block replacement area, if yes, go to step 116, otherwise go to step 119;
[0088] Step 116: Read the bad block number in the current record, and set the value of the corresponding data bit in the bitmap to the second preset value;
[0089] Specifically, the second preset value may be a different value from the first preset value. Specifically, in this embodiment, the second preset value is 0, for example, if the current record 0x0003 0x03E8, the read bad block number is 0x0003, the value of the 4th bit in the bitmap is set to 0, correspondingly, the bitmap is used to represent the first 8 blocks in NandFlash (the 0th block to the first 7 blocks) The byte data of the status becomes 1110 1111.
[0090] Step 117: Determine whether there are unscanned records in the bad block replacement area, if yes, go to step 118, otherwise go to step 119;
[0091] Step 118: Set the next record of the current record as the current record, and return to step 116;
[0092] Step 119: Prompt that the bitmap marking is completed, wait for the block operation request to be received, and execute step 201;
[0093] See image 3 , The block operation and bitmap update process includes the following steps:
[0094] Step 201: When a block operation request is received, check whether the NandFlash unavailable flag is set, if yes, it will prompt that NandFlash is unavailable and the operation has failed, otherwise, go to step 202;
[0095] Step 202: Determine whether the block number involved in the block operation request is legal, if yes, go to step 204, otherwise go to step 203;
[0096] Specifically, if the NandFlash contains the block number involved in the operation request, the block number is legal, and if the NandFlash does not contain the block number involved in the operation request, the block number is illegal.
[0097] Step 203: Prompt that the block number is illegal and the operation failed;
[0098] Step 204: Check whether the value of the data bit corresponding to the current block in the bitmap is the first preset value, if yes, go to step 205, otherwise go to step 206;
[0099] For example, if the block number involved in the operation request is 0x0003, check the value of the 4th bit of the first byte in the bit table, specifically, in this embodiment, check whether the value of the 4th bit of the first byte in the bit table is Is 1.
[0100] Step 205: Perform corresponding operations on the current block, and execute step 208;
[0101] Specifically, the operations include writing data into the current block, erasing data in the current block, etc., which are not limited here.
[0102] Step 206: Find the record with the current block number in the bad block replacement area, and read the replacement block number in the record;
[0103] Step 207: Perform corresponding operations on the replacement block;
[0104] Specifically, the operation performed on the replacement block is the original operation to be performed on the current block, and will not be repeated here.
[0105] Step 208: Determine whether a new bad block appears during the execution of the operation, if yes, go to step 210, otherwise go to step 209;
[0106] Step 209: Prompt that the operation is successful;
[0107] Step 210: Determine whether the bad block replacement area is full, if yes, go to step 211, otherwise go to step 212;
[0108] Step 211: It prompts that the replacement area for bad blocks is full and the operation fails;
[0109] Step 212: Determine whether there are available replacement blocks, if yes, go to step 214, otherwise go to step 213;
[0110] Step 213: It is prompted that there is no available replacement block, and the operation fails;
[0111] Step 214: Find the currently available replacement block;
[0112] Step 215: Determine whether the OOB area of ​​the currently available replacement block has a bad block flag, if yes, go back to step 212, otherwise go to step 216;
[0113] Step 216: Write the new bad block number and the currently available replacement block number as a record into the bad block replacement area;
[0114] Step 217: Set the value of the data bit corresponding to the new bad block in the bitmap to the second preset value;
[0115] Step 218: Return the block number of the currently available replacement block, and return to step 207.

Example Embodiment

[0116] Example three
[0117] The embodiment of the present invention provides a NandFlash bad block management method. The method specifically includes four parts: initial bad block scanning, bitmap creation and marking, block operation, and bitmap update. This embodiment separately performs initial bad block scanning and Bitmap creation and marking are described as a process, and block operations and bitmap update are described as a process.
[0118] The initial bad block scanning and the bitmap creation and marking process are the same as the method in the second embodiment, and will not be repeated here;
[0119] See Figure 4 , The block operation and bitmap update process includes the following steps:
[0120] Step 301: When the block operation request is received, check whether the NandFlash unavailable flag is set, if yes, it will prompt that NandFlash is unavailable and the operation has failed, otherwise, go to step 302;
[0121] Step 302: Determine whether the block number involved in the block operation request is legal, if yes, go to step 304, otherwise go to step 303;
[0122] Specifically, if the NandFlash contains the block number involved in the operation request, the block number is legal, and if the NandFlash does not contain the block number involved in the operation request, the block number is illegal.
[0123] Step 303: Prompt that the block number is illegal and the operation failed;
[0124] Step 304: Check whether the value of the data bit corresponding to the current block in the bitmap is the first preset value, if yes, go to step 305, otherwise go to step 306;
[0125] For example, if the block number involved in the operation request is 0x0013, check the value of the 20th bit in the bit map, that is, the 4th bit of the 3rd byte. Specifically, in this embodiment, check whether the value of the 20th bit in the bit map is Is 1.
[0126] Step 305: Perform corresponding operations on the current block, and execute step 308;
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Online quality detection system for printed matter

Owner:昆明瑞丰印刷有限公司

Method for Producing L-Amino Acids Using Bacteria of the Enterobacteriaceae Family

ActiveUS20060141586A1Increase productivityBacteriaHydrolasesEnterobacteriaceae bacteriumL-Arabinose
Owner:AJINOMOTO CO INC

Full-automatic wire harness crimping machine

InactiveCN102074874AIncrease productivityLow energy consumptionConnection formation by deformationBatch productionEngineering
Owner:TIANJIN LIGAN TECH

Classification and recommendation of technical efficacy words

  • Increase productivity
  • Versatile

Apparati, methods, and compositions for universal microbial diagnosis, detection, quantification, and specimen-targeted therapy

InactiveUS20120129794A1Increase productivityAccurate and rapid and sensitive microbial diagnosis and detection and quantificationAntibacterial agentsBiocidePopulationMolecular Targeted Therapies
Owner:DOWD SCOT E +2

People also interested in

Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products