System protection method for abnormal bit flipping of Nand Flash
By detecting and correcting bit flip problems in Nand Flash's UBI file system, moving data and remapping logical blocks, the system exceptions caused by bit flips under extreme conditions are solved, and the system is effectively implemented based on Nand Flash storage Protect.
Patent Information
- Application Number
- CN202411516317.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-29
AI Technical Summary
Nand Flash may have bit flips on data blank pages under extreme conditions, causing the UBI file system to enter the exception processing process, and the system forces the switch to read-only mode, affecting normal write operations.
After the UBI file system detects that the data blank area of the Nand Flash physical block has been flipped, the data is corrected by counting the number of bits and rewriting the blank area to 0xff. Then the data is moved to the spare block and wiped the empty and Read and write tests, mark bad blocks or put them in a list of spare blocks, remapping logical blocks to achieve continuity of storage space.
It effectively deals with the bit flip problem of Nand Flash physical blocks, avoids the system entering read-only mode, ensures the normal write operation of Nand Flash, and protects the system based on Nand Flash storage.
Smart Images

Figure CN119473700A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of embedded devices, and specifically designs a system protection method for Nand Flash abnormal bit flipping. Background Art
[0002] Nand Flash is a commonly used storage medium for embedded devices. It generally has the problem of bit flipping. Nand Flash itself provides ECC check at the driver layer to correct a certain degree of bit flipping. When writing data to a Nand Flash page, an original ECC checksum will be generated at the same time. When reading the data of this page later, this ECC data will be used to check and repair the data errors. Therefore, since the blank page has no data written, ECC data will not be stored. However, under some extreme conditions, these blank pages of Nand Flash data will also have bit flipping. When reading data from Flash, the UBI file system based on Nand Flash will detect the valid data area and the data blank area at the same time. When the data blank area is detected to have bit flipping, there is no corresponding ECC code to correct the data, so the UBI file system will enter the exception handling process and force the system to switch to read-only mode for protection. At this time, the normal write operation to Nand Flash will fail, resulting in system abnormality. Therefore, how to effectively solve the various impacts that Nand Flash bit flipping may cause to the system has also become a major issue in the application of Nand Flash in embedded systems. Summary of the invention
[0003] The present invention provides a system protection method for Nand Flash abnormal bit flipping, which can effectively solve the problems in the background technology.
[0004] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0005] A system protection method for Nand Flash abnormal bit flipping includes the following steps:
[0006] S100, after the UBI file system detects that a bit flip occurs in a data blank area of a physical block of the Nand Flash, the number of bit flips is counted and all blank areas of the physical block where the bit flip occurs are set to 0xff, thereby correcting the bit flip;
[0007] S200, moving the data of the physical block (including the valid data area and the corrected data blank area) to a spare block;
[0008] S300, erase the original block, check whether it is completely erased and perform additional read / write tests. If it has been erased and the read / write tests are normal, the physical block is put into the spare block list for subsequent use. If it is detected that it cannot be completely erased or the bit flip problem still occurs during the read / write test, the block is marked as a bad block at the MTD layer and stored in the bad block table to avoid next use;
[0009] S400, cancel the mapping between the logic block and the original bit-flipped physical block, enable the spare block for moving data, and remap the original corresponding logic block to the spare block, thereby achieving the continuity of the file system storage space.
[0010] It can be seen from the above technical solution that the system protection method for Nand Flash abnormal bit flipping of the present invention has the following features:
[0011] Beneficial effects:
[0012] When a bit flip occurs in a blank area of a physical block of Nand Flash in a harsh environment, the problem block can be effectively processed by actively correcting the bit flip and moving data, thereby avoiding the failure of the file system entering the exception handling program and the system being forced to change to read-only mode due to the lack of ECC data for repair. The present invention effectively protects the system based on Nand Flash storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0014] Figure 1 is a flow chart of the present invention;
[0015] Figure 2 It is a schematic diagram of the method of the present invention; DETAILED DESCRIPTION
[0016] The present invention will be further described below in conjunction with the accompanying drawings.
[0017] like Figure 1 As shown, the system protection method for Nand Flash abnormal bit flipping described in this embodiment includes the following steps:
[0018] S100, after the UBI file system detects that a bit flip occurs in a data blank area of a physical block of the Nand Flash, the number of bit flips is counted (because the flips in the blank area are all 1 to 0) and the blank area of the physical block where the bit flip occurs is rewritten with 0xff, thereby correcting the bit flip;
[0019] S200, moving the data of the physical block (including the valid data area and the corrected data blank area) to a spare block;
[0020] S300, erase the original block, check whether it is completely erased and perform additional read / write tests. If it has been erased and the read / write tests are normal, the physical block is put into the spare block list for subsequent use. If it is detected that it cannot be completely erased or the bit flip problem still occurs during the read / write test, the block is marked as a bad block at the MTD layer and stored in the bad block table to avoid next use;
[0021] S400, cancel the mapping between the logic block and the original bit-flipped physical block, enable the spare block for moving data, and remap the original corresponding logic block to the spare block, thereby achieving the continuity of the file system storage space.
[0022] Figure 2 It is the principle diagram of the method of the present invention, and the following is combined with Figure 2 The operating principle of the embodiment of the present invention is described in detail:
[0023] When the UBI file system detects that a bit flip occurs in a data blank area of a physical block when reading Nand Flash data, the present invention does not enter an exception processing flow even if there is no ECC data for correction. Instead, the present invention utilizes the characteristic that the data in the blank area is all 0xff, that is, the bit flips are all flipped from 1 to 0, and can rewrite 0xff in the non-0xff area for correction.
[0024] Since it is uncertain whether the flip is accidental or permanent and irreparable, that is, it is uncertain whether the block is usable after correction, it is necessary to move the repaired block data to the spare block completely to avoid data loss, and then perform an erase test on the original block. It should also be noted that if the original block has an irreparable bit flip, the operation of rewriting 0xff to the original block may fail, but the original block data that can still be repaired will be stored in the spare block, because the file system will still perform the same detection and repair operation when remapping and reading the spare block data later, and the flipped bit data will be repaired in the spare block.
[0025] Re-erase the original flipped block and perform additional read and write tests to evaluate the availability of this block. If it can be completely erased and the test data is read and written normally, it is considered that an accidental bit flip occurred, and the block is marked as a spare block and put into the spare block list, waiting to be reused when the UBI file system performs load balancing or bad block processing. If it is detected that the data cannot be erased or the read and write data verification is abnormal, it is considered that this block has a permanent and unrepairable bit flip problem, and it is necessary to mark this block as a bad block at the MTD layer, store it in the bad block list and no longer use it.
[0026] Finally, the logical mapping between the UBI file system logical block and the original flipped block is canceled, and the spare block for the moved data is enabled, and the original corresponding logical block is remapped to this spare block. In this way, the original data is preserved and the flipped block is replaced, ensuring the continuity of the file system storage space.
[0027] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A system protection method for Nand Flash abnormal bit flipping, characterized by: The following steps are involved: S100, after the UBI file system detects that a bit flip occurs in a data blank area of a physical block of the Nand Flash, the number of bit flips is counted and the blank area of the physical block where the bit flip occurs is rewritten with 0xff to correct the bit flip; S200, moving the data of the physical block (including the valid data area and the corrected data blank area) to a spare block; S300, erase the original block, check whether it is completely erased and perform additional read / write tests. If it has been erased and the read / write tests are normal, the physical block is put into the spare block list for subsequent use. If it is detected that it cannot be completely erased or the bit flip problem still occurs during the read / write test, the block is marked as a bad block at the MTD layer and stored in the bad block table to avoid next use; S400, cancel the mapping between the logic block and the original bit-flipped physical block, enable the spare block for moving data, and remap the original corresponding logic block to the spare block, thereby achieving the continuity of the file system storage space.
Citation Information
Patent Citations
PairBlock erasure error processing method and device
CN108038064A
Data storage method based on NAND FLASH, terminal device and storage medium
CN109343790A
Automatic mounting method for UBI equipment
CN111026447A
Nand-flash page bit flipping control method and Nand-flash page bit flipping control module
CN111737042A
Method and system for storage of data in non-volatile media
US20090150599A1