NandFlash management method, device and electronic equipment
By dividing the NandFlash storage area into multiple substrates and zones, and employing redundancy mechanisms and information acquisition and operation execution units, the problem of identifying and recovering data errors in satellite on-orbit storage has been solved, enabling timely data identification and recovery, and improving the reliability and maintenance efficiency of the storage device.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING INST OF CONTROL ENG
- Filing Date
- 2026-01-30
- Publication Date
- 2026-06-02
AI Technical Summary
Due to inherent limitations, NandFlash storage units may fail to promptly identify, correct, and recover data errors stored on a satellite in orbit, thus affecting the satellite's normal operation.
A redundancy mechanism is adopted to divide the NandFlash storage area into multiple substrates, each substrate into multiple blocks, each block into multiple pages, and set up SINGLE area and GROUP area. It provides information acquisition unit and operation execution unit, and performs data read, write, erase, refresh, repair and maintenance operations through management information area and virtual address mapping table to ensure data backup consistency and wear leveling.
It enables timely identification and recovery of erroneous data from NandFlash storage devices, ensuring data integrity and reliability, improving the maintainability and operational stability of storage devices, reducing the risk of data corruption, and is suitable for various task scheduling modes.
Smart Images

Figure CN122131970A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to high-capacity NandFlash management technology, and more particularly to a lightweight, highly reliable high-capacity NandFlash management method, apparatus, and electronic device. Background Technology
[0002] NandFlash is a non-volatile memory widely used to store program code, status data, and critical mission data. It can be used to store data in satellite control computers. The limitations of NandFlash are: 1. Because NandFlash memory cells can only withstand a limited number of erase / write operations, under prolonged continuous use or high-intensity erase / write operations, some NandFlash memory cells will become unreliable storage cells, i.e., bad blocks; 2. Programming interference, read interference, electronic leakage, chip defects, and process iterations can cause errors in the stored data. When NandFlash data storage errors occur on a satellite in orbit, it is difficult to locate and repair them from the ground. If the erroneous data is not identified and corrected in time, it will seriously affect the stable operation of the onboard control computer, and in severe cases, it may even lead to satellite failure.
[0003] Therefore, to address the above shortcomings, a lightweight, highly reliable, and large-capacity NandFlash management technology is needed. Summary of the Invention
[0004] The technical problem this invention aims to solve is that, due to the inherent limitations of NandFlash storage units, when NandFlash storage data errors occur on a satellite in orbit, it is difficult to identify, correct, and recover them in a timely manner, thus affecting the normal operation of the satellite. To address the shortcomings of existing technologies, this invention provides a NandFlash management method, apparatus, and electronic device.
[0005] To address the aforementioned technical problems, this invention provides a NandFlash management method. The NandFlash storage area is divided into multiple substrates, each substrate is divided into multiple blocks, each block is divided into multiple pages, and all substrates are divided into one or more SINGLE areas and one or more GROUP areas, with the multiple GROUP areas serving as backups for each other. The method includes: acquiring the NandFlash management information area; determining whether read operations, write operations, refresh operations, repair operations, maintenance operations, and consistency maintenance operations are required based on flag bits, and executing the corresponding operations when the determination result is yes.
[0006] The present invention also provides a NandFlash management device, wherein the NandFlash storage area is divided into multiple substrates, each substrate is divided into multiple blocks, each block is divided into multiple pages, and all substrates are divided into one or more SINGLE areas and one or more GROUP areas, with the multiple GROUP areas serving as backups for each other; the device includes: an information acquisition unit, adapted to acquire the NandFlash management information area and virtual address mapping table; and an operation execution unit, adapted to determine whether a read operation, write operation, refresh operation, repair operation, maintenance operation, and consistency maintenance operation are required based on a flag bit, and to execute the corresponding operation when the determination result is yes.
[0007] The present invention also provides an electronic device, comprising: a memory; a processor; and Computer program instructions; wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of the present invention.
[0008] The NandFlash of this invention employs a redundancy mechanism for data storage, avoiding the drawbacks of single points of failure. By acquiring, establishing, and updating the NandFlash's management information area and virtual address mapping table, it automatically recovers erroneous data through operations such as reading, writing, erasing, refreshing, repairing, maintaining, and maintaining consistency. By dividing the substrate into GROUP and SINGLE types, it ensures data backup consistency. Through bad block replacement operations, bad blocks are marked and good blocks are redirected, ensuring data integrity and reliability. Wear leveling is ensured by evenly distributing erase and write operations across all storage units. This invention reduces the risk of data corruption in NandFlash storage devices, enabling timely identification, correction, and recovery of erroneous data, ensuring data integrity, reliability, and lifespan. These functions are executed in idle tasks or system management tasks. Each time an idle task or system management task is entered, only one page of functionality is performed on the NandFlash, without occupying the time of other critical tasks, improving efficiency, and is applicable to various task scheduling modes. At the same time, it improves the maintainability of NandFlash, enhances maintenance efficiency, and improves NandFlash storage performance, thus fully ensuring the overall operational efficiency and stability of the aerospace system. Attached Figure Description
[0009] Figure 1 This is a virtual page and block attribute partitioning diagram according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of a NandFlash management method according to an embodiment of the present invention; Figure 3 yes Figure 2 A schematic flowchart of step S1; Figure 4 yes Figure 2 A schematic flowchart of step S2; Figure 5 This is a schematic diagram of the structure of a NandFlash management device according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention.
[0010] In the diagram: 1: Information acquisition unit; 2: Operation execution unit; 3: Memory; 4: Processor; 5: Computer program instructions. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0012] Existing NandFlash management technologies, which only consider the management of the underlying bad block mapping table and virtual addresses and lack redundancy backup mechanisms, struggle to promptly identify, correct, and recover erroneous data caused by factors such as programming interference, read interference, electronic leakage, chip defects, and process iterations. Therefore, they fail to meet the high reliability requirements of the aerospace industry. To address these issues, this invention provides a NandFlash management method capable of promptly detecting, correcting, and recovering erroneous data.
[0013] Each substrate in the NandFlash internal storage area is divided into two parts: the first mgr_n blocks are the management information area, and the remaining part is the data area. The core management information includes the following items: substrate management header, physical block management table, and logical block management table, stored redundantly in info_n copies, each stored in a separate block. Each item is stored at its corresponding location within each block: the substrate management header is located on page 0, and the physical block management table and logical block management table are stored sequentially on subsequent pages. The remaining (mgr_n-info_n) blocks are used as backup blocks. When writing data to the management information area, the ECC checksum of the corresponding page is written synchronously, and the CRC checksum of all the above information is written to the last page.
[0014] Figure 1 This is a partition diagram of the virtual page and block attributes in Embodiment 1 of the present invention. For example... Figure 1As shown, a NandFlash is divided into 8 substrates, each substrate into 4096 physical blocks, and each block into 128 physical pages, with the physical pages numbered in hexadecimal. Blocks 1 to 16 of each substrate serve as the NandFlash management information area; blocks 17 to 2064 are the initial logical block area (a logical block is a contiguous virtual memory space address that the operating system or user can directly see and use, and can be directly overwritten and written to. There is a changeable mapping relationship between logical blocks and physical blocks); blocks 2065 to 4096 serve as the NandFlash good block replacement pool. Blocks 17 to 4096 are all areas actually accessible to the user. The NandFlash logical layer is managed in units of virtual pages, with all virtual pages uniformly and sequentially identified by a unique virtual page number. A virtual page is the smallest logical data unit used by the operating system or user when operating on the logical block address space; it does not actually store data but is a standardized, contiguous virtual address.
[0015] An embodiment of the present invention provides a NandFlash management method including: obtaining the management information area and virtual address mapping table of the NandFlash; determining whether a read operation, write operation, refresh operation, repair operation, maintenance operation, and consistency maintenance operation are required based on a flag bit, and performing the corresponding operation when the determination result is yes.
[0016] The NandFlash management method of this invention runs in the form of computer software (e.g., a control). Figure 2 This is a schematic flowchart illustrating a NandFlash management method according to an embodiment of the present invention. Figure 2 As shown, a NandFlash management method according to an embodiment of the present invention begins with step S1.
[0017] In step S1, the management information area of NandFlash is obtained.
[0018] NandFlash management information acquisition requires reading information such as the substrate management header, physical block management table, and logical block management table from the management information area, and reconstructing the corresponding management information data structures in memory. The detailed process for this step is as follows: Figure 3 As shown.
[0019] Step S11: Starting from the first block of the NandFlash substrate management information redundancy block, if any information in the corresponding data's ECC check, CRC check, or substrate availability identifier is incorrect, the management information stored in the current block is considered invalid, and the corresponding data in the next block is read. This process continues until correct and valid management information is found in the first mgr_n blocks.
[0020] Step S12: If correct and valid management information is read and the NandFlash operation interface is usable, then perform corresponding processing according to the power-on or reset state of the hardware system to which the NandFlash belongs: If it is powered on, the management information read from NandFlash is used directly, and the read management information data is copied into memory. If the system is in a reset state, a CRC check is performed on the management information in memory before the reset. If the CRC check fails, the management information read from NandFlash is used. If the CRC check passes, the current management information in memory is used, and the system is compared with the management information read from NandFlash. If they do not match, the current management information in memory is written back to the NandFlash management information area.
[0021] Step S13: If all blocks (a total of mgr_n) in the management information area have been read and no correct and valid management information has been found, then this NandFLash chip is considered to be being used for the first time since leaving the factory. The management information needs to be rebuilt, and the corresponding data structures for the substrate management header, physical block management table, and logical block management table need to be established in memory. The specific steps are as follows: Establish a physical block management table to identify all blocks in the data area as unused; Based on the configuration parameters (number of mapped logical blocks in a single substrate, number of substrates), a logical block management table is established. Next, the physical block management table is searched, and unused blocks are selected from front to back as the actual storage units corresponding to the logical blocks. That is, the mapping relationship between logical blocks and physical blocks is established, and the logical blocks are marked as unused. The corresponding linked physical blocks are marked as used in the physical block management table. Set the corresponding substrate's available flag to initialized.
[0022] After step S13 is completed, the management information is considered valid and the initialization is successful.
[0023] NandFLash stores management information data in multiple redundant copies. Specifically, `info_n` copies are stored in the first `mgr_n` good blocks of the management information area. When writing management information data, all blocks containing the data are updated sequentially. If a bad block is detected during the update, the next available good block in the management information area is selected to replace it. This process continues until all blocks in the management information area become unusable. After this, the number of redundant backups of the management information is less than `info_n`.
[0024] The NandFlash management method of this invention supports two management information write-back modes: real-time write-back and delayed write-back. Real-time write-back: When the management information content changes, the substrate management information write-back flag is set to TRUE after the current NandFlash operation is completed and before exiting. Delayed write-back: The user-defined write-back timing is used; the substrate management information write-back flag is set to TRUE when write-back is required. The default write-back mode can be configured by the user in the macro definition and can be dynamically switched during software operation. When the software detects that the substrate management information write-back flag is TRUE, it automatically writes the updated management information data in memory back to the NandFlash.
[0025] like Figure 1 As shown, the NandFlash storage device divides multiple substrates into GROUP type (i.e., GROUP area) and SINGLE type (i.e., SINGLE area). Multiple GROUP areas serve as backups for each other. Depending on the number of NandFlash storage device substrates and the amount of data to be stored, a primary backup mode, a three-out-of-two mode, or a five-out-of-three mode can be selected. The primary backup mode means that one NandFlash contains two areas of type GROUP, which read data from either the primary or backup GROUP area. The three-out-of-two mode means that one NandFlash contains three areas of type GROUP (e.g., ...). Figure 1 The method reads data from three GROUP areas respectively. If the data read from two of the GROUP areas is consistent, but the data read from the other GROUP area is inconsistent, the consistent data shall prevail. The three-out-of-five method means that a NandFlash contains five areas of type GROUP, and the reading principle is the same as the two-out-of-three method.
[0026] by Figure 1 For example, the 8 substrates are divided into 4 areas. Substrate 1 and substrate 2 are area A with the block attribute GROUP, substrate 3 and substrate 4 are area B with the block attribute GROUP, substrate 5 and substrate 6 are area C with the block attribute GROUP, and substrate 7 and substrate 8 are area 0 with the block attribute SINGLE.
[0027] The substrate replacement method for GROUP type (block attribute is GROUP) is as follows: First, use the available blocks within this substrate for replacement; If there are no usable blocks in this substrate, then usable blocks from other substrates in this area will be used for replacement; If there are no available blocks in this area, then use available blocks from the SINGLE class (block attribute is SINGLE) substrate for replacement; If there are no available blocks within a base layer with the SINGLE attribute, an error is returned.
[0028] The requirements for replacing a SINGLE type substrate are: Replacement is performed using blank blocks within the substrate identified as SINGLE; If there are no available blocks within the SINGLE class base, an error is returned.
[0029] In step S2, the flag bit is used to determine whether a read operation, write operation, refresh operation, repair operation, maintenance operation, and consistency maintenance operation are required, and the corresponding operation is executed when the determination result is yes.
[0030] Figure 4 This is a schematic flowchart of step S2. For example... Figure 4 As shown, the system determines whether a read operation is needed based on flag bits. If the NandFlash read flag is enabled, a NandFlash read operation is initiated in the idle task. After the read operation is completed, the system determines whether a write operation is needed based on the flag bits. If the NandFlash read flag is disabled, the system determines whether a write operation is needed based on the flag bits. If the NandFlash write flag is enabled, a NandFlash write operation is initiated in the idle task. After the write operation is completed, the system determines whether a refresh operation is needed based on the flag bits. If the NandFlash write flag is disabled, the system determines whether a refresh operation is needed based on the flag bits. If the NandFlash refresh flag is enabled, a NandFlash refresh operation is initiated in the idle task. After the refresh operation is completed, the system determines whether a repair operation is needed based on the flag bits. If the NandFlash refresh flag is disabled, the system determines whether a repair operation is needed based on the flag bits. If the NandFlash repair flag is enabled, the NandFlash repair operation is started in the idle task. After the repair operation is completed, the flag is used to determine whether maintenance operation is needed. If the NandFlash repair flag is disabled, the flag is used to determine whether maintenance operation is needed. If the NandFlash maintenance flag is enabled, the NandFlash maintenance operation is started in the idle task. After the maintenance operation is completed, the flag is used to determine whether consistency maintenance operation is needed. If the NandFlash maintenance flag is disabled, the flag is used to determine whether consistency maintenance operation is needed.
[0031] A read operation refers to reading data of a specified length from a specified location in NandFlash and transferring it to a specified address in memory. In this embodiment of the invention, the read operation is performed in cycles, with each cycle reading a maximum of `read_step` words. Here, the cycle refers to the control cycle (e.g., 64ms) inherent in the software running in the onboard real-time operating system. Each cycle first executes the main software task, and the remaining time is used to execute system management tasks and idle tasks. The NandFlash management method in this embodiment of the invention runs within either the system management task or the idle task. Users can configure whether to use ECC verification.
[0032] If there is no ECC verification, the original data will be copied directly. The original data refers to the data read from NandFlash.
[0033] If software or hardware ECC verification is used, determine whether the data is correctable. If the data is correctable, use the verified data and set the corresponding block attribute to correctable; otherwise, directly copy the original data and set the corresponding block temporary attribute to uncorrectable.
[0034] Once all NandFlash read operations are complete, set the NandFlash read flag to disabled.
[0035] A write operation refers to writing data of a specified length from a specified address in memory to a specified location in NandFlash. The write operation process is as follows: Determine the NandFlash address: if it is the block start address, proceed from step a to step c; otherwise, proceed from step b to step c.
[0036] Step a: Locate new available physical blocks and perform an erase operation on the available physical blocks; Step b: Perform the data write operation, writing write_step words each time; Step c: Perform the attribute update operation, specifically: update the physical block link attribute in the logical block management table, keep other attributes in the logical block management table unchanged, update the physical block management table, mark the original physical block as unused, and change the current physical block to used.
[0037] Next, error handling during the search for available physical blocks: If erasing a physical block marked as unused fails, mark it as used and continue searching for and erasing the next available physical block. If no available physical block is found, the write operation is stopped and the NandFlash write flag is set to disabled.
[0038] Once all NandFlash write operations are complete, set the NandFlash write flag to disabled.
[0039] The purpose of the refresh operation is to detect correctable and uncorrectable errors occurring in the NandFlash. The specific process of the refresh operation is as follows: The software refreshes (reads) a number of words per cycle; If an error is detected on the current page during the NandFlash refresh process, the error is recorded and the refresh continues from the next page. If all page errors in the current block are correctable, the block's temporary attribute is set to correctable; otherwise, it is set to uncorrectable, and the logical block management table and physical block management table are updated. Once all valid NandFlash flashes have been refreshed, set the NandFlash refresh flag to disabled.
[0040] The repair operation refers to restoring blocks that have been marked as errors (including both correctable and uncorrectable types) during the refresh process to correct data blocks. The specific process of the repair operation is as follows: The blocks marked as errors (correctable or uncorrectable) in the logical block management table during the refresh process are restored sequentially, with only one step executed per cycle: Read back data: Copy the corresponding block of data to the specified data buffer, reading read_step words at a time; Locate available physical blocks and perform an erase operation on them; Data writing: Write the most recently read read_step words to the available physical space after the erase operation has been completed, writing write_step words in a single operation; Attribute Update: Update the physical block link attribute in the logical block management table, while keeping other attributes unchanged; update the physical block management table to mark the original physical block as unused and the current physical block as used.
[0041] Error handling during the readback process in the repair operation: Errors can be corrected by directly using the data that has been read and verified by ECC. Uncorrectable errors: Determine if the corresponding block data attribute is a single copy. If it is a single copy, it cannot be repaired. If a backup exists, restore the data according to the backup read or the 2 out of 3 principle. If the error of the page is confirmed to be uncorrectable after reading back the data, skip the block and continue to maintain the next block.
[0042] Error handling during the repair operation, specifically in the process of finding available physical blocks: If erasing a physical block marked as unused fails, mark it as used and continue searching for and erasing the next available physical block. If no usable physical block is found, the repair operation is stopped and the NandFlash maintenance flag is set to disabled.
[0043] After completing all the above NandFlash repair steps, set the NandFlash repair flag to disabled.
[0044] The difference between maintenance and repair operations is that maintenance operations do not need to determine whether the current logical block has been marked as an error, and can directly perform data readback and writeback operations on the logical blocks within the specified range in sequence.
[0045] Consistency maintenance refers to maintaining the block data in the 3-out-of-2 or 5-out-of-3 backup areas to be consistent. The specific steps are as follows: Based on the configuration parameters (the number of maintainable blocks within the group), maintenance operations are performed sequentially starting from the block with a logical block relative sequence number of 0, with only one step executed per cycle: Read back data: Copy the data of each corresponding block to the specified data buffer in sequence, and read read_step words at a time; Based on the grouping principle (two out of three or three out of five, etc.), generate unique and correct data. This step is to verify the data. Compare the consistency of the original data in each group with the data after verification, and mark the inconsistent blocks. If the data in the corresponding blocks in all groups are consistent, return to the step of reading back the data and perform the consistency maintenance operation for the next block. Otherwise, perform subsequent operations on the blocks marked as inconsistent. Locate available physical blocks and perform an erase operation on them; Data writing: Write_step words at a time, and the written data is the data after the above verification; Attribute Update: Update the physical block link attribute in the logical block management table, while keeping other attributes unchanged; update the physical block management table to mark the original physical block as unused and the current physical block as used.
[0046] After all inconsistent blocks have been maintained, return to the step of reading back the data and execute the consistency maintenance operation for the next block.
[0047] During consistency maintenance operations, error handling and repair are consistent during the readback process and the process of finding available physical blocks.
[0048] Once all NandFlash consistency maintenance is complete, set the NandFlash consistency maintenance flag to disabled.
[0049] The NandFlash redundant storage mechanism of this invention prevents single points of failure and can automatically identify, correct, and recover erroneous data. The NandFlash management method and apparatus based on the redundant storage mechanism can improve the data transmission efficiency of NandFlash storage devices, promptly detect erroneous data, and correct and recover erroneous data in a timely manner through repair, maintenance, and consistency maintenance functions. This enhances the integrity, reliability, and lifespan of satellite on-orbit data and improves the on-orbit maintenance capability of satellite NandFlash data storage units. Furthermore, the method of this invention can be implemented using lightweight computer program code and is executed only in idle tasks or system management tasks. Each time an idle task or system management task is entered, only one page of NandFlash is operated, without occupying the execution time of other critical tasks. This allows the method of this invention to promptly identify NandFlash data anomalies and recover erroneous data without affecting the normal operation of critical tasks, ensuring highly reliable storage of program code, status data, and critical task data. It also improves the operating efficiency of the onboard control computer and ensures the correctness of stored data.
[0050] In summary, this invention addresses the shortcomings of existing NandFlash management technology, overcomes the challenges of large-capacity, high-reliability satellite storage, and increases the capacity for securely stored star maps, intelligent network models, and other data. These advantages enable this invention to adapt to the development of intelligent space applications, making it particularly suitable for fields such as aerospace and industrial control that require high-reliability, large-capacity storage.
[0051] This invention also provides a NandFlash management device, such as... Figure 5 As shown, the device includes an information acquisition unit 1 and an operation execution unit 2.
[0052] Information acquisition unit 1 is adapted to acquire the management information area and virtual address mapping table of NandFlash.
[0053] The operation execution unit 2 is adapted to determine whether a read operation, write operation, refresh operation, repair operation, maintenance operation, and consistency maintenance operation are required based on the flag bit, and execute the corresponding operation when the determination result is yes.
[0054] In a preferred embodiment of the present invention, the management information area for obtaining NandFlash includes: Read management information from the redundant block of NandFlash substrate management information; If correct and valid management information is read, then appropriate action is taken based on the system's power-on or reset status. If no correct and valid management information is read, rebuild the management information.
[0055] In a preferred embodiment of the present invention, the read operation includes: Read a maximum of read_step words per cycle, and determine whether ECC verification is needed after each cycle is completed; If ECC verification is not required, then directly copy the data read in the current cycle; If ECC verification is required and the data is correctable, use the verified data and set the corresponding block attribute to correctable. If ECC verification is required but the data is not correctable, directly copy the original data and set the corresponding block temporary attribute to uncorrectable. After all cycles of reading are completed, set the NandFlash read flag to disabled.
[0056] In a preferred embodiment of the present invention, the write operation includes: Determine if the NandFlash address is the block start address; If so, find new available physical blocks and perform an erase operation on them, writing write_step words in a single operation, and updating the logical block management table and the physical block management table; If not, write_step words at a time and update the logical block management table and physical block management table. After the NandFlash write operation is completed, set the NandFlash write flag to disable.
[0057] In a preferred embodiment of the present invention, the refresh operation includes: Each refresh read_step characters, and the current page is checked during the refresh process; If an error is detected on the current page, record the error and continue refreshing from the next page; If all page errors in the current block are correctable, set the block's temporary attribute to correctable; otherwise, set it to uncorrectable and update the logical block management table and physical block management table. After all valid NandFlash flashes have been refreshed, set the NandFlash refresh flag to disabled.
[0058] In a preferred embodiment of the present invention, the repair operation includes: During the refresh process, blocks marked as erroneous in the logical block management table are restored sequentially: Blocks marked as erroneous data during the refresh process are processed and restored to correct data blocks; Physical blocks that fail to be erased during the repair process are marked as used; Update the logical block management table and the physical block management table; After all NandFlash repairs are completed, set the NandFlash repair flag to disabled.
[0059] In a preferred embodiment of the present invention, the maintenance operation includes: Perform data readback and writeback operations sequentially on logical blocks within a specified range; Update the logical block management table and the physical block management table; Once all NandFlash maintenance is complete, set the NandFlash maintenance flag to disabled.
[0060] In a preferred embodiment of the present invention, the consistency maintenance operation includes: Based on the configuration parameters, consistency maintenance operations are performed sequentially, starting with the block whose logical block relative sequence number is 0. Handle erroneous data during the consistency maintenance process; Physical blocks that fail to be erased during consistency maintenance are marked as used. Update the logical block management table and the physical block management table; Once all NandFlash consistency maintenance is complete, set the NandFlash consistency maintenance flag to disabled.
[0061] This invention also provides an electronic device, comprising: Memory 3; Multiple processors 4; and Computer program instruction 5; The computer program instructions 5 are stored in the memory 3 and configured to be executed by the processor 4 to implement the method described in the embodiments of the present invention.
[0062] Figure 6 A schematic diagram of an electronic device according to an embodiment of the present invention is shown. It should be noted that... Figure 6 The electronic device shown is merely an example. In practice, the electronic device used to implement the NandFlash management method of this invention can be any type of device, and its hardware configuration can be similar to... Figure 6 The electronic devices shown may be the same or different. In practice, the electronic devices used to implement the NandFlash management method of this invention can be... Figure 6 The hardware components of the electronic device shown may be added or removed. This invention does not limit the specific hardware configuration of the electronic device.
[0063] like Figure 6As shown, the electronic device mainly includes a memory 3 and one or more processors 4. Here, the memory 3 refers to any memory other than the NandFlash, the object of management in the NandFlash management method of this embodiment. A memory bus can be used for communication between the processors 4 and the memory 3.
[0064] Processor 6 can be any type of processor, including but not limited to: microprocessor, microcontroller, digital signal processor, or any combination thereof.
[0065] Memory 3 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. Memory 3 stores computer program instructions 5 capable of executing the above-described NandFlash management method, and processor 4 is capable of reading and executing the above-described computer program instructions 5 from memory 3.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A NandFlash management method, characterized in that, NandFlash storage area is divided into multiple substrates, each substrate is divided into multiple blocks, each block is divided into multiple pages, and all substrates are divided into one or more SINGLE areas and one or more GROUP areas, with multiple GROUP areas serving as backups for each other; The method includes: Obtain the management information area of NandFlash; The system determines whether a read operation, write operation, refresh operation, repair operation, maintenance operation, or consistency maintenance operation is required based on the flag bit, and executes the corresponding operation if the result is yes.
2. The method according to claim 1, characterized in that, The NandFlash management information area includes: Read management information from the redundant block of NandFlash substrate management information; If correct and valid management information is read, then appropriate action is taken based on the system's power-on or reset status. If no correct and valid management information is read, rebuild the management information.
3. The method according to claim 1, characterized in that, The read operation includes: Read a maximum of read_step words per cycle, and determine whether ECC verification is needed after each cycle is completed; If ECC verification is not required, then directly copy the data read in the current cycle; If ECC verification is required and the data is correctable, use the verified data and set the corresponding block attribute to correctable. If ECC verification is required but the data is not correctable, directly copy the original data and set the corresponding block temporary attribute to uncorrectable. After all cycles of reading are completed, set the NandFlash read flag to disabled.
4. The method according to claim 1, characterized in that, The write operation includes: Determine if the NandFlash address is the block start address; If so, find new available physical blocks and perform an erase operation on them, writing write_step words in a single operation, and updating the logical block management table and the physical block management table; If not, write_step words at a time and update the logical block management table and physical block management table. After the NandFlash write operation is completed, set the NandFlash write flag to disable.
5. The method according to claim 1, characterized in that, The refresh operation includes: Each refresh read_step characters, and the current page is checked during the refresh process; If an error is detected on the current page, record the error and continue refreshing from the next page; If all page errors in the current block are correctable, set the block's temporary attribute to correctable; otherwise, set it to uncorrectable and update the logical block management table and physical block management table. After all valid NandFlash flashes have been refreshed, set the NandFlash refresh flag to disabled.
6. The method according to claim 5, characterized in that, The repair operation includes: During the refresh process, blocks marked as erroneous in the logical block management table are restored sequentially: Blocks marked as erroneous during the refresh process are processed and restored to correct data blocks; Physical blocks that fail to be erased during the repair process are marked as used; Update the logical block management table and the physical block management table; After all NandFlash repairs are completed, set the NandFlash repair flag to disabled.
7. The method according to claim 1, characterized in that, The maintenance operations include: Perform data readback and writeback operations sequentially on logical blocks within a specified range; Update the logical block management table and the physical block management table; Once all NandFlash maintenance is complete, set the NandFlash maintenance flag to disabled.
8. The method according to claim 1, characterized in that, The consistency maintenance operations include: Based on the configuration parameters, consistency maintenance operations are performed sequentially, starting with the block whose logical block relative sequence number is 0. Handle erroneous data during the consistency maintenance process; Physical blocks that fail to be erased during consistency maintenance are marked as used. Update the logical block management table and the physical block management table; Once all NandFlash consistency maintenance is complete, set the NandFlash consistency maintenance flag to disabled.
9. A NandFlash management device, characterized in that, NandFlash storage area is divided into multiple substrates, each substrate is divided into multiple blocks, each block is divided into multiple pages, and all substrates are divided into one or more SINGLE areas and one or more GROUP areas, with multiple GROUP areas serving as backups for each other; The device includes: The information acquisition unit is suitable for acquiring the management information area and virtual address mapping table of NandFlash; The operation execution unit is adapted to determine whether a read operation, write operation, refresh operation, repair operation, maintenance operation, or consistency maintenance operation is required based on a flag bit, and executes the corresponding operation when the determination result is yes.
10. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1 to 8.