Disclosure of Invention
In order to reduce the damage loss of NAND FLASH bad block data, the application provides a NAND FLASH bad block data rereading method, electronic equipment and storage medium.
In a first aspect, the method for rereading NAND FLASH bad blocks provided by the present application adopts the following technical scheme:
NAND FLASH method for re-reading data in bad blocks, comprising the following steps:
When detecting that bad blocks appear, adding the bad blocks into a bad block queue;
When the real-time state of the main control chip is in an idle state, acquiring all re-reading threshold voltages, and sequentially re-reading bad blocks in a bad block queue by adopting the re-reading threshold voltages;
and when the data in the bad block is successfully read or the real-time state of the main control chip is changed into a non-idle state, ending the re-reading of the current bad block.
By adopting the technical scheme, under the idle state, the bad blocks are subjected to READ RETRY by adopting all re-reading threshold voltages, the response time of normal use of Flash is not occupied, the damage and loss of data are reduced, and the reliability is improved.
Preferably, the step of adding the bad block to the bad block queue after detecting the occurrence of the bad block includes: when a flash memory block which can not read data normally is detected, READ RETRY is carried out on the flash memory block which can not read data based on a preset retry parameter set;
If the flash block READ RETRY fails, the flash block is marked as a bad block and the bad block is added to a bad block queue.
By adopting the technical scheme, after the unreadable flash memory block is detected, READ RETRY is carried out on the bad block based on the preset retry parameter set, if the bad block is failed, the bad block is added into the bad block queue, and the bad block which can be reread in the allowed response time is marked as unreadable, so that the reliability of data is improved, and the workload when reread is carried out in an idle state is reduced.
Preferably, all re-read threshold voltages are obtained by: and taking the experience value selected from the rereading threshold voltage as a center, shifting the experience value to the periphery, and traversing to obtain the rereading threshold voltage.
By adopting the technical scheme, the experience value is preset, and when the rereading threshold voltage is read in a traversing way, the experience value is taken as the initial rereading threshold voltage, so that the time for traversing to the correct rereading threshold voltage can be reduced, and the response time can be shortened.
Preferably, the empirical value is selected in the following manner: re-reading the flash memory block which cannot read data based on a preset retry parameter set, and recording a set of retry parameters with the minimum error data Bit after the flash memory block which cannot read data is subjected to READ RETRY based on the preset retry parameter set as an experience value.
By adopting the technical scheme, the parameter with the least error is obtained by traversing and rereading the parameters in the original retry parameter set, and the method has the effect of improving the accuracy of rereading threshold voltage acquisition.
Preferably, the obtaining the rereading threshold voltage by taking the empirical value selected from the rereading threshold voltages as a center and shifting the empirical value to the periphery includes: and traversing the initial rereading threshold voltage by taking the empirical value as the initial rereading threshold voltage in a manner of enumerating offset left and right in the rereading threshold voltage parameter set to obtain the rereading threshold voltage.
By adopting the technical scheme, the method of enumeration left and right is adopted, the rereading threshold voltage close to the experience value is gradually expanded outwards, the possibility of obtaining the correct rereading threshold voltage is high, and the time can be effectively shortened.
Preferably, if the data reading is successful when the current bad block is reread, the acquired data is moved to other good flash memory blocks, and the current bad block is removed from the bad block queue.
By adopting the technical scheme, the data in the bad block is moved after the bad block is successfully read, so that the data can be correctly taken out when the data is read next time, and the reliability is improved.
In a second aspect, the present application provides an electronic device, which adopts the following technical scheme:
an electronic device comprising a memory and a processor, the memory having stored thereon a computer program capable of being loaded by the processor and performing a method as in any of the preceding.
In a third aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme:
a computer readable storage medium storing a computer program capable of being loaded by a processor and executing a method as any one of the preceding.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings 1 to 6 and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The embodiment of the application discloses a method for re-reading data in NAND FLASH bad blocks, NAND FLASH is used for obtaining the data state in a Cell according to the conduction conditions of different threshold voltages by adding read voltage to the Cell when the read operation is carried out. In the case of different operating temperatures, the threshold voltage of the Cell shifts, and errors in the read data increase.
Referring to fig. 1, the method of re-reading data in a bad block includes the steps of:
S1: and when the occurrence of the bad block is detected, adding the bad block into a bad block queue.
S2: when the real-time state of the main control chip is in an idle state, acquiring all re-reading threshold voltages, and sequentially re-reading bad blocks in a bad block queue by adopting the re-reading threshold voltages.
S3: and when the data in the bad block is successfully read or the real-time state of the main control chip is changed into a non-idle state, ending the re-reading of the current bad block.
The set and read rereading threshold voltages are based on the principle described below, and referring to fig. 2, at normal temperature (t=27°), the threshold voltages are relatively large READ MARGINS.
At high temperature (t=90°), the Cell threshold distribution is shifted left overall (voltage becomes low), and at the same threshold voltage READ MARGINS becomes small, the threshold voltage at high temperature shifts, resulting in an increase in the probability of data errors.
At low temperature (T-40 °), the Cell threshold distribution is biased to the right (the voltage becomes high) as a whole, and READ MARGINS of the same threshold voltage becomes smaller, so that the probability of data error increases.
In order to solve the problem that the data errors are increased due to the fact that READ MARGINS is smaller due to the rereading threshold voltage distribution deviation at high and low temperatures, READ MARGINS is increased by adjusting the rereading threshold voltage at different temperatures, so that the data errors are less, and error correction can be performed.
Referring to fig. 3, the read rereading threshold voltage needs to be shifted to the left at high temperature and to the right at low temperature, and sample analysis is performed on NAND FLASH to increase the sets of dedicated READ RETRY parameter sets when the rereading threshold voltage is set.
The detection of the occurrence of bad blocks includes, but is not limited to, the following: 1. when the data is read and written normally, the data is read, and if the fact that the data cannot be read normally is detected, the flash memory block can be marked as a bad block; 2. when testing the reliability of NAND FLASH, quickly reading and writing data to the flash memory block, and if the data of the flash memory block cannot be read normally, marking the flash memory block as a bad block; 3. and marking the flash memory block as a bad block according to the detection result when the factory is detected at NAND FLASH. The term "unable to read normally" as used herein means that the flash memory block generates an error code or the error rate exceeds the ECC check range when reading data.
If a bad block is detected when NAND FLASH reads data, the bad block is added to the bad block queue. When NAND FLASH is in the idle state, all the re-reading threshold voltages are adopted, and the re-reading threshold voltages are adopted to sequentially re-read bad pages in the bad blocks. The bad blocks are added into a bad block queue in advance, the bad blocks are read by traversing the re-reading threshold voltage after waiting for the idle state, so that the data in the bad blocks are read, the response time of NAND FLASH in the non-idle state is shortened, and the damage and the loss of the data can be reduced.
And when the real-time state of the main control chip NAND FLASH is converted into a non-idle state or the data in the bad block is successfully reread, the reread of the current bad block is ended. If the real-time state of the main control chip of NAND FLASH is changed into a non-idle state, ending the rereading of the current bad block, and if the real-time state of the main control chip is changed into an idle state, continuing to reread the current bad block; if the data in the bad block is read again successfully, the bad block is deleted from the bad block queue, and the next bad block is read again continuously.
Referring to fig. 4, alternatively, as another embodiment, step S1 includes the sub-steps of:
S11: and when detecting that the flash memory block which can not read the data normally exists, carrying out READ RETRY on the bad block of the flash memory block which can not read the data based on the preset retry parameter group.
S12: if the flash block READ RETRY fails, the flash block is marked as a bad block and the bad block is added to a bad block queue.
In practical use, when data is read, a flash memory block which cannot be read normally is detected, and a preset retry parameter set for READ RETRY is used for rereading, wherein the number of parameters of the retry parameter set is smaller than that of parameters of a preset rereading threshold voltage parameter set. If the data in the flash memory blocks which cannot be read normally at the threshold voltage in the retry parameter set are the data, marking the flash memory blocks as bad blocks, adding the bad blocks into a bad block queue, and reducing the addition of the flash memory blocks which can be read again by the retry parameter set into the bad block queue, so that the readable data are misjudged as nonreactive; but in other embodiments the response time may be reduced by detecting a bad block, i.e., adding the bad block to the bad block queue.
Alternatively, as another embodiment, all re-read threshold voltages are obtained by:
and taking the experience value selected from the rereading threshold voltage as a center, shifting the experience value to the periphery, and traversing to obtain the rereading threshold voltage.
Specifically, the empirical value may be an optimal threshold voltage at the current operating temperature, but may also be other set values or values obtained through simple operation, and by setting the empirical value, when traversing the rereading threshold voltage, the possibility of obtaining the correct rereading threshold voltage is increased, and the traversing time is shortened.
The rereading threshold voltage is obtained in a traversing mode, so that the problem that the threshold voltage which cannot be covered by the retry parameter with fixed group number is offset can be solved, and the data which cannot be corrected originally can be corrected correctly.
Alternatively, as another embodiment, the empirical value is selected by: re-reading the flash memory block which cannot read data based on a preset retry parameter set, and recording a set of retry parameters with the minimum error data Bit after the flash memory block which cannot read data is subjected to READ RETRY based on the preset retry parameter set as an experience value.
When the real-time state of the main control chip is in an idle state, acquiring bad blocks in a bad block queue for traversing and reading, firstly, reading the cells in the bad blocks all at one time based on parameters in a preset retry parameter group, recording a group of retry parameters with the least error data Bit as experience values, and traversing the experience values from the traverse center to the periphery, so that the time of the bad blocks retry can be effectively shortened.
Alternatively, the time point of empirical value acquisition may be: 1. when data is read and written, detecting that a flash memory block cannot read the data normally, carrying out READ RETRY on the flash memory block based on a preset retry parameter set, and if the flash memory block cannot be read normally, recording an experience value while marking the flash memory block which cannot read the data normally as a bad block based on the parameter with the minimum error bit number in the retry parameter set in the reading as the experience value; 2. and under the condition that the main control chip is in an idle state, firstly re-reading the bad block based on the threshold voltage in the retry parameter set, and taking the parameter with the minimum error bit number in the retry parameter set in the reading as an empirical value.
Alternatively, as another embodiment, taking the empirical value selected from the rereading threshold voltages as a center, shifting the empirical value around to obtain the rereading threshold voltages includes: and traversing the initial rereading threshold voltage by taking the empirical value as the initial rereading threshold voltage in a manner of enumerating offset left and right in the rereading threshold voltage parameter set to obtain the rereading threshold voltage.
The initial re-read threshold voltage is the first threshold voltage to begin re-reading bad blocks in the idle state.
In specific implementation, MLC particles are taken as an example: one MLC WL consists of two pages LP and UP, R1, R2 and R3 represent three different read voltage register values (namely threshold voltages) of one Cell of MLC Flash, wherein the LP read voltage threshold offset is related to R2, the UP read voltage threshold offset is related to R1 and R3, and each threshold voltage adjustable range is [ -128,127].
Referring to fig. 5, for MLC LP, if the optimal threshold voltage offset R2 is-52 (data cannot be corrected, but the number of erroneous bits is the smallest under all R2 threshold voltage values), then, about this point, traversing 40 voltages to the left and right respectively, in such a way that R2-1, r2+1, R2-2, r2+ … R2-20, r2+20 are first traversed alternately, until RETRY PASS, data movement and rewriting are immediately enabled, ensuring that the data can be read correctly and correctly afterwards.
Referring to fig. 6, for MLC UP, assuming that the optimal threshold offset is (R1, R3) = (-23, -16), R1, R3 are respectively combined by ±20 based on the optimal threshold offset point, and full-combination alternate traversal is performed on (R1 [ -43, -3], R3[ -36,4 ]), traversing is performed until RETRY PASS, immediately enabling data movement and overwriting, and ensuring that data can be correctly read in the following steps.
Referring to fig. 4, optionally, as another embodiment, the method further includes the steps of:
S4: if the data reading is successful when the current bad block is reread, the acquired data is moved to other good flash memory blocks, and the current bad block is removed from the bad block queue.
When the current bad block is re-read, the data in the bad block is moved to other good flash memory blocks after the re-read is successful, so that the re-read data is prevented from being lost secondarily, the bad block is deleted by a storage queue, the reliability of NAND FLASH is improved, and the situation that the data in the bad block cannot be read again is reduced.
If the data cannot be read after traversing all the re-read threshold voltages, marking the bad block as non-error-correctable, and performing enumeration traversal error correction processing on the bad block later.
The embodiment also discloses an electronic device comprising a memory and a processor, the memory storing a computer program that can be loaded by the processor and that performs the method as described above.
The present embodiment also discloses a computer-readable storage medium storing a computer program capable of being loaded by a processor and executing the method as described above.
The above embodiments are not intended to limit the scope of the present application, so: all equivalent changes according to the method and principle of the present application should be covered by the protection scope of the present application.