Memory management method and memory controller
By detecting and resetting bad blocks in NAND flash memory and establishing a bad byte table, it solves the storage space waste and stability problems caused by the increase in bad blocks, and improves storage space utilization and data stability.
Patent Information
- Application Number
- CN202410764367.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-14
AI Technical Summary
NAND flash memory has an increase in bad blocks due to repeated erasing and usage, resulting in low storage space utilization and poor stability. Existing bad block management solutions waste a large amount of available storage space.
By detecting and predicting bad storage units in physical blocks in advance, resetting the physical addresses of bad blocks, establishing a bad byte table, and recycling bad blocks into normal physical blocks to store data, it improves storage space utilization and stability.
It effectively avoids the occurrence of data errors, reduces the error correction load, and improves storage space utilization efficiency and overall work efficiency.
Smart Images

Figure CN118363883B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a memory management technology, and in particular to a memory controller for a storage device equipped with a non-volatile memory and a memory management method used therein. Background Art
[0002] Non-volatile memory refers to computer memory whose stored data does not disappear when the current is cut off. It has the advantages of non-volatility, power saving, small size and no mechanical structure, and is widely used in various electronic devices.
[0003] However, due to the process limitations of NAND flash memory, repeated erasing or long-term use of the same physical block can easily lead to block damage, resulting in errors in the stored data.
[0004] Therefore, bad block management is necessary to use NAND flash memory. Bad blocks that cannot be corrected will be discarded, and data will be saved in good blocks of NAND flash memory. However, when some physical blocks of NAND flash memory reach the end of their lifespan quickly due to the use time or the imperfect FTL algorithm, more and more bad blocks are generated, which will eventually lead to insufficient good blocks of storage products and make them unusable. Existing bad block management solutions waste a large amount of available storage space and urgently need to be improved. Summary of the invention
[0005] The purpose of the present invention is to solve the above-mentioned problem. It can pre-detect / predict bad storage cells in a physical block, reset the physical addresses of multiple storage cells in each bad block to avoid the probability of storage data errors, recycle each bad block into a normal physical block to store data, improve the utilization of storage space and improve the stability and operating efficiency of the storage device.
[0006] One or more embodiments of the present invention provide a memory management method, comprising: selecting a target bad block from one or more bad blocks of a rewritable non-volatile memory module to write first data; reading the target bad block to obtain second data, and comparing the first data and the second data to determine one or more error byte positions; establishing a bad byte table based on the one or more error byte positions; resetting multiple physical addresses of multiple storage units of each bad block of a target plane to which the target bad block belongs based on the bad byte table; and setting each reset bad block of the target plane as a normal physical block to store data.
[0007] In one or more embodiments of the present invention, the rewritable nonvolatile memory module has a plurality of planes, and the processor selects the target bad block from each plane to establish the bad byte table corresponding to each plane.
[0008] In one or more embodiments of the present invention, the target bad block is selected in a random manner, wherein the content of the first data is a plurality of pre-set bit values, and the plurality of bit values are set to one of the following states: all are the same first value or second value; and the first value and the second value are randomly arranged.
[0009] In one or more embodiments of the present invention, it also includes: writing multiple first data with different patterns to the target bad block, obtaining multiple second data corresponding to the multiple first data by reading the target bad block, so as to obtain multiple groups of one or more error byte positions corresponding to the multiple first data; analyzing the multiple groups of one or more error byte positions to determine whether the error byte pattern of the target bad block is a regular pattern or an irregular pattern; and establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern.
[0010] In one or more embodiments of the present invention, if the address difference between two adjacent error byte positions in each group of one or more error byte positions is a fixed value, the error byte pattern is determined to be the regular pattern; and if the address difference between two adjacent error byte positions in each group of one or more error byte positions is not a fixed value, the error byte pattern is determined to be the irregular pattern.
[0011] In one or more embodiments of the present invention, if the error byte pattern is the regular pattern, in the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern, the bad byte table is established according to the first error byte position in each group of one or more error byte positions and the fixed value.
[0012] In one or more embodiments of the present invention, if the error byte pattern is the irregular pattern, in the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern, the total number of times each error byte position occurs in the multiple groups of one or more error byte positions is counted; all error byte positions are sorted from large to small according to the total number of times of each error byte position; and from the multiple sorted error byte positions, starting from the first error byte position, a maximum of N error byte positions are selected and recorded into the bitmap corresponding to the target plane to establish the bad byte table, where N is a predetermined number of redundant bytes.
[0013] In one or more embodiments of the present invention, it also includes: recording the total number of times each error byte position occurs, and obtaining one or more target error byte positions based on the bitmap and the total number of times each error byte position occurs, wherein the total number of times the one or more target error byte positions occurs is greater than a first threshold.
[0014] In one or more embodiments of the present invention, it also includes: in the operation of resetting the multiple physical addresses of the multiple storage units possessed by each bad block of the target plane to which the target bad block belongs according to the bad byte table, comparing the multiple physical addresses that have been set to the multiple storage units and the one or more target error byte positions to obtain one or more first physical addresses corresponding to the one or more target error byte positions among the multiple physical addresses and a plurality of second physical addresses that do not correspond to the one or more target error byte positions among the multiple physical addresses; setting the multiple second physical addresses and one or more third physical addresses to the multiple storage units in sequence, wherein the one or more third physical addresses belong to a plurality of redundant physical addresses of a redundant area of each physical block.
[0015] In one or more embodiments of the present invention, based on the total number of one or more fourth physical addresses that are not the one or more third physical addresses among the multiple redundant physical addresses, the first error correction capability of each physical block of the target plane is increased to a second error correction capability so as to adjust the size of the generated error correction data from the first size to the second size.
[0016] One or more embodiments of the present invention provide a memory controller for controlling a storage device configured with a rewritable non-volatile memory module. The memory controller includes: a memory interface control circuit for electrically connecting to the rewritable non-volatile memory module; and a processor electrically connected to the memory interface control circuit, wherein the processor is further electrically connected to a connection interface circuit of the storage device to electrically connect to a host system. The processor is configured to: select a target bad block from one or more bad blocks of the rewritable non-volatile memory module to write first data; read the target bad block to obtain second data, and compare the first data and the second data to determine one or more error byte positions; establish a bad byte table according to the one or more error byte positions; reset multiple physical addresses of multiple storage units of each bad block of a target plane to which the target bad block belongs according to the bad byte table; and set each reset bad block of the target plane as a normal physical block to store data.
[0017] Based on the above, the memory controller and memory management method provided by the embodiment of the present invention can find out the position of the error byte of each physical block to establish a bad byte table, and reset the multiple physical addresses of each physical block according to the bad byte table, so that the reset physical block has a relatively stable multiple physical addresses, thereby improving the stability of the stored data, avoiding the occurrence of erroneous data, and reducing the load of error correction. In addition, the reset bad blocks are recovered to increase storage space. It can be seen that the present invention significantly improves the storage space utilization efficiency of the storage device and greatly improves the overall work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are included to provide a further understanding of the present invention and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the present invention and together with the description serve to explain the principles of the present invention.
[0019] Figure 1 is a block diagram of a host system and a storage device according to an embodiment of the present invention;
[0020] Figure 2 is a flowchart of a memory management method according to an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of determining one or more error byte positions according to an embodiment of the present invention;
[0022] Figure 4 A schematic diagram of establishing a bad byte table according to an embodiment of the present invention;
[0023] Figure 5 A schematic diagram of determining one or more error byte positions according to another embodiment of the present invention;
[0024] Figure 6 A schematic diagram of establishing a bad byte table according to another embodiment of the present invention;
[0025] Figure 7 A schematic diagram of resetting multiple physical addresses of multiple storage units of each bad block according to a bad byte table according to an embodiment of the present invention;
[0026] Figure 8 A schematic diagram of resetting multiple physical addresses of multiple storage units of each bad page according to a bad byte table according to another embodiment of the present invention;
[0027] Fig. 9 It is a schematic diagram of sorting multiple error byte positions according to an embodiment of the present invention.
[0028] Description of Figure Numbers
[0029] 10: Host system
[0030] 20: Storage device
[0031] 211: First processor
[0032] 110: Second processor
[0033] 120: Host memory
[0034] 130: Data transmission interface circuit
[0035] 210: Memory controller
[0036] 212: Data management circuit
[0037] 213: Memory interface control circuit
[0038] 214: Buffer memory
[0039] 220: Rewritable non-volatile memory module
[0040] MD(1), MD(2), MD(3), MD(N): memory chips
[0041] 230: Connecting interface circuit
[0042] S210, S220, S230, S240, S250: Process steps of the memory management method
[0043] TD: First data (test data)
[0044] VD: Second data (to be verified)
[0045] BB1: Bad block (bad physical block)
[0046] BK1: Solid Block
[0047] T31, T51, T71, T72, T81, T91, T92, T93, T94: Table
[0048] T41, T42, T62: Bad byte table
[0049] BM43, BM61, BM72, BM91: Bitmap / bad byte table
[0050] A31~A33, A40~A43, A51~A53, A61~A62, A71~A72, A81, A91: Arrow DETAILED DESCRIPTION
[0051] Reference will now be made in detail to exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numerals are used in the drawings and the description to refer to the same or like parts.
[0052] Figure 1 FIG. 1 is a block diagram of a host system and a storage device according to an embodiment of the present invention. Figure 1 , the host system 10 is, for example, a personal computer, a notebook computer, or a server. The host system 10 includes a processor 110 (also referred to as a second processor), a host memory 120, and a data transfer interface circuit 130. In the present embodiment, the processor 110 is coupled (also referred to as electrically connected) to the host memory 120 and the data transfer interface circuit 130. In another embodiment, the processor 110, the host memory 120, and the data transfer interface circuit 130 are electrically connected to each other using a system bus. In the present embodiment, the processor 110, the host memory 120, and the data transfer interface circuit 130 may be disposed on a motherboard of the host system 10.
[0053] The storage device 20 includes a storage controller 210, a rewritable non-volatile memory module 220, and a connection interface circuit 230. The storage controller 210 includes a processor 211 (also called a first processor), a data management circuit 212, and a memory interface control circuit 213.
[0054] In this embodiment, the host system 10 is electrically connected to the storage device 20 through the data transmission interface circuit 130 and the connection interface circuit 230 of the storage device 20 to perform data access operations. For example, the host system 10 can store data to the storage device 20 or read data from the storage device 20 via the data transmission interface circuit 130.
[0055] In this embodiment, the number of the data transmission interface circuit 130 can be one or more. Through the data transmission interface circuit 130, the motherboard can be electrically connected to the storage device 20 via a wired or wireless manner. The storage device 20 can be, for example, a USB flash drive, a memory card, a solid state drive (SSD) or a wireless memory storage device. The wireless memory storage device can be, for example, a near field communication (NFC) memory storage device, a wireless fax (WiFi) memory storage device, a Bluetooth memory storage device or a low power consumption Bluetooth memory storage device (e.g., iBeacon) and other memory storage devices based on various wireless communication technologies. In addition, the motherboard can also be electrically connected to various I / O devices such as a global positioning system (GPS) module, a network interface card, a wireless transmission device, a keyboard, a screen, a speaker, etc. through a system bus.
[0056] In this embodiment, the data transmission interface circuit 130 and the connection interface circuit 230 are interface circuits compatible with the high-speed peripheral component interconnect interface (Peripheral Component Interconnect Express, PCI Express) standard. In addition, the data transmission between the data transmission interface circuit 130 and the connection interface circuit 230 is performed using the fast non-volatile memory interface standard (Non-Volatile Memory express, NVMe) communication protocol.
[0057] Furthermore, in another embodiment, the connection interface circuit 230 and the memory controller 210 may be packaged in one chip, or the connection interface circuit 230 may be disposed outside a chip including the memory controller 210 .
[0058] In this embodiment, the host memory 120 is used to temporarily store instructions or data executed by the processor 110. For example, in this embodiment, the host memory 120 can be a dynamic random access memory (DRAM), a static random access memory (SRAM), etc. However, it should be understood that the present invention is not limited thereto, and the host memory 120 can also be other suitable memories.
[0059] The memory controller 210 is used to execute a plurality of logic gates or control instructions implemented in hardware or firmware and to perform operations such as writing, reading and erasing data in the rewritable non-volatile memory module 220 according to instructions of the host system 10 .
[0060] In more detail, the processor 211 in the memory controller 210 is hardware with computing capabilities, which is used to control the overall operation of the memory controller 210. Specifically, the processor 211 is programmed by a plurality of control instructions / program codes, and when the storage device 20 operates, these control instructions / program codes are executed to perform operations such as writing, reading and erasing data. In addition, in this embodiment, the control instructions / program codes can be further executed to perform data reading operations to implement the data reading method provided by the present invention. The control instructions / program codes corresponding to the data reading method can be further implemented as a circuit unit in the form of hardware to implement the data reading method provided by the present invention.
[0061] It is worth mentioning that in the present embodiment, the processor 110 and the processor 211 are, for example, a central processing unit (CPU), a microprocessor, or other programmable processing units (Microprocessor), a digital signal processor (DSP), a programmable controller, an application specific integrated circuit (ASIC), a programmable logic device (PLD) or other similar circuit components, but the present invention is not limited thereto.
[0062] In this embodiment, as described above, the memory controller 210 further includes a data management circuit 212 and a memory interface control circuit 213. It should be noted that the operations performed by the various components of the memory controller 210 can also be regarded as the operations performed by the memory controller 210.
[0063] The data management circuit 212 is electrically connected to the processor 211, the memory interface control circuit 213 and the connection interface circuit 230. The data management circuit 212 is used to receive instructions from the processor 211 to transmit data. For example, data is read from the host system 10 (e.g., the host memory 120) via the connection interface circuit 230, and the read data is written to the rewritable non-volatile memory module 220 via the memory interface control circuit 213 (e.g., the write operation is performed according to the write instruction from the host system 10). For another example, data is read from one or more physical units of the rewritable non-volatile memory module 220 via the memory interface control circuit 213 (the data can be read from one or more storage units in the one or more physical units), and the read data is written to the host system 10 (e.g., the host memory 120) via the connection interface circuit 230 (e.g., the read operation is performed according to the read instruction from the host system 10). In another embodiment, the data management circuit 212 can also be integrated into the processor 211.
[0064] The memory interface control circuit 213 is used to receive instructions from the processor 211 and cooperate with the data management circuit 212 to perform a write (also called programming) operation, a read operation or an erase operation on the rewritable non-volatile memory module 220 .
[0065] In addition, the data to be written to the rewritable non-volatile memory module 220 will be converted into a format acceptable to the rewritable non-volatile memory module 220 via the memory interface control circuit 213. Specifically, if the processor 211 wants to access the rewritable non-volatile memory module 220, the processor 211 will transmit a corresponding instruction sequence to the memory interface control circuit 213 to instruct the memory interface control circuit 213 to perform a corresponding operation. For example, these instruction sequences may include a write instruction sequence indicating writing data, a read instruction sequence indicating reading data, an erase instruction sequence indicating erasing data, and corresponding instruction sequences for indicating various memory operations. These instruction sequences may include one or more signals, or data on the bus. These signals or data may include instruction codes or program codes. For example, in the read instruction sequence, information such as the read identification code, memory address, and physical address will be included.
[0066] In addition, the memory controller 210 establishes a logical to physical address mapping table (Logical To Physical address mapping table) and a physical to logical address mapping table (Physical To Logical address mapping table) to record the mapping relationship between the logical address of the logical unit (e.g., logical block, logical page) configured for the rewritable non-volatile memory module 220 and the physical address (physical address) of the physical unit (e.g., physical erase unit / physical block, physical page). In other words, the memory controller 210 can search for the physical unit mapped by a logical unit (e.g., search for the physical page mapped by a logical page; search for the physical address mapped by a logical address) through the logical to physical address mapping table (also called the logical to physical mapping table), and the memory controller 210 can search for the logical unit mapped by a physical unit (e.g., search for the logical page mapped by a physical page; search for the logical address mapped by a physical address) through the physical to logical address mapping table (also called the physical to logical mapping table).
[0067] In one embodiment, the memory controller 210 further includes a buffer memory 214. The buffer memory is electrically connected to the processor 211 and is used to temporarily store data and instructions from the host system 10, data from the rewritable non-volatile memory module 220, or other system data (e.g., various mapping tables, index tables, bad byte tables, bad cell tables) used to manage the storage device 20, so that the processor 211 can quickly access the data, instructions or system data from the buffer memory 216.
[0068] The rewritable non-volatile memory module 220 is electrically connected to the memory controller 210 (memory interface control circuit 213 ) and is used to store user data sent by the host system 10 .
[0069] In the present embodiment, each memory grain (chip) of the multiple memory grains of the rewritable non-volatile memory module 220 has multiple planes, and each plane has multiple physical blocks. Each physical block includes multiple physical programming units (also called physical pages). Each physical page has multiple storage cells (also called physical bytes or bytes), and each storage cell corresponds to a physical address. The physical address is used to record the physical location of the data stored in the storage cell. It should be noted that the present invention is not limited to the size of each physical page and logical page. The size of each byte is 8 bits, which is used to store data of 8 bit values.
[0070] Figure 2 The figure is a flowchart of a memory management method according to an embodiment of the present invention.
[0071] Please refer to Figure 2 In step S210, the memory controller 210 selects a target bad block from one or more bad blocks of the rewritable non-volatile memory module 220 to write the first data. Next, in step S220, the memory controller 210 reads the target bad block to obtain second data, and compares the first data with the second data to determine one or more error byte positions.
[0072] Specifically, since the physical properties of physical blocks belonging to the same plane are similar, physical blocks in the same plane often present consistent characteristics. After sampling a bad block in the same plane and obtaining the error byte position, it can be applied to all bad blocks in the plane. Therefore, the memory controller 210 selects a bad block (e.g., a target bad block) from each plane according to the bad block table to establish the bad byte table corresponding to each plane (and determines the error byte pattern of the target plane to which the target bad block belongs). The bad byte table can record the distribution characteristics of the bad bytes of the corresponding plane.
[0073] In order to establish the bad byte table, the memory controller 210 needs to first confirm the position of the error byte corresponding to this plane.
[0074] In one embodiment, the memory controller 210 may select the target bad block from a plurality of bad blocks recorded in the bad block table of a corresponding plane in a random manner.
[0075] After selecting the target bad block, the memory controller 210 writes the first data (also called test data) to the target bad block. In one embodiment, the content of the first data is a plurality of pre-set bit values, and the plurality of bit values are set to one of the following states: all are the same first value (e.g., 0) or second value (e.g., 1); and the first value and the second value are randomly arranged. The size of the first data conforms to the storage space of the target bad block. In other words, the user data area of the target bad block will be filled with the first data.
[0076] Next, the memory controller 210 reads the data stored in the target bad block (also called the second data or the data to be verified). Since the content of the first data is a preset known data, the memory controller 210 can confirm the erroneous data and the position of the byte to which it belongs (also called the error byte position) by comparing the read second data with the first data.
[0077] Figure 3 FIG. 1 is a schematic diagram of determining the position of one or more error bytes according to an embodiment of the present invention. For example, please refer to Figure 3, as shown by arrow A31, the memory controller 210 writes the first data TD to the target bad block BB1 in a plane. For the convenience of explanation, it is assumed that the target bad block BB1 has a plurality of storage units (e.g., bytes) SU0-SU15, the first data TD can fill the storage units SU0-SU15, and the value of each bit of the first data TD is "0". Then, as shown by arrow A32, the memory controller 210 reads the second data VD from the storage units SU0-SU15. The first data TD and the second data VD can be stored in the cache memory 214.
[0078] Next, as indicated by arrow A33, the memory controller 210 compares the first data TD and the second data VD, and determines that the data stored in the storage units SU1, SU5, SU9, and SU13 are erroneous (as shown in table T31, the erroneous bytes SU1, SU5, SU9, and SU13 are obtained). Next, the memory controller 210 can obtain the erroneous byte position according to the physical address corresponding to the erroneous bytes SU1, SU5, SU9, and SU13.
[0079] Please come back Figure 2 Then, in step S230, the memory controller 210 establishes a bad byte table according to the one or more error byte positions.
[0080] Figure 4 FIG. 1 is a schematic diagram of establishing a bad byte table according to an embodiment of the present invention. For example, please refer to Figure 4 , continued Figure 3 For example, as shown by arrow A40, the memory controller 210 can obtain multiple error byte positions "PBA1", "PBA5", "PBA9", and "PBA13" according to the physical addresses corresponding to the error bytes SU1, SU5, SU9, and SU13.
[0081] In this example, since the address difference between adjacent error byte positions in the plurality of error byte positions “PBA1”, “PBA5”, “PBA9”, and “PBA13” is a fixed value (e.g., 4), the memory controller 210 determines that the error byte pattern of the target bad block BB1 is a regular pattern (e.g., an error occurs every 4 physical addresses, and the starting physical address is “PBA1”).
[0082] In one embodiment, if the error byte pattern is the regular pattern, in the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern, the memory controller 210 establishes the bad byte table according to the first error byte position in each group of one or more error byte positions and the fixed value.
[0083] For example Figure 4In the example of FIG. 4 , as shown by arrow A41, the memory controller 210 establishes a bad byte table T41 according to the determined error byte pattern (regular pattern) and multiple error byte positions. The bad byte table T41 includes three fields: plane number, starting physical address, and address difference. Then, the memory controller 210 records "1" (assuming that the plane number of the plane to which the target bad block BB1 belongs is "1"), "PBA1" and "4" to the bad byte table T41 respectively.
[0084] In one embodiment, as shown by arrow A42, the memory controller 210 determines that the error data all occur in the second column, corresponding to the column number "2" according to the multiple error byte positions "PBA1", "PBA5", "PBA9", and "PBA13". Accordingly, the memory controller 210 establishes a bad byte table T42, which includes two fields: the plane number and the error column number. In this example, the memory controller 210 records "1" (assuming that the plane number of the target plane is "1") and "2" in the bad byte table T42.
[0085] In one embodiment, as shown by arrow A43, the memory controller 210 directly establishes a bitmap BM43 corresponding to the table T31 according to the multiple error byte positions "PBA1", "PBA5", "PBA9", "PBA13", wherein the number and arrangement positions of the storage cells of the bitmap BM43 correspond to the number and arrangement positions of the storage units of the physical block. In addition, the bit value recorded as "1" in the storage cell is used to indicate that an error has occurred in the corresponding storage unit / physical address; the bit value recorded as "0" in the storage cell is used to indicate that no error has occurred in the corresponding storage unit / physical address. In this example, the memory controller 210 records "1" to the corresponding storage cells in the bitmap BMT43 based on the multiple error byte positions "PBA1", "PBA5", "PBA9", "PBA13" to establish the corresponding bad byte table BM43. By analogy, the memory controller 210 can establish multiple bitmaps corresponding to multiple planes respectively, and the order of the multiple bitmaps can correspond to the order of the plane numbers of the multiple planes.
[0086] It is worth mentioning that the storage space consumed by the bad byte tables T41 and T42 is lower than the storage space consumed by the bad byte table BM43, wherein the storage space consumed by the bad byte table T42 is lower than the storage space consumed by the bad byte table T41.
[0087] In one embodiment, the memory controller 210 writes a plurality of first data of different states (e.g., a plurality of bit values of the first data are set to one of the following states: all are 0 or 1; and a random value) to the target bad block, and obtains a plurality of second data corresponding to the plurality of first data by reading the target bad block, so as to obtain a plurality of groups of one or more error byte positions corresponding to the plurality of first data. Then, the memory controller 210 analyzes the plurality of groups of one or more error byte positions to determine whether the error byte state of the target bad block is a regular state or an irregular state. That is, by using the plurality of first data and the read second data, the memory controller 210 can determine whether the distribution state of the error byte positions of the target bad block is regular or irregular.
[0088] Next, the memory controller 210 establishes the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns. That is, after determining the distribution state of the error byte positions of the target bad block, the memory controller 210 may use the establishment method of the error byte positions corresponding to the regular pattern and the irregular pattern to establish the corresponding bad byte table (refer to Figure 4 , Figure 6 for example).
[0089] In one embodiment, if the address difference between two adjacent error byte positions in each determined group of one or more error byte positions is a fixed value, the memory controller 210 determines that the error byte pattern is the regular pattern. Conversely, if the address difference between two adjacent error byte positions in each determined group of one or more error byte positions is not a fixed value, the memory controller 210 determines that the error byte pattern is the irregular pattern.
[0090] Figure 5 FIG. 1 is a schematic diagram showing a method of determining one or more error byte positions according to another embodiment of the present invention. Figure 5 As shown by arrow A51, the memory controller 210 writes the first data TD to the target bad block BB1 in one plane. Then, as shown by arrow A52, the memory controller 210 reads the second data VD from the storage units SU0-SU15. The first data TD and the second data VD may be stored in the cache memory 214.
[0091] Next, as indicated by arrow A53, the memory controller 210 compares the first data TD and the second data VD, and determines that the data stored in the storage units SU0, SU1, and SU6 are erroneous (as shown in table T51, the erroneous bytes SU0, SU1, and SU6 are obtained). Next, the memory controller 210 can obtain the erroneous byte position according to the physical address corresponding to the erroneous bytes SU0, SU1, and SU6.
[0092] Figure 6 FIG. 1 is a schematic diagram of establishing a bad byte table according to another embodiment of the present invention. Figure 6 , continued Figure 5 In the example, as shown by arrow A60, the memory controller 210 can obtain multiple error byte positions "PBA0", "PBA1", "PBA6" according to the physical addresses corresponding to the error bytes SU0, SU1, and SU6. In this example, since the address difference between adjacent error byte positions in the multiple error byte positions "PBA0", "PBA1", and "PBA6" is not a fixed value, the memory controller 210 determines that the error byte pattern of the target bad block BB1 is an irregular pattern.
[0093] In one embodiment, if the error byte pattern is an irregular pattern, in the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern, the memory controller 210 records multiple error byte positions into a bitmap corresponding to the target plane to establish the bad byte table.
[0094] In some cases, the number of multiple error byte positions recorded to the bitmap is limited based on a predetermined number of redundant bytes, and the predetermined number of redundant bytes is related to the error correction capability of the memory controller 210. In more detail, the error correction capability of the memory controller 210 can be adjusted to any value between a predetermined maximum value and a predetermined minimum value. Through the error correction capability corresponding to the predetermined maximum value, the memory controller 210 can generate X bytes of check data (also called error correction data) that can be used to correct error data within M bits; through the error correction capability corresponding to the predetermined minimum value, the memory controller 210 can generate Y bytes of check data (also called error correction data) that can be used to correct error data within N bits. The difference in the number of bits of correctable error data (MN) is much smaller than the difference in the size of the error correction data (XY). The predetermined number of redundant bytes is the difference between X and Y (predetermined number of redundant bytes=XY). For example, X is 200 bytes, Y is 100 bytes, M is 200 bits, and N is 100 bits.
[0095] Since the highest error correction capability is used, (XY) bytes of space are consumed to store larger error correction data, but the number of bits of error data that can be error corrected is only increased by (MN). Therefore, in this embodiment, when writing data, the memory controller 210 uses the error correction capability corresponding to the predetermined minimum value to generate error correction data to be stored together with the data to be stored to protect the stored data. Since the lowest error correction capability is used, the size of the error correction data is limited to the minimum, and compared with the maximum error correction data, the saved space / bytes will be used to replace bad bytes. In this way, using the saved bytes to replace the physical address of the error byte position can further enhance the overall data stability of the physical block and achieve better storage space utilization efficiency.
[0096] Therefore, the total number of error byte positions recorded in the bad byte table must not exceed the total number of saved spaces / bytes (ie, the predetermined number of redundant bytes) to avoid the situation where replacement is impossible.
[0097] exist Figure 6 In the example, it is assumed that the total number of error byte positions does not exceed the predetermined number of redundant bytes. As indicated by arrow A61, the memory controller 210 uses the bitmap BM61 to record a plurality of error byte positions "PBA0", "PBA1", "PBA6".
[0098] For another example, as shown by arrow A62, the memory controller 210 establishes a bad byte table T62, whose fields include: plane number and error physical address. The memory controller 210 records "PBA0", "PBA1", "PBA6" to the error physical address field based on multiple error byte positions "PBA0", "PBA1", "PBA6", and records the number "1" of the target plane to the plane number field.
[0099] Please go back Figure 2 After the bad byte table is established, in step S240, the memory controller 210 resets the multiple physical addresses of the multiple storage units of each bad block of the target plane to which the target bad block belongs according to the bad byte table. In addition, when data is to be written to the rewritable non-volatile memory module 220, in step S250, the memory controller 210 sets each reset bad block of the target plane as a normal physical block to store data. For example, the reset bad block can be removed from the bad block table. In addition, the reset bad block can be included in the available block pool. The available block pool is a logical concept that represents a collection of all physical blocks that can be used to store new data.
[0100] In this embodiment, in order to avoid delays in the writing process caused by querying the bad byte table, the memory controller 210 will directly reset the physical addresses of the storage units of each bad block of the target plane according to the established bad byte table after the bad byte table is established. All physical addresses of each minimum operation unit will skip the bad byte position and be postponed to the later physical address. Finally, the saved physical addresses of the good bytes / storage units in the redundant area will be used to supplement the physical addresses postponed due to skipping the bad byte position.
[0101] In the existing bad block management scheme, in order to improve the utilization rate of the physical block, the bad physical page in the bad block will be discarded, and a good page of another physical address will be mapped to the same logical block as the original physical block. Therefore, when reading and writing data in the logical block, the reading and writing will jump between different physical blocks, affecting storage performance.
[0102] This solution resets the physical address of the storage unit of each bad block in the target plane. All physical addresses of each minimum operation unit will skip the bad byte position and be postponed to the later physical address, so that continuous writing can be performed to improve writing efficiency.
[0103] In more detail, in the operation of resetting the multiple physical addresses of the multiple storage units possessed by each bad block of the target plane to which the target bad block belongs according to the bad byte table, the memory controller 210 compares the multiple physical addresses that have been set to the multiple storage units and the one or more error byte positions to obtain one or more first physical addresses among the multiple physical addresses corresponding to the one or more error byte positions and a plurality of second physical addresses among the multiple physical addresses that do not correspond to the one or more error byte positions; and the memory controller 210 sets the multiple second physical addresses and one or more third physical addresses to the multiple storage units in sequence, wherein the one or more third physical addresses belong to a plurality of redundant physical addresses of the redundant area of each physical block.
[0104] Figure 7 FIG. 1 is a schematic diagram of resetting multiple physical addresses of multiple storage units of each bad block according to a bad byte table according to an embodiment of the present invention. For example, please refer to Figure 7, assuming that a bad block BK1 of the target plane has storage units SU0-SU15 located in the user data area and available storage units SU16-SU19 located in the redundant area. Part or all of the available storage units SU16-SU19 may be additional available (blank) storage units obtained by reducing the error correction capability. In addition, as shown in Table T71, it is further assumed that the physical addresses originally set to the storage units SU0-SU19 are "PBA0"-"PBA19", and the memory controller 210 has established a bad byte table BM72 corresponding to the target plane.
[0105] In this example, as indicated by arrow A71, the memory controller 210 obtains two first physical addresses (e.g., "PBA0", "PBA6") corresponding to two error byte positions in the physical address "PBA0" to "PBA19" and a plurality of second physical addresses (e.g., "PBA1" to "PBA5", "PBA7" to "PBA19") that do not correspond to the two error byte positions based on the bad byte table BM72. Since the number of error byte positions is 2, the memory controller 210 will sequentially use the two physical addresses "PBA16" and "PBA17" (also called the third physical address) of the redundant area to replace the first physical addresses "PBA0" and "PBA6". That is, the corresponding two storage units SU16 and SU17 of the redundant area will be allocated to this bad block to keep the available space of the entire bad block unchanged. Just like SU0-SU15 are originally divided into bad block BK1, and the operation is unified, if SU0 and SU6 are broken, SU16 and SU17 are moved backward to bad block BK1 to ensure that the number of storage units in bad block BK1 remains unchanged.
[0106] That is, as shown by arrow A72, based on the bad byte table BM72, the memory controller 210, in a deferred physical address manner, skips the storage units SU0 and SU6 corresponding to the two error byte positions, and defers the use of the subsequent storage units to replace the available storage units of the bad block BK1. For example, the first storage unit of the bad block BK1 will be set as the storage unit SU1, and then the two storage units SU16 and SU17 of the original redundant area will be used in a deferred manner. Similarly, as shown in Table T72, after the bad block BK1 is reset, it will become a bad block BK2, which has storage units SU1~SU5, SU7~SU17. However, since the storage units of the reset bad block BK2 are all available, the memory controller 210 can set this bad block as a normal physical block to store data.
[0107] In another embodiment, the memory controller 210 does not reset the physical addresses of the multiple storage units of the physical block. The memory controller 210 adjusts the physical address of each storage unit of the bad block for storing data according to the position of the error byte identified based on the bad byte table before using the bad block (e.g., before writing data to the bad block), so as to write the data to the multiple storage units of the adjusted / determined physical addresses of the bad block.
[0108] Figure 8 It is a schematic diagram showing resetting a plurality of physical addresses of a plurality of storage units of each bad page according to a bad byte table according to another embodiment of the present invention.
[0109] Bad byte locations are usually also distributed within bad pages in bad blocks. For example, see Figure 8 , assuming that a bad page PG1 in a bad block has four minimum operation (read) units MR1 to MR4 of a user data area, each with a 4K byte group size, and each bad page PG1 has a redundant area R1. In addition, it is further assumed that after querying the bad byte table, the memory controller 210 can obtain the error byte position (such as Figure 8 ). In order to skip these error byte positions, the memory controller 210 resets the storage unit for the bad page PG1. For example, for the minimum operation unit MR1: Since the minimum operation unit MR1 has an error byte, in order to make up for the storage space missing due to skipping the error byte position in the minimum operation unit MR1, the memory controller 210 uses a portion of the storage space SU1 of the next minimum operation unit MR2 to make up for the storage space in the minimum operation unit MR1 so that the total storage space is maintained at a 4K byte group size, and extends the end position P810 of the minimum operation unit MR1 to P811 to obtain the minimum operation unit MR1'.
[0110] Next, for the minimum operation unit MR2: since the original storage space SU1 within the minimum operation unit MR2 is used to supplement the minimum operation unit MR1, the memory controller 210 uses part of the storage space of the next minimum operation unit MR3 to supplement the storage space within the minimum operation unit MR2 so that the total storage space is maintained at a 4K byte size, and extends the end position P820 of the minimum operation unit MR2 to P821 to obtain the minimum operation unit MR2'.
[0111] Next, for the minimum operation unit MR3: Since the end position P820 of the minimum operation unit MR2 is extended to P821, the storage space in the minimum operation unit MR3 is reduced, and the memory controller 210 will use part of the storage space of the next minimum operation unit MR4 to make up for the reduced part. In addition, since the minimum operation unit MR3 has an error byte, in order to make up for the storage space missing due to skipping the error byte position in the minimum operation unit MR3, the memory controller 210 also uses part of the storage space SU2 of the next minimum operation unit MR4 to make up for the storage space in the minimum operation unit MR3. Finally, the memory controller 210 extends the end position P830 of the minimum operation unit MR3 to P831 to obtain the minimum operation unit MR3'.
[0112] Next, for the minimum operation unit MR4: Since the end position P830 of the minimum operation unit MR3 is extended to P831, the storage space in the minimum operation unit MR4 is reduced. In order to make up for the reduced part, the memory controller 210 extends the end position P840 of the minimum operation unit MR4 to P841 to obtain the minimum operation unit MR4', resulting in the redundant area R1 being adjusted to the redundant area R1' (the starting position of the redundant area is adjusted).
[0113] After all minimum operation units have been adjusted, a reset bad page PG1' is obtained, and all current storage spaces of the bad page PG1' are normal and available. Similarly, after all bad pages in a bad block have been reset, all storage spaces of the bad block are normal and available, and the memory controller 210 can reset the bad block to a normal physical block (e.g., remove it from the bad block table), restore the original data storage function, and increase the storage space of the storage device 20.
[0114] In one embodiment, if the error byte pattern is an irregular pattern, in the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte pattern, the memory controller 210 counts the total number of times each error byte position occurs in the multiple groups of one or more error byte positions, sorts all the error byte positions from large to small according to the total number of times of each error byte position; and selects a maximum of N error byte positions from the first error byte position from the multiple sorted error byte positions to record in the bitmap of the corresponding target plane (to avoid exceeding the predetermined number of redundant bytes, which will result in failure to be replaced), so as to establish the bad byte table, where N is the predetermined number of redundant bytes.
[0115] Fig. 9 FIG. 1 is a schematic diagram of sorting multiple error byte positions according to an embodiment of the present invention. For example, please refer to Fig. 9In this embodiment, it is assumed that the memory controller 210 uses three sets of first data with different patterns to write into the target bad block and read out the corresponding second data to obtain multiple comparison results (as shown in Tables T91 to T93). Table T91 is a comparison result obtained based on the first data whose bit values are all "0". The memory controller 210 determines that the data of the corresponding storage units SU0 and SU1 are erroneous, and obtains the error byte positions "PBA0" and "PBA1"; Table T92 is a comparison result obtained based on the first data whose bit values are all "1". The memory controller 210 determines that the data of the corresponding storage units SU0, SU1, and SU6 are erroneous, and obtains the error byte positions "PBA0", "PBA1", and "PBA6"; Table T93 is a comparison result obtained based on the first data whose bit values are randomly arranged "0" and "1". The memory controller 210 determines that the data of the corresponding storage units SU0, SU1, SU6, and SU15 are erroneous, and obtains the error byte positions "PBA0", "PBA1", "PBA6", and "PBA15".
[0116] In this example, the memory controller 210 further counts the number of occurrences (total number of occurrences) of each error byte position. For example, in Tables T91-T93, the error byte position "PBA0" appears 3 times; the error byte position "PBA1" appears 3 times; the error byte position "PBA6" appears 2 times; and the error byte position "PBA15" appears 1 time.
[0117] The memory controller 210 further records the total number of each error byte position in the bad byte table BM91. The values recorded in the multiple storage cells of the multiple physical addresses of the corresponding physical block BK1 of the bad byte table are preset to 0 to represent a non-error byte position. In one embodiment, the memory controller 210 can directly record the total number of error byte positions in the corresponding storage cells. Fig. 9 As shown in the bad byte table BM91, according to the above statistical results for each error byte position, the memory controller 210 records the value of the storage cell corresponding to the storage unit SU0 (physical address PBA0) as 3; records the value of the storage cell corresponding to the storage unit SU1 (physical address PBA1) as 3; records the value of the storage cell corresponding to the storage unit SU6 (physical address PBA6) as 2; and records the value of the storage cell corresponding to the storage unit SU15 (physical address PBA15) as 1.
[0118] In another embodiment, the memory controller 210 may further utilize a total count table to record the number of errors occurring at each error byte position (eg, in the form of table T94).
[0119] In one embodiment, as indicated by arrow A91 , the memory controller 210 sorts all the error byte positions from largest to smallest according to the total number of times of each error byte position (as shown in table T94 ).
[0120] In one embodiment, the memory controller 210 further identifies the target error byte position whose total number of errors is greater than a first threshold among all error byte positions, and resets the physical address of the physical block only according to the target error byte position. In this way, the memory controller 210 can filter out relatively reliable physical addresses (because the total number of errors is lower than the first threshold). The first threshold can be determined based on the number of groups of test data written. For example, Fig. 9 Three sets of test data are used, and the first threshold can be set to 3 or 2.
[0121] Assume that Fig. 9 In the example of FIG. 2 , the first threshold is set to 3, the memory controller 210 obtains the target error byte positions: “PBA0”, “PBA1”, and resets the physical addresses of the storage units SU0 to SU15 to “PBA2” to “PBA17”.
[0122] It should be noted that in the above-mentioned embodiment, because the storage unit corresponding to the physical address used to locate data is a byte, the memory controller 210 determines the error "byte" position according to the storage unit corresponding to the physical address to establish a bad "byte" table, but the present invention is not limited to this.
[0123] For example, in another embodiment, the storage unit corresponding to the physical address used to locate data is a physical page, so the memory controller 210 determines the error "page" position according to the storage unit corresponding to the physical address to establish a bad "page" table. For another example, in another embodiment, the storage unit corresponding to the physical address used to locate data is a physical sector, so the memory controller 210 determines the error "sector" position according to the storage unit corresponding to the physical address to establish a bad "sector" table.
[0124] That is, in another embodiment, the memory controller 210 determines the error cell location according to the storage unit corresponding to the physical address to establish a bad cell table. Then, the memory controller 210 resets the multiple physical addresses of the multiple storage units of each physical block of the target plane to which the target bad block belongs based on the established bad cell table, so as to store data to one or more physical blocks in the target plane according to the reset multiple storage units.
[0125] On the other hand, after the total number of error byte positions of the target plane is confirmed, if the total number is less than the predetermined number of redundant bytes, the completion
[0126] That is, the memory controller 210 increases the first error correction capability of each physical block of the target plane to the second error correction capability according to the total number of one or more fourth physical addresses (the fourth physical address is a portion of the redundant physical address that is not used to replace the error byte position) among the multiple redundant physical addresses, so as to adjust the size of the generated error correction data from the first size to the second size, wherein the difference between the second size and the first size is the total number of the one or more fourth physical addresses.
[0127] That is, after determining the error byte position of the target plane, because the number of redundant physical addresses used to replace the error byte position has been determined, the remaining fourth physical address can be used to store larger error correction data. Therefore, the memory controller 210 can enhance the error correction capability (the capability of the error correction engine executed) to generate larger error correction data, and the larger error correction data can be stored in the remaining fourth physical address compared to the original error correction data. In this way, the stability of the data stored in the physical block of the target plane can be further enhanced, and the storage capacity of the storage device 20 can be enhanced. At the same time, all storage space is fully utilized.
[0128] Based on the above, the memory controller and memory management method provided by the embodiment of the present invention can find out the position of the error byte of each physical block to establish a bad byte table, and reset the multiple physical addresses of each physical block according to the bad byte table, so that the reset physical block has a relatively stable multiple physical addresses, thereby improving the stability of the stored data, avoiding the occurrence of erroneous data, and reducing the load of error correction. In addition, the reset bad blocks are recovered to increase storage space. It can be seen that the present invention significantly improves the storage space utilization efficiency of the storage device and greatly improves the overall work efficiency.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A memory management method, characterized in that: include: Selecting a target bad block among one or more bad blocks of a rewritable non-volatile memory module to write the first data; Reading the target bad block to obtain second data, and comparing the first data with the second data to determine one or more error byte positions; Establishing a bad byte table according to the one or more error byte positions; According to the bad byte table, a plurality of physical addresses of a plurality of storage units of each bad block of the target plane to which the target bad block belongs are reset, wherein the step of reset the plurality of physical addresses of the plurality of storage units of each bad block of the target plane to which the target bad block belongs according to the bad byte table comprises: comparing the plurality of physical addresses set to the plurality of storage units with the one or more target error byte positions to obtain one or more first physical addresses corresponding to the one or more target error byte positions among the plurality of physical addresses and a plurality of second physical addresses not corresponding to the one or more target error byte positions among the plurality of physical addresses; sequentially setting the plurality of second physical addresses and one or more third physical addresses to the plurality of storage units, wherein the one or more third physical addresses belong to a plurality of redundant physical addresses of a redundant area of each physical block; as well as Each bad block of the target plane that has been reset is set as a normal physical block to store data, wherein after the multiple physical addresses of the multiple storage units in each bad block are reset to physical addresses, the size of the storage space of each physical page of each reset bad block is still maintained at a predetermined size.
2. The memory management method according to claim 1, characterized in that: The rewritable nonvolatile memory module has a plurality of planes, and the target bad block is selected from each plane to establish the bad byte table corresponding to each plane.
3. The memory management method according to claim 2, characterized in that: The target bad blocks are selected randomly. The content of the first data is a plurality of pre-set bit values, and the plurality of bit values are set to one of the following states: are the same first value or second value; and The first value and the second value are randomly arranged.
4. The memory management method according to claim 1, characterized in that: The method further comprises: Writing a plurality of first data of different states to the target bad block, and obtaining a plurality of second data corresponding to the plurality of first data by reading the target bad block, so as to obtain a plurality of groups of one or more error byte positions corresponding to the plurality of first data; Analyzing the multiple groups of one or more error byte positions to determine whether the error byte pattern of the target bad block is a regular pattern or an irregular pattern; and The bad byte table is established according to the multiple groups of one or more error byte positions and the error byte patterns.
5. The memory management method according to claim 4, characterized in that: The method further comprises: If the address differences between two adjacent error byte positions in each group of one or more error byte positions are all fixed values, determining that the error byte pattern is the regular pattern; and If the address difference between two adjacent error byte positions in each group of one or more error byte positions is not a fixed value, the error byte pattern is determined to be the irregular pattern.
6. The memory management method according to claim 5, characterized in that: The method further comprises: If the error byte pattern is the regular pattern, The step of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns comprises: The bad byte table is established according to the first error byte position in each group of one or more error byte positions and the fixed value.
7. The memory management method according to claim 5, characterized in that: The method further comprises: If the error byte pattern is the irregular pattern, The step of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns comprises: Counting the total number of times each error byte position occurs in the multiple groups of one or more error byte positions; According to the total number of each error byte position, sort all error byte positions from large to small; and From the plurality of sorted error byte positions, starting from the first error byte position, a maximum of N error byte positions are selected and recorded into the bitmap corresponding to the target plane to establish the bad byte table, wherein N is a predetermined number of redundant bytes.
8. The memory management method according to claim 7, characterized in that: The step of establishing a bad byte table according to the one or more error byte positions further comprises: Recording the total number of times for each erroneous byte position; One or more target error byte positions are obtained according to the bitmap and the total number of each error byte position, wherein the total number of the one or more target error byte positions is greater than a first threshold.
9. The memory management method according to claim 1, characterized in that: The method further comprises: According to the total number of one or more fourth physical addresses that are not the one or more third physical addresses among the multiple redundant physical addresses, the first error correction capability of each physical block of the target plane is increased to a second error correction capability to adjust the size of the generated error correction data from the first size to the second size.
10. A memory controller for controlling a storage device equipped with a rewritable non-volatile memory module, characterized in that: The memory controller comprises: A memory interface control circuit, for electrically connecting to the rewritable non-volatile memory module; and A processor electrically connected to the memory interface control circuit, wherein the processor is further electrically connected to the connection interface circuit of the storage device to electrically connect to the host system, wherein the processor is configured to: Selecting a target bad block among one or more bad blocks of the rewritable non-volatile memory module to write first data; Reading the target bad block to obtain second data, and comparing the first data with the second data to determine one or more error byte positions; Establishing a bad byte table according to the one or more error byte positions; According to the bad byte table, a plurality of physical addresses of a plurality of storage units of each bad block of the target plane to which the target bad block belongs are reset, wherein the step of reset the plurality of physical addresses of the plurality of storage units of each bad block of the target plane to which the target bad block belongs according to the bad byte table comprises: comparing the plurality of physical addresses set to the plurality of storage units with the one or more target error byte positions to obtain one or more first physical addresses corresponding to the one or more target error byte positions among the plurality of physical addresses and a plurality of second physical addresses not corresponding to the one or more target error byte positions among the plurality of physical addresses; sequentially setting the plurality of second physical addresses and one or more third physical addresses to the plurality of storage units, wherein the one or more third physical addresses belong to a plurality of redundant physical addresses of a redundant area of each physical block; and Each bad block of the target plane that has been reset is set as a normal physical block to store data, wherein after the multiple physical addresses of the multiple storage units in each bad block are reset to physical addresses, the size of the storage space of each physical page of each reset bad block is still maintained at a predetermined size.
11. The memory controller according to claim 10, characterized in that: The rewritable nonvolatile memory module has a plurality of planes, and the processor selects the target bad block from each plane to establish the bad byte table corresponding to each plane.
12. The memory controller according to claim 11, wherein: The target bad blocks are selected randomly. The content of the first data is a plurality of pre-set bit values, and the plurality of bit values are set to one of the following states: are the same first value or second value; and The first value and the second value are randomly arranged.
13. The memory controller according to claim 10, wherein: The processor writes a plurality of first data of different states to the target bad block, obtains a plurality of second data corresponding to the plurality of first data by reading the target bad block, and obtains a plurality of groups of one or more error byte positions corresponding to the plurality of first data; The processor analyzes the multiple groups of one or more error byte positions to determine whether the error byte pattern of the target bad block is a regular pattern or an irregular pattern; and The processor establishes the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns.
14. The memory controller according to claim 13, wherein: If the address differences between two adjacent error byte positions in each group of one or more error byte positions are all fixed values, the processor determines that the error byte pattern is the regular pattern; as well as If the address difference between two adjacent error byte positions in each group of one or more error byte positions is not a fixed value, the processor determines that the error byte pattern is the irregular pattern.
15. The memory controller according to claim 14, wherein: If the error byte pattern is the regular pattern, In the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns, The processor establishes the bad byte table according to a first error byte position in each group of one or more error byte positions and the fixed value.
16. The memory controller according to claim 14, wherein: If the error byte pattern is the irregular pattern, In the operation of establishing the bad byte table according to the multiple groups of one or more error byte positions and the error byte patterns, The processor counts the total number of times each error byte position occurs in the multiple groups of one or more error byte positions; The processor sorts all error byte positions from large to small according to the total number of times of each error byte position; as well as The processor selects at most N error byte positions from a plurality of sorted error byte positions, starting from the first error byte position, and records them into the bitmap corresponding to the target plane to establish the bad byte table, wherein N is a predetermined number of redundant bytes.
17. The memory controller according to claim 16, wherein: The step of establishing a bad byte table according to the one or more error byte positions further comprises: The processor further records the total number of times for each error byte position; The processor obtains one or more target error byte positions according to the bitmap and the total number of each error byte position, wherein the total number of the one or more target error byte positions is greater than a first threshold.
18. The memory controller according to claim 10, wherein: The processor increases the first error correction capability of each physical block of the target plane to a second error correction capability according to the total number of one or more fourth physical addresses that are not the one or more third physical addresses in the multiple redundant physical addresses, so as to adjust the size of the generated error correction data from the first size to the second size.
