Memory device, flash memory controller and control method thereof

By grouping L2P mapping tables and establishing G2P mapping tables, combined with the use of host buffers and buffer memory, the mapping table management problems caused by the increase in the capacity of flash memory modules are solved, and the efficiency and performance of flash memory controllers are improved.

CN119068952APending Publication Date: 2024-12-03SILICON MOTION INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410026167.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-06-01
Filing Date
2024-01-08
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

As the capacity of flash memory modules increases, the number of logical address to entity address mapping tables (L2P mapping tables) required by flash memory controllers has grown rapidly. How to efficiently manage these mapping tables has become an important topic, especially without dynamic random storage. In case of memory (DRAM).

Method used

Divide multiple L2P mapping tables into multiple groups, and establish a group-to-entity address (G2P) mapping table, update and manage the mapping tables through microprocessors, use host buffers and buffer memory for data processing and storage, and establish The storage unit links the relationship table and the last update of the storage unit table to optimize the update and management of the mapping table.

Benefits of technology

Effectively manage a large number of L2P mapping tables, improve the efficiency and performance of flash memory controllers, reduce dependence on DRAM, and reduce system resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119068952A_ABST
    Figure CN119068952A_ABST
Patent Text Reader

Abstract

The invention relates to a memory device, a flash memory controller and a memory control method. According to the method, a plurality of mapping tables from logical addresses to physical addresses are divided into a plurality of groups, a group-to-physical address mapping table and a storage unit connection relation table are established, and a storage unit table is finally updated to manage the flash memory controller, so that the number of times of loading the group-to-physical address mapping table into a buffer memory can be effectively reduced; therefore, the efficiency of the flash memory controller is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a flash memory. Background Art

[0002] In a flash memory controller, multiple logical address to physical address mapping tables (Logical address to physical address mapping table, L2P mapping table), hereinafter referred to as L2P mapping table, are established, wherein each L2P mapping table records multiple logical addresses and corresponding physical addresses, that is, records at which physical address in the flash memory module the data with these logical addresses are respectively stored. However, as the capacity of the flash memory module increases rapidly, the number of L2P mapping tables that need to be established by the flash memory controller is also increasing. In addition, some electronic devices do not have dynamic random access memory (DRAM) in order to reduce costs. Therefore, how to manage these increasing number of L2P mapping tables is an important issue. Summary of the invention

[0003] Therefore, one of the objectives of the present invention is to provide a control method for a flash memory controller, which can effectively manage the L2P mapping table to solve the problems described in the prior art.

[0004] In one embodiment of the present invention, a control method of a flash memory controller is disclosed, wherein the flash memory controller is coupled between a host device and a flash memory module, and the control method includes: dividing a plurality of L2P mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables in the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables in the plurality of L2P mapping tables; receiving a plurality of data from the host device, and writing the plurality of data into the flash memory module; updating a portion of the first L2P mapping tables in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and updating a portion of the second L2P mapping tables in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; writing the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; establishing a first group to physical address (Group to physical address) corresponding to the first group and the second group, respectively. address, G2P) mapping table and a second G2P mapping table, wherein the first G2P mapping table records the plurality of first L2P mapping tables and corresponding physical addresses; and the second G2P mapping table records the plurality of second L2P mapping tables and corresponding physical addresses; write the first G2P mapping table and the second G2P mapping table into the host buffer; establish a storage unit connection relationship table and a last updated storage unit table, which records the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; select the first a group, reading the first G2P mapping table from the host buffer and storing the first G2P mapping table in a buffer memory in the flash memory controller; reading the updated portion of the first L2P mapping table belonging to the first group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the first L2P mapping table to a first physical address of the flash memory module; updating the first G2P mapping table so that the updated portion of the first L2P mapping table corresponds to the first physical address.

[0005] In one 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 and a microprocessor. The microprocessor is used to perform the following steps: divide a plurality of L2P mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables in the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables in the plurality of L2P mapping tables; receive a plurality of data from the host device, and write the plurality of data into the flash memory module; update a portion of the first L2P mapping table in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and update a portion of the second L2P mapping table in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; write the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; establish a first G2P mapping table and a second G2P mapping table corresponding to the first group and the second group respectively, wherein the first G2P mapping table The invention relates to a method for storing a plurality of first L2P mapping tables and corresponding physical addresses in a mapping table; and a second G2P mapping table records the plurality of second L2P mapping tables and corresponding physical addresses; writing the first G2P mapping table and the second G2P mapping table into the host buffer; establishing a storage unit connection relationship table and a last updated storage unit table, which record the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; selecting the first group, reading the first G2P mapping table from the host buffer, and storing the first G2P mapping table in a buffer memory in the flash memory controller; reading the updated portion of the first L2P mapping table belonging to the first group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the first L2P mapping table into a first physical address of the flash memory module; updating the first G2P mapping table so that the updated portion of the first L2P mapping table corresponds to the first physical address.

[0006] In one embodiment of the present invention, a memory device is disclosed, which includes a flash memory module and a flash memory controller. The flash memory controller performs the following operations: dividing a plurality of L2P mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables in the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables in the plurality of L2P mapping tables; receiving a plurality of data from the host device, and writing the plurality of data into the flash memory module; updating a portion of the first L2P mapping tables in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and updating a portion of the second L2P mapping tables in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; writing the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; establishing a first G2P mapping table and a second G2P mapping table corresponding to the first group and the second group, respectively, wherein the first G2P The mapping table records the plurality of first L2P mapping tables and corresponding physical addresses; and the second G2P mapping table records the plurality of second L2P mapping tables and corresponding physical addresses; the first G2P mapping table and the second G2P mapping table are written into the host buffer; a storage unit connection relationship table and a last updated storage unit table are established, which record the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; the first group is selected, the first G2P mapping table is read from the host buffer, and the first G2P mapping table is stored in a buffer memory in the flash memory controller; the updated portion of the first L2P mapping table belonging to the first group is read from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and the updated portion of the first L2P mapping table is written into a first physical address of the flash memory module; the first G2P mapping table is updated so that the updated portion of the first L2P mapping table corresponds to the first physical address. 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 multiple L2P mapping tables according to an embodiment of the present invention.

[0009] Figure 3 A schematic diagram of grouping multiple L2P mapping tables.

[0010] Figure 4 A schematic diagram of multiple G2P mapping tables according to an embodiment of the present invention.

[0011] Figure 5 FIG. 4 is a flow chart of a control method of a flash memory controller according to an embodiment of the present invention.

[0012] Figure 6 Schematic diagram of a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0013] Figure 7 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0014] Figure 8 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0015] Fig. 9 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0016] Fig.10 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0017] Fig.11 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0018] Fig.12 Schematic diagram of updating an L2P mapping table, a storage unit connection relationship table and a last updated storage unit table according to an embodiment of the present invention.

[0019] Fig.13 FIG. 4 is a flow chart of a control method of a flash memory controller according to an embodiment of the present invention.

[0020]

Explanation of symbols

[0021] 100: Memory device

[0022] 110: Flash memory controller

[0023] 112: Microprocessor

[0024] 112M: Read-only memory

[0025] 112C: Program code

[0026] 114: Control Logic

[0027] 116: Buffer memory

[0028] 118: Interface Logic

[0029] 120: Flash memory module

[0030] 130: Main device

[0031] 132: Encoder

[0032] 134:Decoder

[0033] 136: Host Buffer

[0034] 500~512: Steps

[0035] 610: Storage unit connection relationship table

[0036] 620: Last updated storage unit table

[0037] 1300~1314: Steps

[0038] MT1~MTN: logical address to physical address mapping table

[0039] LBA1~LBA2048: logical address

[0040] PA1~PA2048: Entity address

[0041] G1~G3: Group

[0042] GT1, GT2: Group to entity address mapping table

[0043] S1~S2: Storage unit DETAILED DESCRIPTION

[0044] Figure 11 is a schematic diagram of a memory device 100 according to an embodiment of the present invention. The memory 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.

[0045] In a typical case, the flash memory module 120 includes a plurality of flash memory chips, and each flash memory chip includes a plurality of blocks. The flash memory controller 110 performs operations such as copying, erasing, and merging data on the flash memory module 120 in units of blocks. In addition, a block includes a specific number of data pages, and the flash memory controller 110 performs operations such as writing data to the flash memory module 120 in units of data pages. In other words, a block is a minimum erase unit in the flash memory module 120, and a data page is a minimum write unit in the flash memory module 120.

[0046] 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 various 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.

[0047] 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, 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 Multi Media Card (EMMC) specifications, and is disposed in an electronic device, such as a mobile phone, a watch, a portable medical detection device (e.g., a medical bracelet), a notebook computer, or a desktop computer, and the host device 130 may be a processor of the electronic device.

[0048] When the host device 130 needs to write data to the memory device 100, the host device 130 transmits a write command to the flash memory controller 110, wherein the write command includes one or more logical addresses (or logical block addresses (LBA)) of the data to be written, and each logical address corresponds to a specific amount of data, such as 4 kilobytes (KB) of data. After receiving the write command, the flash memory controller 110 obtains the data corresponding to the write command from the host device 130 and writes the data to a physical address of the flash memory module 120, wherein the physical address is which data page of which block in the flash memory module 120. In addition, after the flash memory controller 110 writes the data to the flash memory module 120, the microprocessor 112 in the flash memory controller 110 updates one or more L2P mapping tables to record the mapping relationship between the logical address included in the write command and the physical address in the flash memory module 120 where the data of the write command is written.

[0049] Figure 2 This is a schematic diagram of multiple L2P mapping tables according to an embodiment of the present invention, wherein this embodiment depicts N L2P mapping tables MT1 to MTN, wherein each L2P mapping table includes a certain number of continuous logical addresses, for example, L2P mapping table MT1 includes logical addresses LBA1 to LBA1024, L2P mapping table MT2 includes logical addresses LBA1025 to LBA2048, and so on. It should be noted that, Figure 2The L2P mapping table MT1 shows that the logical addresses LBA1-LBA1024 correspond to the physical addresses PA1-PA1024 respectively. However, if the flash memory module 120 does not contain data of a certain logical address, the corresponding physical address may be empty or invalid information. For example, assuming that the flash memory controller 110 writes data with logical addresses LBA1 and LBA2 to a first data page of a first block in the flash memory module 120, but does not write data with logical addresses LBA3-LBA1024, the microprocessor 112 can update the L2P mapping table MT1 to update PA1 and PA2 to point to the first data page of the first block in the flash memory module 120, and at this time PA3-PA1024 is empty or invalid information.

[0050] In addition, as the capacity of the flash memory module 120 increases rapidly, the amount of data that the memory device 100 can store also increases. Therefore, the number of L2P mapping tables that the microprocessor 112 needs to process also increases rapidly. Since these L2P mapping tables are stored in the buffer memory 116, the host buffer 136 in the host device 130, or the flash memory module 120 according to the design, respectively. Specifically, since the capacity of the buffer memory 116 is limited and the price is relatively high, the microprocessor 112 only loads the L2P mapping tables that are currently needed to be used into the buffer memory 116, and the part of the L2P mapping tables that are not needed temporarily are temporarily stored in the host buffer 136 in the host device 130. In addition, since the capacity of the host buffer 136 in the host device 130 is also limited, if the capacity of the host buffer 136 is insufficient, it is necessary to write a part of the temporarily stored L2P mapping tables into the flash memory module 120 through the flash memory controller 110 to release the space of the host buffer 136. In this embodiment, most of the L2P mapping tables are stored in the flash memory module 120 , and the microprocessor 112 reads the required L2P mapping table from the flash memory module 120 when needed and temporarily stores it in the buffer memory 116 or the host buffer 136 of the host device 130 .

[0051] Since there are many L2P mapping tables, in order to facilitate management, this embodiment groups the L2P mapping tables MT1-MTN so that each group contains multiple L2P mapping tables. Figure 3For example, each group may include 1024 L2P mapping tables, wherein group G1 includes L2P mapping tables MT1-MT1024, group G2 includes L2P mapping tables MT1025-MT2048, group G3 includes L2P mapping tables MT2049-MT3072, and so on. In addition, since some L2P mapping tables will be moved to the flash memory module 120 for storage, the microprocessor 112 also establishes a plurality of group to physical address mapping tables (Group to physical address mapping table, G2Pmapping table) corresponding to the plurality of groups, hereinafter referred to as G2P mapping tables, wherein each G2P mapping table includes the L2P mapping table included in the group and the physical address stored in the flash memory module 120. Specifically, referring to Figure 4 , G2P mapping table GT1 includes multiple L2P mapping tables MT1-MT1024 of group G1 and corresponding physical addresses, G2P mapping table GT2 includes multiple L2P mapping tables MT1025-MT2048 of group G2 and corresponding physical addresses, and so on. In detail, the physical address corresponding to L2P mapping table MT1 is the physical address of L2P mapping table MT1 stored in flash memory module 120 (that is, which data page is stored in which block), the physical address corresponding to L2P mapping table MT2 is the physical address of L2P mapping table MT2 stored in flash memory module 120, and so on.

[0052] In addition, since the number of G2P mapping tables is not too large, all G2P mapping tables can be temporarily stored in the host buffer 136 , and when they need to be updated, they are moved from the host buffer 136 to the buffer memory 116 for updating.

[0053] Figure 51 is a flow chart of a control method of the flash memory controller 110 according to an embodiment of the present invention. At step 500, the process starts, and all G2P mapping tables and part of the L2P mapping tables are stored in the host buffer 136. At step 502, the flash memory controller 110 writes data into the flash memory module 120, wherein the written data may be from the host device 130 or data read from the flash memory module 120 during a garbage collection operation; in addition, due to the writing of the data, the microprocessor 112 loads the corresponding L2P mapping table from the host buffer 136 to the buffer memory 116 according to the logical address of the written data. For example, if the data written by the microprocessor 112 has the logical addresses LBA4 and LBA1026, then since the logical addresses LBA4 and LBA1026 belong to the L2P mapping tables MT1 and MT2 respectively, the microprocessor 112 moves the L2P mapping tables MT1 and MT2 stored in the host buffer 136 to the buffer memory 116. In step 504, the microprocessor 112 updates the L2P mapping table according to the written data to generate an updated L2P mapping table. For example, if the microprocessor 112 writes data with a logical address LBA4 to a specific physical address of the flash memory module 120, the microprocessor 112 updates the L2P mapping table MT1 so that the physical address PA4 corresponding to the logical address LBA4 points to the specific physical address. In addition, the updated L2P mapping table can be written back to the host buffer 136.

[0054] In step 506 , assuming that the host buffer 136 has insufficient space or other factors, the microprocessor 112 writes the updated L2P mapping table into the flash memory module 120 .

[0055] Since the updated L2P mapping table is written into the flash memory module 120, it means that the information in the G2F mapping table corresponding to the updated L2P mapping table has expired. Therefore, in step 508, the microprocessor 112 loads the G2F mapping table corresponding to the updated L2P mapping table from the host buffer 136 to the buffer memory 116. For example, if the updated L2P mapping table includes MT1 and MT1026, the microprocessor 112 needs to load the G2F mapping table GT1 including the L2P mapping table MT1 and the G2F mapping table GT2 including the L2P mapping table MT1026 into the buffer memory 116.

[0056] In step 510, the microprocessor 112 updates the G2F mapping table according to the physical address written to the flash memory module 120 by the updated L2P mapping table to generate an updated G2F mapping table. For example, if the microprocessor 112 writes the L2P mapping table MT1 to a specific physical address of the flash memory module 120, the microprocessor 112 updates the G2F mapping table GT1 so that the L2P mapping table MT1 corresponds to the specific physical address.

[0057] In step 512 , considering the limited space in the buffer memory 116 , the microprocessor 112 moves the updated G2F mapping table to the host buffer 136 to release the space in the buffer memory 116 .

[0058] exist Figure 5 In steps 504 and 506, the microprocessor 112 may update the plurality of L2P mapping tables, write the plurality of updated L2P mapping tables into the host buffer 136, and move the plurality of updated L2P mapping tables from the host buffer 136 to the flash memory module 120 when the space of the host buffer 136 is insufficient or there are other factors. In this case, since the buffer memory 116 may not be able to load two G2P mapping tables at the same time, it is possible that the G2P mapping tables need to be repeatedly moved between the host memory 136 and the buffer memory 116 because the plurality of updated L2P mapping tables belong to a plurality of different groups. For example, assuming that the microprocessor 112 sequentially writes the L2P mapping tables MT1, MT1025, and MT2 to the flash memory module 120, the microprocessor 112 needs to first load the G2P mapping table GT1 into the buffer memory 116 to update the physical address of the L2P mapping table MT1; then write the G2P mapping table GT1 back to the host memory 136, and load the G2P mapping table GT2 into the buffer memory 116 to update the physical address of the L2P mapping table MT1025; finally, write the G2P mapping table GT2 back to the host memory 136, and load the G2P mapping table GT1 into the buffer memory 116 to update the physical address of the L2P mapping table MT2. The above mechanism will affect the performance of the flash memory controller 110.

[0059] In order to allow the microprocessor 112 to efficiently update the G2P mapping table when writing multiple L2P mapping tables to the flash memory module 120, the microprocessor 112 establishes the following in the buffer memory 116: Figure 6A storage unit connection relationship table 610 and a last updated storage unit table 620 are shown. The storage unit connection relationship table 610 includes at least three columns, which are the storage unit of the host buffer 136, the L2P mapping table, and the previous storage unit corresponding to the same group. In detail, the host memory 136 is allocated an area to store the L2P mapping table, wherein each storage unit can be used to store a single L2P mapping table, and the S1~S6 in the first column of the figure represent the number of the storage unit, the second column represents the L2P mapping table of the storage unit temporarily stored in the same row, and the third column represents the previous storage unit corresponding to the same group. The last updated storage unit table 620 includes at least two columns, wherein the first column is the group number, and the second column is the storage unit in the corresponding group with the last updated L2P mapping table. In addition, Figure 6 The storage unit connection relationship table 610 and the last updated storage unit table 620 are shown in an initial state, that is, the value of each field is "0xFF".

[0060] In the following examples, Figures 7 to 12 To illustrate that the microprocessor 112 updates the L2P mapping tables MT1, MT1025, MT1026, MT1027, MT1028, and MT2 in sequence to update some of the logical addresses and physical addresses, and writes the updated L2P mapping tables MT1, MT1025, MT1026, MT1027, MT1028, and MT2 back to the host buffer 136, the updated contents of the storage unit connection relationship table 610 and the last updated storage unit table 620.

[0061] refer to Figure 7 , the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT1 into the flash memory module 120, updates the L2P mapping table MT1 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT1 into the storage unit S1 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S1 as "MT1"; in addition, since the L2P mapping table MT1 belongs to the group G1, the microprocessor 112 also updates the last updated storage unit table 620 to mark the storage unit corresponding to the group G1 with the last updated L2P mapping table as "S1".

[0062] Next, refer to Figure 8, the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT1025 into the flash memory module 120, updates the L2P mapping table MT1025 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT1025 into the storage unit S2 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S2 as "MT1025"; in addition, since the L2P mapping table MT1025 belongs to the group G2, the microprocessor 112 also updates the last updated storage unit table 620 to mark the storage unit corresponding to the group G2 with the last updated L2P mapping table as "S2".

[0063] Next, refer to Fig. 9 , the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT1026 into the flash memory module 120, updates the L2P mapping table MT1026 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT1026 into the storage unit S3 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S3 as "MT1026", and refers to the current last updated storage unit table 620 ( Figure 8 ) to mark the previous storage unit corresponding to the same group as "S2"; in addition, since the L2P mapping table MT1026 belongs to group G2, the microprocessor 112 also updates the last updated storage unit table 620 to update the storage unit corresponding to group G2 with the last updated L2P mapping table to "S3".

[0064] Next, refer to Fig.10 , the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT1027 into the flash memory module 120, updates the L2P mapping table MT1027 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT1027 into the storage unit S4 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S4 as "MT1027", and refers to the current last updated storage unit table 620 ( Fig. 9 ) to mark the previous storage unit corresponding to the same group as "S3"; in addition, since the L2P mapping table MT1027 belongs to group G2, the microprocessor 112 also updates the last updated storage unit table 620 to update the storage unit corresponding to group G2 with the last updated L2P mapping table to "S4".

[0065] Next, refer to Fig.11 , the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT1028 into the flash memory module 120, updates the L2P mapping table MT1028 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT1028 into the storage unit S5 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S5 as "MT1028", and refers to the current last updated storage unit table 620 ( Fig.10 ) to mark the previous storage unit corresponding to the same group as "S4"; in addition, since the L2P mapping table MT1028 belongs to group G2, the microprocessor 112 also updates the last updated storage unit table 620 to update the storage unit corresponding to group G2 with the last updated L2P mapping table to "S5".

[0066] Finally, reference Fig.12 , the microprocessor 112 writes the data whose logical address is located in the L2P mapping table MT2 into the flash memory module 120, updates the L2P mapping table MT2 according to the physical address of the data written into the flash memory module 120, and writes the updated L2P mapping table MT2 into the storage unit S6 of the host buffer 136. At this time, the microprocessor 112 updates the storage unit connection relationship table 610 to mark the L2P mapping table corresponding to the storage unit S6 as "MT2", and refers to the current last updated storage unit table 620 ( Fig.11 ) to mark the previous storage unit corresponding to the same group as "S1"; in addition, since the L2P mapping table MT2 belongs to the group G1, the microprocessor 112 also updates the last updated storage unit table 620 to update the storage unit corresponding to the group G1 with the last updated L2P mapping table to "S6".

[0067] When the host buffer 136 has insufficient space or other factors occur, the microprocessor 112 may need to write the L2P mapping tables MT1 , MT1025 , MT1026 , MT1027 , MT1028 , and MT2 in the host buffer 136 into the flash memory module 120 . Fig.13 1 is a flow chart of a control method of the flash memory controller 110 according to an embodiment of the present invention. At step 1300, the process starts. At step 1302, the microprocessor 112 checks whether the storage unit corresponding to the group G1 with the last updated L2P mapping table is valid data according to the selected group (initially group G1) and the last updated storage unit table 620. If so, the process enters step 1304; if not, the process enters step 1310.

[0068] In step 1304 , the microprocessor 112 loads the G2P mapping table GT1 corresponding to the group G1 from the host buffer 136 and temporarily stores it in the buffer memory 116 .

[0069] In step 1306, the microprocessor 112 refers to the storage unit connection relationship table 610 and the last updated storage unit table 620 to sequentially read all L2P mapping tables corresponding to the group G1 from the host buffer 136. Fig.12 As shown, the microprocessor 112 can know that the storage unit with the last updated L2P mapping table of group G1 is "S6" through the last updated storage unit table 620, and then know that the storage unit corresponding to the same group before the storage unit S6 is S1 through the storage unit connection relationship table 610. Therefore, the microprocessor 112 reads the L2P mapping tables MT2 and MT1 from the storage units S6 and S1 in sequence, and writes the L2P mapping tables MT2 and MT1 to a first physical address of the flash memory module 120.

[0070] In step 1308 , the microprocessor 112 updates the G2P mapping table GT1 to update the L2P mapping tables MT2 and MT1 corresponding to the first physical address to generate an updated G2P mapping table GT1 .

[0071] In step 1310 , the microprocessor 112 determines whether the currently processed group is the last group through the last updated storage unit table 620 . If so, the process proceeds to step 1314 to end the operation; if not, the process proceeds to step 1312 to select the next group.

[0072] In this embodiment, since the group currently being processed is not the last group, the process returns to step 1302 to continue processing group G2. Specifically, in step 1304, the microprocessor 112 writes the G2P mapping table GT1 back to the host buffer 136 to release the storage space of the buffer memory 116, and the microprocessor 112 loads the G2P mapping table GT2 corresponding to group G2 from the host buffer 136 and temporarily stores it in the buffer memory 116. In step 1306, the microprocessor 112 refers to the storage unit connection relationship table 610 and the last updated storage unit table 620 to read all L2P mapping tables corresponding to group G2 from the host buffer 136 in sequence. Specifically, referring to Fig.12As shown, the microprocessor 112 can know from the last updated storage unit table 620 that the storage unit with the last updated L2P mapping table of group G2 is "S5", and then know from the storage unit connection relationship table 610 that the storage unit before the storage unit S5 corresponding to the same group is S4, the storage unit before the storage unit S4 corresponding to the same group is S3, the storage unit before the storage unit S3 corresponding to the same group is S2, and the storage unit before the storage unit S2 corresponding to the same group is invalid data. Therefore, the microprocessor 112 reads the L2P mapping tables MT1028, MT1027, MT1026, MT1025 from the storage units S5, S4, S3, S2 in sequence, and writes the L2P mapping tables MT1028, MT1027, MT1026, MT1025 to a second physical address of the flash memory module 120. In step 1308 , the microprocessor 112 updates the G2P mapping table GT2 to update the L2P mapping tables MT1028 , MT1027 , MT1026 , and MT1025 corresponding to the second physical address to generate an updated G2P mapping table GT2 .

[0073] like Fig.13 As described in the process, the microprocessor 112 learns which storage unit in the host buffer 136 all the L2P mapping tables belonging to the same group are located through the storage unit connection relationship table 610 and the last updated storage unit table, so that the microprocessor 112 can continuously read all the L2P mapping tables belonging to the same group from the host buffer 136 and write them to the flash memory module 120. In this way, the G2P mapping table corresponding to each group only needs to be loaded into the buffer memory 116 once to complete all updates to the physical addresses of the L2P mapping tables, thereby improving the efficiency of the flash memory controller 110.

[0074] 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 of a flash memory controller, wherein the flash memory controller is coupled between a host device and a flash memory module, and the control method comprises: Divide a plurality of logical address to physical address (L2P) mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables among the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables among the plurality of L2P mapping tables; Receive a plurality of data from the host device and write the plurality of data into the flash memory module; Update a portion of the first L2P mapping tables in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and update a portion of the second L2P mapping tables in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; Writing the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; Establishing a first group to physical address (Group to physical address, G2P) mapping table and a second G2P mapping table corresponding to the first group and the second group respectively, wherein the first G2P mapping table records the plurality of first L2P mapping tables and corresponding physical addresses; And the second G2P mapping table records the multiple second L2P mapping tables and corresponding physical addresses; Writing the first G2P mapping table and the second G2P mapping table into the host buffer; Establishing a storage unit connection relationship table and a last updated storage unit table, which record the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; Selecting the first group, reading the first G2P mapping table from the host buffer, and storing the first G2P mapping table in a buffer memory in the flash memory controller; Reading the updated portion of the first L2P mapping table belonging to the first group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the first L2P mapping table to a first physical address of the flash memory module; The first G2P mapping table is updated so that the updated portion of the first L2P mapping table corresponds to the first physical address.

2. The control method according to claim 1, characterized in that: Also included: Selecting the second group, moving the first G2P mapping table from the buffer memory to the host buffer, reading the second G2P mapping table from the host buffer, and storing the second G2P mapping table in the buffer memory in the flash memory controller; Reading the updated portion of the second L2P mapping table belonging to the second group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the second L2P mapping table to a second physical address of the flash memory module; The second G2P mapping table is updated so that the updated portion of the second L2P mapping table corresponds to the second physical address.

3. The control method according to claim 1, characterized in that: The storage unit connection relationship table includes the plurality of storage units of the host buffer, the L2P mapping table stored in each storage unit, and the previous storage unit corresponding to the same group of each storage unit.

4. The control method according to claim 1 or 3, characterized in that: The last updated storage unit table includes the storage unit with the last updated L2P mapping table of each group.

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; The microprocessor is used to perform the following steps: Divide a plurality of logical address to physical address (L2P) mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables among the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables among the plurality of L2P mapping tables; Receive a plurality of data from the host device and write the plurality of data into the flash memory module; Update a portion of the first L2P mapping tables in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and update a portion of the second L2P mapping tables in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; Writing the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; Establishing a first group to physical address (Group to physical address, G2P) mapping table and a second G2P mapping table corresponding to the first group and the second group respectively, wherein the first G2P mapping table records the plurality of first L2P mapping tables and corresponding physical addresses; And the second G2P mapping table records the multiple second L2P mapping tables and corresponding physical addresses; Writing the first G2P mapping table and the second G2P mapping table into the host buffer; Establishing a storage unit connection relationship table and a last updated storage unit table, which record the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; Selecting the first group, reading the first G2P mapping table from the host buffer, and storing the first G2P mapping table in a buffer memory in the flash memory controller; Reading the updated portion of the first L2P mapping table belonging to the first group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the first L2P mapping table to a first physical address of the flash memory module; The first G2P mapping table is updated so that the updated portion of the first L2P mapping table corresponds to the first physical address.

6. The flash memory controller according to claim 5, wherein: Also included: Selecting the second group, moving the first G2P mapping table from the buffer memory to the host buffer, reading the second G2P mapping table from the host buffer, and storing the second G2P mapping table in the buffer memory in the flash memory controller; Reading the updated portion of the second L2P mapping table belonging to the second group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the second L2P mapping table to a second physical address of the flash memory module; The second G2P mapping table is updated so that the updated portion of the second L2P mapping table corresponds to the second physical address.

7. The flash memory controller according to claim 5, wherein: The storage unit connection relationship table includes the plurality of storage units of the host buffer, the L2P mapping table stored in each storage unit, and the previous storage unit corresponding to the same group of each storage unit.

8. The flash memory controller according to claim 5 or 7, characterized in that: The last updated storage unit table includes the storage unit with the last updated L2P mapping table of each group.

9. A memory device comprising: a flash memory module; and a flash memory controller for accessing the flash memory module; The flash memory controller performs the following operations: Divide a plurality of logical address to physical address (L2P) mapping tables into a plurality of groups, wherein the plurality of groups include at least a first group and a second group, the first group includes a plurality of first L2P mapping tables among the plurality of L2P mapping tables, and the second group includes a plurality of second L2P mapping tables among the plurality of L2P mapping tables; Receive a plurality of data from the host device and write the plurality of data into the flash memory module; Update a portion of the first L2P mapping tables in the plurality of first L2P mapping tables according to the logical addresses of the plurality of data to generate an updated portion of the first L2P mapping table, and update a portion of the second L2P mapping tables in the plurality of second L2P mapping tables to generate an updated portion of the second L2P mapping table; Writing the updated portion of the first L2P mapping table and the updated portion of the second L2P mapping table into a host buffer in the host device; Establishing a first group to physical address (Group to physical address, G2P) mapping table and a second G2P mapping table corresponding to the first group and the second group respectively, wherein the first G2P mapping table records the plurality of first L2P mapping tables and corresponding physical addresses; And the second G2P mapping table records the multiple second L2P mapping tables and corresponding physical addresses; Writing the first G2P mapping table and the second G2P mapping table into the host buffer; Establishing a storage unit connection relationship table and a last updated storage unit table, which record the L2P mapping tables stored in the plurality of storage units in the host buffer and the groups to which they belong; Selecting the first group, reading the first G2P mapping table from the host buffer, and storing the first G2P mapping table in a buffer memory in the flash memory controller; Reading the updated portion of the first L2P mapping table belonging to the first group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the first L2P mapping table to a first physical address of the flash memory module; The first G2P mapping table is updated so that the updated portion of the first L2P mapping table corresponds to the first physical address.

10. The memory device according to claim 9, characterized in that Also included: Selecting the second group, moving the first G2P mapping table from the buffer memory to the host buffer, reading the second G2P mapping table from the host buffer, and storing the second G2P mapping table in the buffer memory in the flash memory controller; Reading the updated portion of the second L2P mapping table belonging to the second group from the host buffer according to the storage unit connection relationship table and the last updated storage unit table, and writing the updated portion of the second L2P mapping table to a second physical address of the flash memory module; The second G2P mapping table is updated so that the updated portion of the second L2P mapping table corresponds to the second physical address.

11. The memory device according to claim 9, characterized in that The storage unit connection relationship table includes the plurality of storage units of the host buffer, the L2P mapping table stored in each storage unit, and the previous storage unit corresponding to the same group of each storage unit.

12. The memory device according to claim 9 or 11, characterized in that: The last updated storage unit table includes the storage unit with the last updated L2P mapping table of each group.