Memory device, flash memory controller and access method thereof

Through the control method of the flash memory controller, the write time record table is established and the index is compressed, and expired blocks are identified and processed, which solves the problem of declining data quality in the flash memory and improves access efficiency and block processing capabilities.

CN114115706BActive Publication Date: 2024-10-11SILICON MOTION INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110203433.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-08-27
Filing Date
2021-02-23
Publication Date
2024-10-11
Estimated Expiration
2041-02-23

AI Technical Summary

Technical Problem

The increase in the number of layers and the use of multi-layer storage technology in flash memory has led to a decline in data quality. It is difficult for existing technology to effectively deal with quality issues, especially in busy conditions, which affects access efficiency.

Method used

A control method for a flash memory controller is proposed. By establishing a write time record table, compressing the record table to generate a time range index, identifying expired blocks and moving their data to blank blocks, block quality pre-processing is achieved.

Benefits of technology

It improves the efficiency of block quality processing in the flash memory module, avoids data quality degradation, and ensures access efficiency, especially in busy conditions, which can effectively balance block quality and access performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114115706B_ABST
    Figure CN114115706B_ABST
Patent Text Reader

Abstract

The present invention relates to a memory device, a flash memory controller and an access method thereof, and more particularly to a control method applied to a flash memory controller, comprising: when data is written to a data page of any block of a flash memory module, recording a write time on the data page; establishing a write time record table, wherein the write time record table records the block numbers of the blocks in the flash memory module where data is written and the corresponding write times; compressing the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes multiple time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the block numbers of all blocks whose write times are within the corresponding time range.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a flash memory controller and a related control method. Background Art

[0002] With the development of three-dimensional flash memory technology, the number of stacked layers in flash memory chips is increasing. In addition, the current flash memory modules contain many blocks using triple-level cell (TLC) or quad-level cell (QLC). Therefore, the quality of data stored in the flash memory is getting worse and worse. Even a few weeks after the data is written, the quality will decline rapidly, causing difficulties in subsequent decoding or even being unable to read. In order to solve this problem, the flash memory controller can use idle time to read part of the content of each block in the flash memory module to determine the quality of each block. However, the above method will consume a lot of time, and if the flash memory controller is often in a busy state, it will not be able to take into account both access efficiency and block quality. Summary of the invention

[0003] Therefore, one of the objectives of the present invention is to provide a flash memory controller and a related control method, which can effectively pre-process blocks with possible quality problems in a flash memory module to solve the problems described in the prior art.

[0004] In one embodiment of the present invention, a control method applied to a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes a plurality of blocks, and each block includes a plurality of data pages, and the control method includes: when data is written to a data page of any block of the flash memory module, a write time is recorded in the data page; a write time record table is established, wherein the write time record table records the block number of the block in the flash memory module to which data is written and the corresponding write time; the write time record table is compressed to generate a compressed write time record table, wherein the compressed write time record table includes a plurality of time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the block numbers and the write time of all blocks whose write time is in the corresponding time range; determining a specific time range of the multiple time ranges in the compressed write time record table according to the current time when the control method is executed, and reading multiple block numbers and corresponding write times from the flash memory module according to the index value corresponding to the specific time range; recording at least a part of the block numbers of the multiple block numbers in an expired block table; and sequentially moving valid data in the blocks having the at least a part of the block numbers to at least one blank block according to the at least a part of the block numbers recorded in the expired block table.

[0005] In another embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, and the flash memory controller includes a read-only memory, a microprocessor, and a buffer memory. When the microprocessor writes data to a data page of any block of the flash memory module, a write time is recorded in the data page, and a write time record table is established, wherein the write time record table records the block number of the block in the flash memory module where data is written and the corresponding write time; and the microprocessor compresses the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes multiple time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the write time in the corresponding time range. The microprocessor determines a specific time range of the multiple time ranges in the compressed write time record table according to the current time when the control method is executed, and reads multiple block numbers and corresponding write times from the flash memory module according to the index value corresponding to the specific time range; the microprocessor records at least a part of the multiple block numbers in an expired block table, and according to the at least a part of the block numbers recorded in the expired block table, sequentially moves valid data in the blocks with the at least a part of the block numbers to at least one blank block.

[0006] In another embodiment of the present invention, a memory device is disclosed, which includes a flash memory module and a flash memory controller. When the flash memory controller writes data to a data page of any block of the flash memory module, a write time is recorded in the data page, and a write time record table is established, wherein the write time record table records the block number of the block in the flash memory module where data is written and the corresponding write time; and the flash memory controller compresses the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes multiple time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the write time in the corresponding time range. The method comprises the steps of: determining a specific time range of the plurality of time ranges in the compressed write time record table according to the time when the control method is currently executed, and reading a plurality of block numbers and corresponding write times from the flash memory module according to the index value corresponding to the specific time range; recording at least a portion of the block numbers in an expired block table by the flash memory controller, and sequentially moving valid data in blocks having the at least a portion of the block numbers to at least one blank block according to the at least a portion of the block numbers recorded in the expired block table. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] Figure 1 FIG. 4 is a schematic diagram of a memory device according to an embodiment of the present invention.

[0008] Figure 2 FIG. 4 is a schematic diagram of a block in a flash memory module according to an embodiment of the present invention.

[0009] Figure 3 FIG. 4 is a flow chart of establishing a write time record table according to an embodiment of the present invention.

[0010] Figure 4 Schematic diagram of writing time information in a block.

[0011] Figure 5 FIG. 4 is a schematic diagram of a writing time record table according to an embodiment of the present invention.

[0012] Fig. 6A Schematic diagram of a compressed writing time record table according to an embodiment of the present invention.

[0013] Figure 6B 2 is a schematic diagram of a currently written block table and an expired recycled block index table according to an embodiment of the present invention.

[0014] Figure 6CSchematic diagram of an expired recovery block index table according to another embodiment of the present invention.

[0015] Figure 7 The flowchart of updating the compressed write time record table according to an embodiment of the present invention.

[0016] Figure 8 A schematic diagram for updating the time information of a block in a dedicated block.

[0017] Fig. 9 The flowchart shown is a flow chart of establishing a write time record table in a DRAM after a memory device is powered on according to an embodiment of the present invention.

[0018] Fig.10 The figure is a flow chart of an expired block recovery operation according to an embodiment of the present invention.

[0019] Explanation of symbols

[0020] 100: Memory Device

[0021] 110: Flash memory controller

[0022] 112: Microprocessor

[0023] 112C: Program code

[0024] 112M: Read-only memory

[0025] 114: Control Logic

[0026] 116: Buffer memory

[0027] 118: Interface Logic

[0028] 120: Flash memory module

[0029] 130: Main device

[0030] 132: Encoder

[0031] 134:Decoder

[0032] 140: Dynamic Random Access Memory

[0033] 200: Block

[0034] 300~308: Steps

[0035] 500: Write time record table

[0036] 600: Compress and write to the time record table

[0037] 630: Currently writing to the block table

[0038] 632: Expired recovery block index table

[0039] 652: Expired recovery block index table

[0040] 700~712: Steps

[0041] 900~912: Steps

[0042] 1000~1010: Steps

[0043] B1,B2,B200,B201,B202: Block

[0044] BL1, BL2, BL3: bit lines

[0045] P1~P256: data page

[0046] T1_1, T1_M, T2_1, T2_M: Time information

[0047] WL0~WL2,WL4~WL6: word line DETAILED DESCRIPTION

[0048] Figure 1 1 is a schematic diagram of a memory device 100 according to an embodiment of the present invention. The electronic device 100 includes a flash memory module 120 and a flash memory controller 110, and the flash memory controller 110 is used to access the flash memory module 120. According to this embodiment, the flash memory controller 110 includes a microprocessor 112, a read only memory (ROM) 112M, a control logic 114, a buffer memory 116, and an interface logic 118. The ROM 112M is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control the access to the flash memory module 120. The control logic 114 includes an encoder 132 and a decoder 134 , wherein the encoder 132 is used to encode the data written into the flash memory module 120 to generate a corresponding check code (or error correction code (ECC)), and the decoder 134 is used to decode the data read from the flash memory module 120 .

[0049] In a typical case, the flash memory module 120 includes a plurality of flash memory chips, each of which includes a plurality of blocks, and the flash memory controller 110 performs an erase operation on the flash memory module 120 in units of blocks. In addition, a block can record a specific number of data pages, wherein the flash memory controller 110 performs a write operation on the flash memory module 120 in units of data pages. In the present embodiment, the flash memory module 120 is a 3D NAND-type flash module.

[0050] In practice, the flash memory controller 110, which executes the program code 112C through the microprocessor 112, can use its own internal components to perform a variety of control operations, such as: using the control logic 114 to control the access operation of the flash memory module 120 (especially the access operation to at least one block or at least one data page), using the buffer memory 116 to perform the required buffer processing, and using the interface logic 118 to communicate with a host device 130. The buffer memory 116 is implemented as a random access memory (Random Access Memory, RAM). For example, the buffer memory 116 can be a static random access memory (Static RAM, SRAM), but the present invention is not limited to this. In addition, the flash memory controller 110 is coupled to a dynamic random access memory (Dynamic Random Access Memory, DRAM) 140. Please note that the DRAM 140 can also be included in the flash memory controller 110, for example, in the same package as the flash memory controller 110.

[0051] In one embodiment, the memory device 100 may be a portable memory device (e.g., a memory card that complies with SD / MMC, CF, MS, or XD standards), and the host device 130 is an electronic device that can be connected to the memory device 100, such as a mobile phone, a notebook computer, a desktop computer, etc. In another embodiment, the memory device 100 may be a solid state drive or an embedded storage device that complies with Universal Flash Storage (UFS) or Embedded MultiMedia Card (EMMC) specifications, and may be set in a mobile phone, a notebook computer, or a desktop computer, and in this case, the host device 130 may be a processor of the mobile phone, the notebook computer, or the desktop computer.

[0052] Figure 2FIG. 2 is a schematic diagram of a block 200 in a flash memory module 120 according to an embodiment of the present invention, wherein the flash memory module 120 is a three-dimensional NAND flash memory. Figure 2 As shown, block 200 includes a plurality of memory cells (such as the floating gate transistor 202 shown in the figure or other charge trap elements), which form a three-dimensional NAND flash memory architecture through a plurality of bit lines (only BL1 to BL3 are shown in the figure) and a plurality of word lines (such as WL0 to WL2, WL4 to WL6 shown in the figure). Figure 2 In the example of the top plane, all floating gate transistors on word line WL0 constitute at least one data page, all floating gate transistors on word line WL1 constitute another at least one data page, and all floating gate transistors on word line WL2 constitute another at least one data page... and so on. In addition, depending on the different writing methods of the flash memory, the definition between word line WL0 and data page (logical data page) will also be different. Specifically, when writing using single-level cell (SLC) method, all floating gate transistors on word line WL0 correspond to only one logical data page; when writing using multi-level cell (MLC) method, all floating gate transistors on word line WL0 correspond to two logical data pages; when writing using triple-level cell (TLC) method, all floating gate transistors on word line WL0 correspond to three logical data pages; and when writing using quad-level cell (QLC) method, all floating gate transistors on word line WL0 correspond to four logical data pages. Since a person skilled in the art should be able to understand the structure of a three-dimensional NAND flash memory and the relationship between a word line and a data page, the relevant details are not described in detail here.

[0053] Figure 3 The flowchart of establishing a write time record table according to an embodiment of the present invention is shown. In step 300, the process starts, the flash memory controller 110 is powered on and completes the initialization operation. In step 302, the flash memory controller 110 selects a block from multiple blank blocks of the flash memory module 120, and prepares to write data from the main device 130 to the block. In step 304, the flash memory controller 110 writes the data starting from the first data page of the block, and writes the corresponding time information (i.e., the write time) to the spare area at least when the data is written to the first data page. Specifically, refer to Figure 4The schematic diagram of the flash memory module 120 shown in the figure assumes that block B1 includes multiple data pages P1~P256, and the flash memory controller 110 writes the data from the main device 130 in sequence starting from the first data page P1 of block B1, wherein when the flash memory controller 110 is ready to write data to the data page P1, the flash memory controller 110 will simultaneously capture the current time information T1_1, for example, the corresponding time information can be generated by a built-in timer or the absolute time from the main device 130 (for example, 2:00 p.m. on May 11, 2020), and the data from the main device and the related time information T1_1 are written into the data page P1 together, wherein the time information T1_1 can be written into the spare area located at the back end of the data page P1.

[0054] In one embodiment, the flash memory controller 110 may also write the corresponding time information into the spare area when writing data into the intermediate data page. Specifically, when the flash memory controller 110 is ready to write data into the intermediate data page P128, the flash memory controller 110 will simultaneously capture the current time information T1_M and write the data from the main device and the related time information T1_M into the data page P128, wherein the time information T1_M may be written into the spare area located at the back end of the data page P128. It should be noted that the data pages P2 to P127 between the first data page P1 and the intermediate data page P128 do not need to write any time information to reduce the burden on the flash memory controller 110. It should be noted that the spare area of ​​the above-mentioned data page can also be called a management area, that is, it is used to store some management data, such as logical addresses... and so on.

[0055] It should be noted that in Figure 4 In the embodiment of the present invention, data page P128 is used as the intermediate data page, but this is only an example and not a limitation of the present invention. In other embodiments, data page P127 can also be used as the intermediate data page, or data pages P127 and P128 can be used as the intermediate data page at the same time. In addition, in another embodiment, the number of intermediate data pages can be multiple data pages. For example, the four data pages P126, P127, P128, and P129 are all used as the multiple intermediate data pages described in this embodiment, that is, the spare areas of data pages P126, P127, P128, and P129 all store corresponding time information.

[0056] Then, the flash memory controller 110 sequentially writes data to the data pages P129, P130, ... until the flash memory controller 110 is ready to write data to the last data page (i.e., data page P256), the flash memory controller 110 at least writes the time information T1_M of the previous data page P1 together with the data from the host device 130 to the data page P256, wherein the time information T1_M can be written to the spare area located at the rear end of the data page P256. In one embodiment, if Figure 4 As shown, the flash memory controller 110 writes the time information T1_1 of the first data page P1 and the time information T1_M of the intermediate data page P128 together with the data from the host device 130 into the data page P256.

[0057] In step 306, during the data writing process of block B1, the flash memory controller 110 will synchronously create the following in the DRAM 140: Figure 5 The writing time record table 500 shown, that is, the writing time record table 500 at least records the block number B1 and the corresponding time information T1_1. In one embodiment, the writing time record table 500 records the block number B1 and the corresponding time information T1_1 and T1_M. It should be noted that the write time record table 500 records the time information T1_1 of the first data page P1 and the time information T1_M of the intermediate data page (for example, data page P128). If, as described in the previous paragraph, each block has multiple intermediate data pages set, for example, when the four data pages P126, P127, P128, and P129 are simultaneously used as intermediate data pages, then the write time record table 500 can generate a single time information of the intermediate data page based on the multiple time information recorded in the data pages P126, P127, P128, and P129, for example, averaging the multiple time information recorded in the data pages P126, P127, P128, and P129 or taking the middle value to obtain a single time information corresponding to the intermediate data page.

[0058] It should be noted that for some memory devices that do not have the DRAM 140 , the above-mentioned write time record table 500 can also be stored in the buffer memory 116 .

[0059] In step 308, the microprocessor 112 determines whether all data pages of the current block B1 are fully written. If not, the process returns to step 304 to continue writing data to the remaining data pages of block B1. If so, the process returns to step 302 to select the next blank block, such as Figure 4As shown in block B2, then, similar to the data writing process of the flash memory controller 110 to block B1, when the flash memory controller 110 is ready to write data to the data page P1 of block B2, the flash memory controller 110 will simultaneously capture the current time information T2_1, and write the data from the master device and the related time information T2_1 into the data page P1 of block B2; when the flash memory controller 110 is ready to write data to the data page P128 of block B2, the flash memory controller 110 will simultaneously capture the current time information T2_M, and write the data from the master device and the related time information T2_M into the data page P128 of block B2; and when the flash memory controller 110 is ready to write data to the data page P256, the flash memory controller 110 will write the time information T2_1 of the previous data page P1 and the time information T2_M of the data page P128 together with the data from the master device 130 into the data page P256. In addition, the microprocessor 112 updates the write time record table 500 to record the block number B2 and the corresponding time information T2_1 and T2_M.

[0060] Whenever a blank block in the flash memory module 120 starts to write data, the microprocessor 112 will update the write time record table 500, that is, the write time record table 500 at least records the time information of the first data page P1 of each block in the flash memory module 120. In one embodiment, the write time record table 500 will also record the time information of the intermediate data pages (such as data page P128).

[0061] In addition, the write time record table 500 will reside in the DRAM 140 to facilitate subsequent use in expired block judgment or garbage collection operations. When the memory device 100 needs to be powered off, the microprocessor 112 will first write the write time record table 500 into the flash memory module 120, and wait for the memory device 100 to be powered on before re-reading the write time record table 500 in the flash memory module 120 and loading it into the DRAM 140 for subsequent use.

[0062] Since the flash memory module 120 has a very poor data retention time when using a flash memory chip with a multi-layer stacking structure, that is, the quality of the data will quickly decline after a few weeks (for example, 2 to 3 weeks) after being written, causing difficulty in subsequent decoding or even being unable to read. Therefore, the write time record table 500 of the above embodiment can be used to quickly let the microprocessor 112 know the quality of the block, so as to perform expired block recovery operations on these blocks with too long a write time, so as to avoid data loss in the block due to long-term storage.

[0063] In addition, in some applications, the flash memory module 120 may have thousands of blocks and be frequently written, so the write time record table 500 may need to record many block numbers and related time information, which seriously consumes the storage space of the DRAM 140. In addition, if the memory device 100 does not have the DRAM 140 and the write time record table 500 needs to be stored in the buffer memory 116, then at this time, since the buffer memory 116 is usually implemented using a more expensive SRAM and the capacity is usually not too large, it will cause more trouble in the memory configuration of the buffer memory 116. As described above, in the following embodiments, a compression method for the write time record table 500 is also proposed, which can write most of the content of the write time record table 500 into the blocks of the flash memory module 120 to reduce the size of the write time record table 500 stored in the DRAM 140 or the buffer memory 116.

[0064] For example, refer to Fig. 6A The schematic diagram of the compressed write time record table 600 is shown, wherein the compressed write time record table 600 can be obtained by simplifying and compressing the write time record table 600. Fig. 6A In the compressed write time record table 600, multiple time ranges and corresponding at least one data page address are included, wherein the multiple time ranges can be any suitable time range, and the preferred range can be between half a day and two days, and in this embodiment, the time range is in units of one day. Fig. 6A In the embodiment of the present invention, the microprocessor 112 sequentially or periodically writes the block number and the corresponding time information in the write time record table 500 into the block of the flash memory module 120. Fig. 6AThe time range is today's situation to illustrate that when the flash memory controller 110 writes data to multiple blocks of the flash memory module 120, it simultaneously establishes a write time record table 500. If the data volume of the time record table 500 reaches the data volume of a data page of the flash memory, the microprocessor 112 can write the block number and the corresponding time information recorded in the write time record table 500 into the data page P25 of the block B200, or only record the block number without recording the corresponding time information, and the compressed write time record table 600 records the physical data page address "PPA200025" of the data page P25 of the block B200. Please note that the data stored in the DRAM The compressed write time record table 600 of 140 can be regarded as an index. This index allows the microprocessor 112 to easily find the physical block page address of the actual storage time record table 500. After that, the microprocessor 112 can read the complete content of the write time record table 500 according to the physical data page address "PPA200025" found. In addition, since the data page P25 of block B200 has recorded the content of the write time record table 500, the microprocessor 112 can delete the relevant data in the write time record table 500 to release the memory space. Similarly, Fig. 6A The time range shown is that the data page address "PPA201046" recorded in "Yesterday" corresponds to the data page P46 of block B201, and the data page P46 of block B201 records the block written yesterday and the corresponding time information; similarly, Fig. 6A The data page address "PPA202037" recorded in the time range "the day before yesterday" corresponds to the data page P37 of block B202, and the data page P37 of block B202 records the block written the day before yesterday and the corresponding time information. Figure 5 The content of the write time record table 500 shown can be stored in the flash memory module 120, and the compressed write time record table 600 only needs to record some data page addresses in the flash memory module 120, thereby effectively reducing the burden of the write time record table 500 on the memory space.

[0065] In practice, "today", "yesterday", and "the day before yesterday" written into the time record table 600 after compression are an absolute time range. For example, "today" is 00:00-24:00 on May 21, 2020, "yesterday" is 00:00-24:00 on May 20, 2020, and "the day before yesterday" is 00:00-24:00 on May 19, 2020.

[0066] In addition, to facilitate the management of blocks and data pages, each time range in the compressed write time record table 600 corresponds to an exclusive block. For example, the block numbers and time information of all blocks that had data written the day before yesterday (2 days ago) were written to block B202, the block numbers and time information of all blocks that had data written yesterday (1 day ago) were written to block B201, and the block numbers and time information of all blocks that had data written today were written to block B200, and so on. In addition, the above-mentioned exclusive blocks will not be used to store other data. If exclusive blocks are used for recording, the content that needs to be recorded can be further simplified. Please refer to Figure 6B , Figure 6B The table includes a currently written block table 630 and an expired reclaimed block index table 632, which can be used as an example of a compressed write time record table. The expired reclaimed block index table 632 and the currently written block table 630 can exist in the DRAM 140. The currently written block table 630 includes fields for the time range and the currently written block, and the expired reclaimed block index table 632 includes a time range field, a dedicated physical block number field, and a physical data page number field. The time range field of the currently written block table 630 can be fixed to today, and this field can also be omitted. The time fee is determined only based on the sorting, for example, the first one is today, the second one is 1 day ago, the third one is 2 days ago...etc., to further save the required memory space. The currently written block table 630 is used to store the physical block numbers written by the flash memory controller 110 in a specific time range (such as today), for example Figure 6BAs shown, block B123, block B234, block B345, block B666, etc. are written today. When the amount of data recorded in the current write block table 630 has filled up a write unit (e.g., a data page) of the flash memory, the flash memory controller 110 will write the data into the flash memory module 120, and after the write is successful, clear the content in the current write block field. The flash memory controller 110 can write the block numbers of block B123, block B234, block B345, block B666, etc. into the fourth page P004 of the physical block B200 exclusive to today, and update the physical data page number field corresponding to today in the expired recovery block index table 632, and update it to P001, P002, P003, P004. The exclusive physical block number field represents the block written at a specific time, and its block number should be stored in the exclusive block. For example, the block number of the block written today should be stored in block B200, and the block number of the block written 1 day ago should be stored in block B201. The block number of the block written 2 days ago should be stored in block B202. The physical data page number field represents the block written at a specific time, and its block number is stored in a specific data page of the dedicated block. For example, the block number of the block written today is stored in the physical data pages P001, P002, P003, and P004 of block B200. If more blocks are written today, and the amount of data currently written into the block table 630 fills up a data page of a flash memory, then these block numbers should be written into the physical data page P005 of block B200, and the flash memory controller 110 updates the physical data page number field corresponding to today in the expired recovery block index table 632, and updates it to P001, P002, P003, P004, and P005.

[0067] In one embodiment, the flash memory controller 110 may erase the blocks that have been written, such as erasing the blocks B123, B234, and B345 that have been written. These erased blocks do not need to be reclaimed as expired blocks, so the expired reclaimed block index table 632 and the content of the exclusive block B200 need to be updated. Before erasing blocks B123, B234, and B345, the flash memory controller 110 can find that these blocks were written today based on the write time recorded in the data page P1 or the middle page of blocks B123, B234, and B345, and then search the expired reclaimed block index table 632 to find that the blocks written today are recorded in the physical data pages P001, P002, P003, P004, and P005 of the exclusive physical block B200. The flash memory controller 110 reads the physical data pages P001, P002, P003, P004, and P005 of the exclusive physical block B200, obtains the physical block numbers written today, deletes the blocks B123, B234, and B345 that are about to be erased from the read physical block numbers, and then writes the remaining physical block numbers into the physical data pages P006, P007, P008, P009, and P010 of the exclusive physical block B200. The flash memory controller 110 updates the content of the expired recovery block index table 632, updates the block numbers written today, and updates the content of the physical data page number field corresponding to today to P006, P007, P008, P009, and P010. Please note that if the host frequently updates data and causes the exclusive block B200 to be full and insufficient for use, the flash memory controller 110 can extract other blocks (such as block B300) as today's exclusive blocks, write the useful data in the original block B200 into the new exclusive block B300, and update the content of the expired recovery block index table 632, and update the exclusive block corresponding to today to block B300. Similarly, the update of other time ranges is also similar to the update method of today's exclusive block, which will not be repeated here.

[0068] Since the expired recovery block index table 632 records a single exclusive physical block number and the data page number of the exclusive physical block, the memory space required is smaller than that required to record the complete data page address in the compressed write time record table 600. And because it uses exclusive blocks to record blocks written in a certain time range, it is more convenient to manage, and it is easier to write, update, and query.

[0069] In one embodiment, the memory space required for the expired reclaimed block index table 652 can be further reduced. Figure 6C . Figure 6CThe expired reclaimed block index table 652 is included. The expired reclaimed block index table 652 may exist in DRAM 140. The expired reclaimed block index table 652 includes a time range field, an exclusive physical block number field, and a physical data page number field. The records and operations of the expired reclaimed block index table 652 are similar to those of the expired reclaimed block index table 632. The main difference is that the physical data page number field of the expired reclaimed block index table 652 only records the data page range with valid information in the exclusive physical block. For example, the block written today is stored in data pages P001 to P004 of the exclusive physical block B200. When the flash memory controller 110 wants to query all the blocks written today, the flash memory controller 110 can use the expired recovery block index table 652 to find that the blocks are stored in the data pages P001 to P004 of the block B200, and the flash memory controller 110 can read all the block numbers written today from the data pages P001 to P004 of the block B200. Since only the data page range with valid information in the block is recorded, the expired recovery block index table 652 can further save storage space. Please note that if only one page of space is needed to record all the blocks written within the time range, the recording method 13 days ago in the expired recovery block index table 652 can be referred to, and data pages P100 and P100 are recorded, which means that the data page range with valid information in the block is data page P100 to data page P100.

[0070] One benefit of using dedicated blocks for time recording is that it makes expired block recovery easier. For example, the algorithm for expired block recovery can be designed to recover all blocks written the day before yesterday. At this time, it is only necessary to find the physical data page number in the dedicated block (for example, the dedicated block corresponding to the day before yesterday) according to the expired recovery block index table 652, read these data pages, and the blocks recorded in these data pages are the block numbers that have not yet been recovered, and then expired blocks are recovered for these blocks.

[0071] In addition, since the blocks in the flash memory module 120 may be erased and become blank blocks, when the microprocessor 112 learns that a block is erased, it will update the contents of the flash memory module 120 and the compressed write time record table 600. Figure 7 The flowchart of updating the compressed write time record table 600 and related contents is shown. In step 700, the process starts. In step 702, the microprocessor 112 determines whether there is a block to be erased in the flash memory module 120. If yes, the process proceeds to step 704; if not, the process stops at step 702. In step 704, the microprocessor 112 determines whether the block to be erased corresponds to Fig. 6AFor example, the microprocessor 112 may first read the time information recorded in the first data page of the block to be erased to determine which time range the block corresponds to. Figure 8 , assuming that the microprocessor 112 writes data to multiple blocks B60-B90 in the time range of "yesterday", and the data page P46 of the block (the block dedicated to "yesterday") B201 records the time information of each block in the blocks B60-B90, such as the time information of the first data page of each block in the blocks B60-B90. In this embodiment, it is assumed that the blocks to be erased are blocks B71-B74.

[0072] In step 706, according to the time range determined in step 704, the microprocessor 112 reads the last written one or more data pages of the exclusive block corresponding to the time range according to the data page address recorded in the compressed write time record table 600. In this example, the microprocessor 112 reads the last written data page P46 of block B201, wherein the data page P46 records the time information of each block in blocks B60-B90, and the microprocessor 112 temporarily stores the time information of blocks B60-B90 in the buffer memory 116 or the DRAM 140.

[0073] In step 708 , the microprocessor 112 erases the contents of blocks B71 ˜ B74 or marks blocks B71 ˜ B74 as invalid blocks. Then, the microprocessor 112 deletes the time information of blocks B71 ˜ B74 from the buffer memory 116 or the DRAM 140 .

[0074] In step 710 , the microprocessor 112 writes the updated content, ie, the time information of blocks B60 - B70 and B75 - 90 , into the data page P47 of block B201 , and records the content of the data page P46 of block B201 as invalid data.

[0075] After the data page P47 of block B201 is written, in step 712, the microprocessor 112 updates the contents of the compressed write time record table 600. Fig. 6A The data page address "PPA201046" corresponding to "yesterday" is modified to the address of data page P47 of block B201. After that, the process returns to step 702.

[0076] As mentioned above, through Figure 7 The process shown can make the content of one or more data pages last written into the exclusive block corresponding to each time range the latest data, while the content recorded in the previous data pages becomes invalid data, so as to facilitate subsequent management.

[0077] In addition, the memory device 100 may be suddenly powered off due to various reasons, which may cause the post-compression write time record table 600 stored in the DRAM 140 to be lost. Therefore, after the memory device 100 is powered on again, the post-compression write time record table 600 needs to be re-established in the DRAM 140. Fig. 9 The flowchart of the memory device according to one embodiment of the present invention is shown in which the compressed write time record table 600 is established in the DRAM 140 after the memory device is powered on. At step 900, the process starts, and the memory device 100 is powered on and starts the initialization operation. At step 902, the microprocessor 112 determines whether the power failure of the memory device 100 before powering on is an abnormal power failure (sudden power failure). If not, the process enters step 904 to read the compressed write time record table 600 from the flash memory module 120 and temporarily store it in the DRAM 140; if so, the process enters step 906. For example, when the memory device 100 is normally shut down / powered off, the flash memory controller 110 stores multiple temporary tables (including the compressed write time record table 600) and data stored in the buffer memory 116 and the DRAM 140 in the flash memory module 120, and includes a tag (flag) for indicating whether the memory device 100 is normally shut down. Therefore, after powering on, the flash memory controller 110 can read the above-mentioned tag stored in the flash memory module 120 to determine whether the memory device 100 has previously encountered an abnormal power outage. For example, when the above-mentioned tag is not correctly set, it is determined that an abnormal power outage has previously been encountered. In step 906, the microprocessor 112 determines whether the last block written before the power off before the power on of the memory device 100 is an exclusive block for storing the time information of the block, for example Fig. 6A If not, the process goes to step 908; if yes, the process goes to step 910. It should be noted that the last block written before power failure before powering on the memory device 100 can be obtained by scanning the blocks during the initialization process of the flash memory controller 110.

[0078] In step 908, assume that a dedicated block is used to store the time information of the block, such as Fig. 6A The blocks B200, B201, and B202 shown are located in a specific area of ​​the flash memory module 120. Therefore, the microprocessor 112 can directly read all the blocks in the specific area, for example, read multiple block time information recorded in the last or multiple data pages of all the blocks in the specific area to obtain similar Figure 5The write time record table 500 shown in FIG. 1 is not required to read all blocks in the entire flash memory module 120. Afterwards, the microprocessor 112 compresses the write time record table 500 to obtain a similar Fig. 6A , Figure 6B , Figure 6C The compressed write time record table 600 or the expired recovery block index table 632, 652 are shown.

[0079] In step 910, since the data of the block normally written to the flash memory module 120 may be damaged in the abnormal power failure, if the last block written before the power failure before the power is turned on is a dedicated block for storing the time information of the block, the microprocessor 112 sequentially reads the first data page or the last data page of each block with data written in the flash memory module 120 (for example, Figure 4 The data page P256 shown in FIG. 1 is used to obtain the time information of the first data page of each block and / or the time information of the intermediate data page, so as to obtain a similar Figure 5 The microprocessor 112 then compresses the write time record table 500 to obtain a similar Fig. 6A , Figure 6B , Figure 6C The compressed write time record table 600 or the expired recovery block index table 632, 652 are shown.

[0080] After obtaining the time information of each block with data written to re-establish the compressed write time record table 600 in the DRAM 140, the process enters 912 to end the operation.

[0081] Fig.10 Flowchart of an expired block recovery operation according to an embodiment of the present invention. In step 1000, the process starts, and the memory device 100 has completed the initialization operation. In step 1002, the microprocessor 112 determines at least one time range according to the current time. For example, assuming that the quality of the data written into the flash memory module 120 will be greatly degraded after 14 days according to the experimental measurement results, the time range that the microprocessor 112 can select is "13 days ago". In step 1004, the microprocessor 112 selects an exclusive block corresponding to the time range of "13 days ago" according to the data page address recorded in the compressed write time record table 600.

[0082] In step 1006, the microprocessor 112 reads the exclusive blocks determined in step 1004 to determine the multiple blocks that were written with data 13 days ago, and adds the multiple blocks to an expired block table (for example, the block numbers of these blocks are recorded in the expired block table), and marks these blocks as pending blocks. In this embodiment, the expired block table is used to record the priority of expired block recycling, and has a fixed size (that is, the number of blocks that can be recorded has an upper limit value). Therefore, if the number of the multiple blocks is too large, the block with earlier time information of the first data page P1 can be preferentially selected to be added to the expired block table, and the time information of the intermediate data page can also be referenced as a backup reference. For example, the microprocessor 112 can prioritize adding a block whose time information of the first data page P1 among multiple blocks in which data was written 13 days ago and whose time information is earlier than a first threshold value to the expired block table based on the exclusive block record, and then add blocks whose time information of the middle data page P128 among the multiple blocks and whose time information is earlier than a second threshold value to the expired block table in sequence, wherein the second threshold value is later than the first threshold value.

[0083] In step 1008, the microprocessor 112 performs expired block recovery operations in sequence according to the blocks recorded in the above-mentioned expired block table. Specifically, the microprocessor 112 can move the valid data in the block recorded in the expired block table to a blank data page, and after the valid data of the block is completely moved, mark the block as invalid or erase it. It should be noted that the expired block recovery operation described in step 1008 can be performed in the background, that is, when the flash memory controller 110 is in an idle state (for example, it does not need to process the access instruction from the main device 130), the microprocessor 112 can start to execute the expired block recovery operation until the flash memory controller 110 receives the access instruction from the main device 130 and needs to start being busy.

[0084] In step 1010, since the block is written and erased during the expired block recovery operation in step 1008, the microprocessor 112 updates the compressed write time record table 600 according to the writing and erasing of the block, for example Figure 7 The process is shown in the figure.

[0085] Due to the continuous increase in the unit density of the memory capacity of the three-dimensional NAND flash memory, the memory performance continues to deteriorate. After the data is written to the new three-dimensional NAND flash memory, the charge stored in the gate of the memory cell will continue to be lost. After a period of time, the charge stored in the gate of some memory cells can no longer reflect the charge amount of the data originally intended to be stored, resulting in frequent errors during reading. These errors usually require the flash memory controller to start the correction mechanism of changing the read voltage and hard decoding and soft decoding in order to read the correct data from these expired blocks. These correction mechanisms are usually very time-consuming and power-consuming, and may not be able to correct the errors at all, resulting in the memory controller not being able to read the correct data. Therefore, it is necessary to record the write time of the block to avoid the above problems. It should be noted that the expired block recovery operation described in the above embodiment is different from the garbage collection operation, and the expired block table of this embodiment is also different from the garbage collection sequence required for the garbage collection operation. Specifically, during the operation of the memory device 100, the flash memory controller 110 will continuously determine the number of valid data pages of each block in the current flash memory module 120 to determine which blocks need to be garbage collected. For example, when the number of valid data pages of a block is lower than a critical value, the block will be placed in the garbage collection sequence to perform garbage collection operations later. However, the expired block table described in this embodiment records blocks that have been written for too long, that is, some of these blocks may not meet the standard of garbage collection operations, for example, the number of valid data pages of these blocks is much higher than the critical value. In addition, since the data of the blocks recorded in the expired block table will deteriorate rapidly, the priority of the expired block table is higher than the garbage collection sequence, that is, if any block number is recorded in the expired block table, then in the case where the garbage collection operation is allowed to be interrupted, the flash memory controller 110 will stop the garbage collection operation first and start the expired block recovery operation. In other words, the flash memory controller 110 will immediately perform an expired block recycling operation on the blocks recorded in the expired block table.

[0086] Referring to the above embodiments, a write time record table 500 is established to record the time information of the first data page and the intermediate data page of each block, and the write time record table 500 is compressed to generate a compressed write time record table 600. Overall, the blocks that need to be recovered from expired blocks can be selected more quickly and efficiently, and will not occupy too much storage space in the buffer memory 116 or the DRAM 140.

[0087] In addition, the expired block recovery operation needs to cooperate with the logical data page and physical data page link table to find all valid data pages of the block, and move the valid data page from the expired block to the new block. The data in the valid data page is rewritten to the new block due to the move, and the validity period of these data is reset, and the expired block is erased for standby. After moving the valid data, the microprocessor 112 needs to update the logical data page and physical data page link table and establish a data number table of valid data pages of the new block. For the sake of caution, the invalid data in the expired block can also be moved to another new block, and the logical data page and physical data page link table of invalid data can be established accordingly to avoid the host from accidentally deleting the data and still being able to save the data. Please note that in some expired blocks, all the data pages may be valid data pages, then all the data must be moved to the new data and the validity period of all the data must be reset.

[0088] To briefly summarize the present invention, in the control method of a flash memory controller of the present invention, a write time record table 500 is established to record the time information of the first data page and the intermediate data page of each block, and the write time record table 500 is compressed to generate a compressed write time record table 600. Overall, the blocks that need to be reclaimed after the expired block operation can be selected more quickly and efficiently, and it will not occupy too much storage space in the buffer memory 116 or the DRAM 140.

[0089] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A control method applied to a flash memory controller, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes a plurality of blocks, and each block includes a plurality of data pages, and the control method includes: When data is written into any block of the flash memory module, a writing time is recorded in the block; Establishing a write time record table, wherein the write time record table records the block number of the block in the flash memory module where data is written and the corresponding write time; Compressing the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes a plurality of time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the block numbers and the write time of all blocks whose write time is within the corresponding time range; Determine a specific time range of the multiple time ranges in the compressed write time record table according to the current time when the control method is executed, and read multiple block numbers and corresponding write times from the flash memory module according to the data page address corresponding to the specific time range; Recording at least a portion of the block numbers in an expired block table; as well as According to the at least a portion of the block numbers recorded in the expired block table, the valid data in the blocks having the at least a portion of the block numbers are sequentially moved to at least one blank block; The multiple time ranges correspond to multiple exclusive blocks respectively, and the index value corresponding to each time range is the last one or more data pages in the corresponding exclusive block; the exclusive block corresponding to each time range only stores the block numbers of all blocks whose write time is within the time range, and does not store the block numbers of blocks whose write time is within any other time range.

2. The control method according to claim 1, characterized in that: Also included: When the flash memory controller is ready to shut down, writing the compressed write time record table into a specific block of the flash memory module; When the flash memory controller is powered on, determining whether the flash memory controller encounters an abnormal power failure before powering on; If it is determined that the flash memory controller does not encounter an abnormal power failure before powering on, the write time record table is read from the specific block and temporarily stored in a buffer memory or a dynamic random access memory; as well as If it is determined that the flash memory controller encounters an abnormal power outage before power-on, at least a portion of the multiple blocks in the flash memory module are read to re-establish the compressed write time record table, and the compressed write time record table is temporarily stored in a buffer memory or a dynamic random access memory.

3. The control method according to claim 2, characterized in that: The multiple time ranges correspond to multiple exclusive blocks respectively, and the index value corresponding to each time range is the last one or more data pages in the corresponding exclusive block; and if it is determined that the flash memory controller encounters an abnormal power failure before powering on, the step of reading at least a portion of the multiple blocks in the flash memory module to re-establish the compressed write time record table includes: determining whether the last block written by the flash memory controller before power-off before power-on is one of the multiple exclusive blocks; If the last block written by the flash memory controller before power-off before power-on is not one of the multiple exclusive blocks, read the multiple exclusive blocks to obtain the write time corresponding to the block with data written in the flash memory module, and re-establish the write time record table based on the write time. If the last block written by the flash memory controller before power-off before power-on is one of the multiple dedicated blocks, sequentially read the data page of each block in the flash memory module to which data is written, so as to obtain the writing time corresponding to the block in the flash memory module to which data is written, and re-establish the writing time record table based on the writing time; as well as The re-established write time record table is compressed to re-establish the compressed write time record table.

4. The control method according to claim 2, characterized in that: The operation of re-establishing the compressed write time record table is completed within the time of an initialization operation after the flash memory controller is powered on.

5. A flash memory controller, wherein the flash memory controller is used to access a flash memory module, and the flash memory controller comprises: A read-only memory for storing a program code; a microprocessor, used to execute the program code to control access to the flash memory module; as well as a buffer memory; When the microprocessor writes data to any block of the flash memory module, a write time is recorded in the block, and a write time record table is established, wherein the write time record table records the block number of the block in the flash memory module where the data is written and the corresponding write time; and the microprocessor compresses the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes multiple time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the block numbers and the write times of all blocks whose write times are within the corresponding time range; The microprocessor determines a specific time range of the multiple time ranges in the compressed write time record table according to the current time, and reads multiple block numbers and corresponding write times from the flash memory module according to the index value corresponding to the specific time range; the microprocessor records at least a portion of the multiple block numbers in an expired block table, and according to the at least a portion of the block numbers recorded in the expired block table, sequentially moves valid data in the blocks having the at least a portion of the block numbers to at least one blank block; The multiple time ranges correspond to multiple exclusive blocks respectively, and the index value corresponding to each time range is the last one or more data pages in the corresponding exclusive block; the exclusive block corresponding to each time range only stores the block numbers of all blocks whose write time is within the time range, and does not store the block numbers of blocks whose write time is within any other time range.

6. The flash memory controller according to claim 5, wherein: When the flash memory controller is ready to shut down, the microprocessor writes the compressed write time record table into a specific block of the flash memory module; when the flash memory controller is powered on, the microprocessor determines whether the flash memory controller encounters an abnormal power failure before powering on, and if it is determined that the flash memory controller does not encounter an abnormal power failure before powering on, the microprocessor reads the write time record table from the specific block and temporarily stores the write time record table in a buffer memory or a dynamic random access memory; And if it is determined that the flash memory controller encounters an abnormal power outage before power-on, the microprocessor reads at least a portion of the multiple blocks in the flash memory module to re-establish the compressed write time record table, and temporarily stores the compressed write time record table in the buffer memory or a dynamic random access memory.

7. The flash memory controller according to claim 6, wherein: If it is determined that the flash memory controller encounters an abnormal power failure before power-on: the microprocessor determines whether the last block written by the flash memory controller before the power failure before power-on is one of the multiple exclusive blocks; if the last block written by the flash memory controller before the power failure before power-on is not one of the multiple exclusive blocks, the microprocessor reads the multiple exclusive blocks to obtain the write time corresponding to the block with data written in the flash memory module, and re-establishes the write time record table based on the write time. If the last block written by the flash memory controller before power-off before power-on is one of the multiple dedicated blocks, the microprocessor sequentially reads the data page of each block in the flash memory module to which data is written, so as to obtain the writing time corresponding to the block in the flash memory module to which data is written, and re-establishes the writing time record table accordingly; And the microprocessor compresses the re-established write time record table to re-establish the compressed write time record table.

8. The flash memory controller according to claim 6, wherein: The operation of re-establishing the compressed write time record table is completed within the time of an initialization operation after the flash memory controller is powered on.

9. A memory device comprising: a flash memory module; as well as a flash memory controller for accessing the flash memory module; When the flash memory controller writes data to any block of the flash memory module, a write time is recorded in the block, and a write time record table is established, wherein the write time record table records the block number of the block in the flash memory module where the data is written and the corresponding write time; and the flash memory controller compresses the write time record table to generate a compressed write time record table, wherein the compressed write time record table includes multiple time ranges and corresponding index values, wherein each index value corresponds to a data page of the flash memory module, and the data page records the block numbers and the write times of all blocks whose write times are within the corresponding time range; The flash memory controller determines a specific time range of the multiple time ranges in the compressed write time record table according to the current time, and reads multiple block numbers and corresponding write times from the flash memory module according to the index value corresponding to the specific time range; the flash memory controller records at least a portion of the multiple block numbers in an expired block table, and according to the at least a portion of the block numbers recorded in the expired block table, sequentially moves valid data in the blocks having the at least a portion of the block numbers to at least one blank block; The multiple time ranges correspond to multiple exclusive blocks respectively, and the index value corresponding to each time range is the last one or more data pages in the corresponding exclusive block; the exclusive block corresponding to each time range only stores the block numbers of all blocks whose write time is within the time range, and does not store the block numbers of blocks whose write time is within any other time range.

10. The memory device according to claim 9, characterized in that When the flash memory controller is ready to shut down, the flash memory controller writes the compressed write time record table into a specific block of the flash memory module; when the flash memory controller is powered on, the flash memory controller determines whether the flash memory controller encounters an abnormal power failure before powering on, and if it is determined that the flash memory controller does not encounter an abnormal power failure before powering on, the flash memory controller reads the write time record table from the specific block and temporarily stores the write time record table in a buffer memory or a dynamic random access memory; And if it is determined that the flash memory controller encounters an abnormal power outage before power-on, the flash memory controller reads at least a portion of the multiple blocks in the flash memory module to re-establish the compressed write time record table, and temporarily stores the compressed write time record table in the buffer memory or a dynamic random access memory.

11. The memory device according to claim 10, characterized in that If it is determined that the flash memory controller encounters an abnormal power failure before power-on: the flash memory controller determines whether the last block written by the flash memory controller before the power failure before power-on is one of the multiple exclusive blocks; if the last block written by the flash memory controller before the power failure before power-on is not one of the multiple exclusive blocks, the flash memory controller reads the multiple exclusive blocks to obtain the write time corresponding to the block with data written in the flash memory module, and re-establishes the write time record table based on the write time; If the last block written by the flash memory controller before power-off before power-on is one of the multiple dedicated blocks, the flash memory controller sequentially reads the data page of each block in the flash memory module to which data is written, so as to obtain the writing time corresponding to the block in the flash memory module to which data is written, and re-establishes the writing time record table based on the writing time. And the flash memory controller compresses the re-established write time record table to re-establish the compressed write time record table.

12. The memory device according to claim 10, characterized in that The operation of re-establishing the compressed write time record table is completed within the time of an initialization operation after the flash memory controller is powered on.