Memory management method, and memory controller and memory storage device using the same
A memory management method for a rewritable non-volatile memory module including a plurality of physical unit groups is provided, and each physical unit group includes first physical units. The method includes: grouping the physical unit groups into a first and second areas, setting the physical unit groups of the first area in a first program mode indicating that all physical units are programmable, and setting the physical unit groups of the second area in a second program mode indicating that only the first physical units are programmable. The method also includes: when a physical unit group in the first area is damaged, transforming a physical unit group from the first program mode to the second program mode and the physical unit group is unable to be set back in the first program mode. Accordingly, the lifespan of the rewritable non-volatile memory module is increased.
Latest Phison Electronics Corp. Patents:
- MEMORY MANAGEMENT METHOD, MEMORY STORAGE DEVICE AND MEMORY CONTROL CIRCUIT UNIT
- CLOCK CONTROL CIRCUIT, MEMORY STORAGE DEVICE AND CLOCK CONTROL METHOD
- Read voltage adjustment method, memory storage device and memory control circuit unit
- READ VOLTAGE CALIBRATION METHOD, MEMORY STORAGE DEVICE AND MEMORY CONTROL CIRCUIT UNIT
- MEMORY MANAGEMENT METHOD, MEMORY STORAGE DEVICE AND MEMORY CONTROL CIRCUIT UNIT
This application claims the priority benefit of Taiwan application serial no. 101119551, filed on May 31, 2012. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.
BACKGROUND1. Technical Field
The invention relates to a memory management method. Particularly, the invention relates to a memory management method for a rewritable non-volatile memory module, a memory controller and a memory storage device using the same.
2. Related Art
Digital cameras, cell phones, and MP3 players have undergone rapid growth in recent years, so that consumer demands for storage media have also rapidly increased. Since a rewritable non-volatile memory module (for example, a flash memory) has characteristics such as data non-volatility, low power consumption, small volume, non-mechanical structure, etc., it is suitable for being built in the aforementioned various portable multimedia devices.
According to the number of bits stored in each memory cell, NAND flash memories are classified into single level cell (SLC) NAND flash memories, multi level cell (MLC) NAND flash memories and trinary level cell (TLC) NAND flash memories, where each memory cell of the SLC NAND flash memory can store one bit (i.e. “1” and “0”), each memory cell of the MLC NAND flash memory can store two bits, and each memory cell of the TLC NAND flash memory can store three bits.
Taking the TLC NAND flash memory as an example, each physical block includes a plurality of physical page sets, and each of the physical page sets includes a lower physical page, a middle physical page and an upper physical page. Generally, the physical blocks in the flash memory are grouped into a plurality of usage areas, and a replacement area also includes a plurality of the physical blocks. When a physical block in the usage area is damaged, the physical block in the replacement area can be used to replace the damaged physical block. However, when the replacement area has no available physical block, it represents that a usage lifespan of the flash memory is ended. Therefore, how to effectively manage the physical blocks to prolong the lifespan of the flash memory is an important issue to be studied by related practitioners.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.
SUMMARYThe invention is directed to a memory management method and a memory controller and a memory storage device using the same, which is capable of prolonging a usage lifespan of a rewritable non-volatile memory module.
An exemplary embodiment of the invention provides a memory management method, which is adapted to control a rewritable non-volatile memory module. The rewritable non-volatile memory module includes a plurality of physical unit groups, each of the physical unit groups includes a plurality of physical unit sets, each of the physical unit sets includes a plurality of physical units, and the physical units in each of the physical unit sets include a first physical unit. The method includes: grouping the physical unit groups into a first area and a second area, setting the physical unit groups of the first area in a first program mode and setting the physical unit groups of the second area in a second program mode, where the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical unit is programmable. The method also includes: when a first physical unit group in the second area satisfies a second damage condition, using a second physical unit group of the first area to replace the first physical unit group, and setting the second physical unit group in the second program mode, where the second physical unit group is unable to be set back in the first program mode.
According to another aspect, an exemplary embodiment of the invention provides a memory storage device including a connector, a rewritable non-volatile memory module and a memory controller. The connector is coupled to a host system. The rewritable non-volatile memory module includes a plurality of physical unit groups. Each of the physical unit groups includes a plurality of physical unit sets. Each of the physical unit sets includes a plurality of physical units, and the physical units in each of the physical unit sets include a first physical unit. The memory controller is coupled to the connector and the rewritable non-volatile memory module. The memory controller groups the physical unit groups into at least a first area and a second area. Moreover, the memory controller sets the physical unit groups of the first area in a first pro am mode and sets the physical unit groups of the second area in a second program mode, where the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical unit is programmable. When a first physical unit group in the second area satisfies a second damage condition, the memory controller uses a second physical unit group of the first area to replace the first physical unit group, and sets the second physical unit group in the second program mode, where the second physical unit group is unable to be set back in the first program mode.
According to another aspect, an exemplary embodiment of the invention provides a memory controller, which includes a host interface, a memory interface and a memory management circuit. The host interface is coupled to a host system. The memory interface is coupled to the aforementioned rewritable non-volatile memory module. The memory management circuit is coupled to the host interface and the memory interface. The memory management circuit groups the physical unit groups into at least a first area and a second area. Moreover, the memory management circuit sets the physical unit groups of the first area in a first program mode and sets the physical unit groups of the second area in a second program mode, where the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical unit is programmable. When a first physical unit group in the second area satisfies a second damage condition, the memory management circuit uses a second physical unit group of the first area to replace the first physical unit group, and sets the second physical unit group in the second program mode, where the second physical unit group is unable to be set back in the first program mode.
An exemplary embodiment of the invention provides a memory management method, which is adapted to control the aforementioned rewritable non-volatile memory module. The method includes: grouping the physical unit groups at least into a first area and a second area, setting the physical unit groups of the first area in a first program mode and setting the physical unit groups of the second area in a second program mode, where the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical unit is programmable. The method also includes: when at least one first physical unit group in the first area satisfies a first damage condition, grouping the at least one first physical unit group to the second area and setting the first physical unit group in the second program mode, where the at least one first physical unit group is unable to be set back in the first program mode.
According to the above descriptions, according to the memory management method, the memory controller and the memory storage device of the disclosure, the usage lifespan of the rewritable non-volatile memory is increased.
It should be understood, however, that this Summary may not contain all of the aspects and embodiments of the present invention, is not meant to be limiting or restrictive in any manner, and that the invention as disclosed herein is and will be understood by those of ordinary skill in the art to encompass obvious improvements and modifications thereto.
In order to make the aforementioned and other features and advantages of the invention comprehensible, several exemplary embodiments accompanied with figures are described in detail below.
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
Reference will now be made in detail to the present preferred embodiments of the invention, examples of which are illustrated in the accompanying drawings. Wherever possible, the same reference numbers are used in the drawings and the description to refer to the same or like parts.
Embodiments of the present invention may comprise any one or more of the novel features described herein, including in the Detailed Description, and/or shown in the drawings. As used herein, “at least one”, “one or more”, and “and/or” are open-ended expressions that are both conjunctive and disjunctive in operation. For example, each of the expressions “at least on of A, B and C”, “at least one of A, B, or C”, “one or more of A, B, and C”, “one or more of A, B, or C” and “A, B, and/or C” means A alone, B alone, C alone, A and B together, A and C together, B and C together, or A, B and C together.
It is to be noted that the term “a” or “an” entity refers to one or more of that entity. As such, the terms “a” (or “an”), “one or more” and “at least one” can be used interchangeably herein.
First Exemplary EmbodimentIn the present disclosure, a physical unit is also referred to as a physical page, a physical unit group is also referred to as a physical block, and a physical unit set is also referred to as a physical page set. The physical unit group is the smallest unit for erasing data. Moreover, a plurality of the physical unit groups mapped to a logical unit assembly is referred to a physical unit assembly. Moreover, an upper physical unit is also referred to as an upper physical page, a middle physical unit is referred to as a middle physical page, and a lower physical unit is referred to as a lower physical page. However, in other exemplary embodiments, the physical unit can be one or a plurality of electronic devices having characteristics of rewritable and non-volatile, for example, a physical sector, which is not limited by the invention. Moreover, a logical block is also referred to as a logical unit group, a logical page set is also referred to as a logical unit set, and a logical page is referred to as a logical unit. A plurality of logical unit groups can be referred to as a logical unit assembly.
Generally, a memory storage device (i.e. a memory storage system) includes a rewritable non-volatile memory module and a controller (i.e. a control circuit). Generally, the memory storage device is used together with a host system, so that the host system can write data into the memory storage device or read data from the memory storage device.
Referring to
In the present exemplary embodiment, the memory storage device 100 is coupled to the other components of the host system 1000 though the data transmission interface 1110. Based on operations of the microprocessor 1102, the RAM 1104 and the I/O device 1106, data can be written into the memory storage device 100 or read from the memory storage device 100. For example, the memory storage device 100 can be a rewritable non-volatile memory storage device such as a flash drive 1212, a memory card 1214 or a solid state drive (SSD) 1216, etc. shown in
Generally, the host system 1000 can be any system capable of substantially collaborating with the memory storage device 100 to store data. In the present exemplary embodiment, although a computer system is taken as the host system 1000 for descriptions, in another exemplary embodiment of the invention, the host system 1000 can also be a digital camera, a video camera, a communication device, an audio player or a video player, etc. For example, when the host system is a digital camera (video camera) 1310, the rewritable non-volatile memory storage device is a secure digital (SD) card 1312, a multi media card (MMC) 1314, a memory stick (MS) 1316, a compact flash (CF) card 1318 or an embedded storage device 1320 (shown in
Referring to
In the present exemplary embodiment, the connector 102 is complied with an SD interface standard. However, it should be noticed that the invention is not limited thereto, and the connector 102 can also be complied with a parallel advanced technology attachment (PATA) standard, an institute of electrical and electronic engineers (IEEE) 1394 standard, a peripheral component interconnect express (PCI express) standard, a universal serial bus (USB) standard, a serial advanced technology attachment (SATA) standard, an MS interface standard, an MMC interface standard, a CF interface standard, an integrated device electronics (IDE) standard or other suitable standards.
The memory controller 104 may execute a plurality of logic gates or control instructions implemented in a hardware form or a firmware form, and may perform a write operation, a read operation or an erase operation to the rewritable non-volatile memory module 106 according to commands from the host system 1000.
The rewritable non-volatile memory module 106 is coupled to the memory controller 104 for storing data written by the host system 1000. The rewritable non-volatile memory module 106 has physical blocks 304(0)-304(R). For example, the physical blocks 304(0)-304(R) may belong to a same memory die or belong to different memory dies. In the present exemplary embodiment, each of the physical blocks has a plurality of physical page sets, and each physical page set has at least one physical page formed by memory cells on a same word line, wherein the physical pages belonging to the same physical block must be simultaneously erased. In detail, the physical block is the smallest unit for erasing data. Namely, each physical block contains the least number of memory cells that are erased all together.
Referring to
Referring to
Referring to
Besides, when one physical block satisfies one of a plurality of damage conditions, such physical block is regarded as a damaged physical block. For example, the erase count of a physical block has an upper limit, and if the erase count of the physical block reaches the upper limit, the damage condition is satisfied. It is assumed that when it is selected to program the lower physical page, the middle physical page and the upper physical page, the upper limit of the erase count of the physical block is a first threshold value, and when it is selected to only program the lower physical page, the upper limit of the erase count of the physical block is a second threshold value. Particularly, the first threshold value is smaller than the second threshold value. For example, the first threshold value is 3000, and the second threshold value is 20000. The writing speed of the lower physical page is faster than the writing speed of the middle physical page and the upper physical page. Namely, when a batch of data is programmed to a physical block, a time required for programming the data to the lower physical page is shorter than a time required for programming the data to the middle physical page or the upper physical page. Moreover, if program fail is occurred when data is programmed to a physical block, the physical block having the program fail also satisfies a damage condition. Alternatively, when data is read from a physical block, if the number of error bits exceeds an upper limit that can be corrected by an error checking and correcting (ECC) code, such physical block also satisfies a damage condition. In overall, when a physical block satisfies one of the damage conditions, such physical block is regarded as a damaged physical block. However, the damage conditions are not limited by the invention.
On the other hand, when data is written into the physical blocks 304(0)-304(R), the data has to be written according to the arranging sequence of the physical pages. Moreover, the physical pages written with data have to be erased first for again writing data thereon. Generally, physical block is the smallest unit for managing the rewritable non-volatile memory module 106. For example, if data in only a part of the physical pages in one physical block is updated, valid data in the physical block has to be first moved to another empty physical block, and then the erase operation can be performed on such physical block. Here, moving of the valid data is referred to as a data merging operation. However, in another exemplary embodiment, physical page may also be used as the smallest unit for managing the rewritable non-volatile memory module 106, which is not limited by the invention.
Each of the physical pages generally includes a data bit area and a redundant bit area. The data bit area is used to store user data, and the redundant bit area is used to store system data (for example, the ECC code). In the present exemplary embodiment, each of the physical blocks is composed of 256 physical pages, and a volume of each physical page is 8 kilobyte (KB). However, it should be noticed that the invention is not limited thereto.
In the present exemplary embodiment, the rewritable non-volatile memory module 106 is a trinary level cell (TLC) NAND flash memory module, i.e. each of the physical page sets includes a lower physical page, a middle physical page and an upper physical page. However, it should be noticed that the rewritable non-volatile memory module 106 is not limited to be the TLC NAND flash memory module, and in another exemplary embodiment, the rewritable non-volatile memory module 106 may have multi level cells or may be other memory modules having the same characteristic.
Referring to
The memory management circuit 202 is used to control a whole operation of the memory controller 104. In detail, the memory management circuit 202 has a plurality of control commands, and when the memory storage device 100 operates, the control commands are executed to perform a write operation, a read operation and an erase operation, etc.
In the present exemplary embodiment, the control commands of the memory management circuit 202 are implemented in a firmware form. For example, the memory management circuit 202 has a microprocessor unit (not shown) and a read-only memory (not shown), and the control commands are burned into the read-only memory. When the memory storage device 100 operates, the control commands are executed by the microprocessor unit to perform a write operation, a read operation and an erase operation, etc.
In another exemplary embodiment of the invention, the control commands of the memory management circuit 202 may also be stored in a specific area (a system area in the memory module used for storing system data) of the rewritable non-volatile memory module 106 in form of program codes. Moreover, the memory management circuit 202 has a microprocessor unit (not shown), a read-only memory (not shown) and a random access memory (not shown). Particularly, the read-only memory has boot codes, and when the memory controller 104 is enabled, the microprocessor unit first executes the boot codes to load the control commands stored in the rewritable non-volatile memory module 106 to the random access memory of the memory management circuit 202. Then, the microprocessor unit executes the control commands to perform a write operation, a read operation and an erase operation, etc.
Moreover, in another exemplary embodiment of the invention, the control commands of the memory management circuit 202 may be implemented in a hardware form. For example, the memory management circuit 202 includes a micro controller, a memory management unit, a memory writing unit, a memory reading unit, a memory erasing unit and a data processing unit. The memory management unit, the memory writing unit, the memory reading unit, the memory erasing unit and the data processing unit are coupled to the micro controller. The memory management unit is configured to manage the physical blocks of the rewritable non-volatile memory module 106; the memory writing unit is configured to send a write command to the rewritable non-volatile memory module 106 to write data into the rewritable non-volatile memory module 106; the memory reading unit is configured to send a read command to the rewritable non-volatile memory module 106 to read data from the rewritable non-volatile memory module 106; the memory erasing unit is configured to send an erase command to the rewritable non-volatile memory module 106 to erase data in the rewritable non-volatile memory module 106; and the data processing unit is configured to process data to be written to the rewritable non-volatile memory module 106 or data to be read from the rewritable non-volatile memory module 106.
The host interface 204 is coupled to the memory management circuit 202 and is configured to receive and identify commands and data transmitted by the host system 1000. Namely, the commands and data transmitted by the host system 1000 are transmitted to the memory management circuit 202 through the host interface 204. In the present exemplary embodiment, the host interface 204 is complied with the SD standard. However, it should be noticed that the invention is not limited thereto, and the host interface 204 can also be complied with the PATA standard, the IEEE 1394 standard, the PCI express standard, the USB standard, the SATA standard, the MS standard, the MMC standard, the CF standard, the IDE standard or other suitable data transmission standard.
The memory interface 206 is coupled to the memory management circuit 202, and is configured to access the rewritable non-volatile memory module 106. Namely, data to be written into the rewritable non-volatile memory module 106 is transformed into a format that can be accepted by the rewritable non-volatile memory module 106 through the memory interface 206.
In an exemplary embodiment of the invention, the memory controller 104 further includes a buffer memory 252, a power management circuit 254 and an error checking and correcting (ECC) circuit 256.
The buffer memory 252 is coupled to the memory management circuit 202 and is configured to temporarily store data or commands from the host system 1000 or data from the rewritable non-volatile memory module 106.
The power management circuit 254 is coupled to the memory management circuit 202 and is configured to control the power of the memory storage device 100.
The ECC circuit 256 is coupled to the memory management circuit 202, and is configured to execute an ECC procedure to ensure correctness of data. In detail, when the memory management circuit 202 receives the write command from the host system 1000, the ECC circuit 256 generates a corresponding ECC code for data corresponding to the write command, and the memory management circuit 202 writes the data corresponding to the write command and the corresponding ECC code to the rewritable non-volatile memory module 106. Then, when the memory management circuit 202 reads data from the rewritable non-volatile memory module 106, it simultaneously reads the ECC code corresponding to the data, and the ECC circuit 256 performs the ECC procedure on the read data according to the ECC code.
Generally, the memory management circuit 202 groups the physical blocks 304(0)-304(R) into a system area, a data area, a replacement area and a spare area.
The physical blocks of the data area and the spare area are used to store data from the host system 1000. The physical blocks of the data area 402 are regarded as physical blocks already stored with data, and the physical blocks of the spare area are used for substituting the physical blocks of the data area. Therefore, the physical blocks of the spare area are empty or available physical blocks, i.e. physical blocks that are not stored with data or physical blocks stored with data marked to be invalid. Namely, the physical blocks in the spare area are already erased, or before the physical block in the spare area is selected to store data, an erase operation is first performed to the selected physical block.
The physical blocks logically belonging to the system area are used for recording system data, wherein the system data includes a manufacturer and a model number of the memory chip, the number of the physical blocks of the rewritable non-volatile memory module, and the number of physical pages in each physical block, etc.
The physical blocks logically belonging to the replacement area are replacement physical blocks. For example, when the rewritable non-volatile memory module is manufactured, 4% of the physical blocks therein are preserved for replacement. Namely, when the physical blocks in the data area, the spare area and the system area are damaged, the physical blocks preserved in the replacement area are used to replace the damaged physical blocks (i.e. bad blocks).
However, in the present exemplary embodiment, the memory management circuit 202 combines a conventional replacement area and the spare area into one area (which is also referred to as a third area) for utilization. Namely, when a physical block is damaged, a physical block is selected from the third area for replacement. When data is to be temporarily stored, a physical block is also selected from the third area for utilization.
Referring to
When a physical block of the first area 580 satisfies a first damage condition, such physical block is regarded as the damaged physical block. For example, the first damage condition includes: the erase count reaches the first threshold value, a program fail is occurred, or the number of error bits in the physical block exceeds an upper limit that can be corrected by the ECC code. When a physical block of the second area 560 satisfies a second damage condition, such physical block is regarded as the damaged physical block. For example, the second damage condition includes: the erase count reaches the second threshold value, a program fail is occurred, or the number of error bits in the physical block exceeds an upper limit that can be corrected by the ECC code.
For example, the memory management circuit 202 further divides the first area 580 into a third area 520 and a data area 540. The third area 520 includes physical blocks 304(0)-304(A), and the data area 540 includes physical blocks 304(A+1)-304(B), and the second area 560 includes physical blocks 304(B+1)-304(P). However, in other exemplary embodiments, the memory management circuit 202 may further group a system area from the physical blocks 304(0)-304(R), and the number of the grouped areas are not limited by the invention.
In the present exemplary embodiment, the memory management circuit 202 configures logical block addresses LBA(A+1)-LBA(B) for mapping to the physical blocks 304(A+1)-304(B) of the data area 540. Moreover, the memory management circuit 202 establishes a logical block address-physical block mapping table to record a mapping relationship of the logical block addresses LBA(A+1)-LBA(B) and the physical blocks 304(A+1)-304(B). The memory management circuit 202 further provides the logical block addresses LBA(A+1)-LBA(B) to the host system 1000. In this way, the host system 1000 can access the logical block addresses LBA(A+1)-LBA(B).
The physical blocks of the third area 520 can be used to replace the damaged physical blocks of the data area 540 or the second area 560. In the present exemplary embodiment, when the third area 520 has no available physical block, the memory management circuit 202 announces that the whole memory storage device 100 enters a write protect state, and data cannot be written therein.
Referring to
When a physical block of the first area 580 satisfies the first damage condition, the memory management circuit 202 sets such physical block in the second program mode and groups it to the second area 560. Moreover, the memory management circuit 202 sets that such physical block cannot be again set in the first program mode.
Referring to
In an exemplary embodiment, the memory management circuit 202 can also first collect three damaged physical blocks in the first area 580, and then simultaneously groups the three physical blocks to the second area 560. However, the memory management circuit 202 can also simultaneously groups more or less number of the physical blocks to the second area 560, which is not limited by the invention.
However, when the third area 520 has no available physical block, the memory management circuit 202 can also get three physical blocks belonging to the second program mode from the second area 560 for grouping to the third area 520. These three physical blocks can be used to replace one physical block of the third area 520. In detail, the memory management circuit 202 uses the lower physical pages of the three physical blocks as lower physical pages, middle physical pages and upper physical pages of one physical block. In other words, when the third area 520 has no available physical block, the memory management circuit 202 gets the physical blocks of the second area 560 to avoid announcing the write protect state of the whole memory storage device 100, so as to prolong its usage lifespan.
Referring to
In step S804, when a physical block in the first area satisfies a first damage condition, the memory management circuit 202 groups such physical block to the second area, and sets the physical block in the second program mode, where such physical block is unable to be set back in the first program mode. The first damage condition includes: the erase count of the physical block reaches the first threshold value, a program fail is occurred, or the number of error bits in the physical block exceeds an upper limit that can be corrected by the ECC code.
The steps of
In the first exemplary embodiment, when a physical block in the first area is damaged, the memory management circuit 202 transforms the damaged physical block to the second program mode, and groups it to the second area. However, in the second exemplary embodiment, when a physical block of the second area is damaged, the memory management circuit 202 selects a physical block from the first area, and groups the selected physical block to the second area and sets it in the second program mode. Moreover, in the first exemplary embodiment, the memory management circuit 202 manages the rewritable non-volatile memory module 106 in a unit of physical block, though in the second exemplary embodiment, the memory management circuit 202 manages the rewritable non-volatile memory module 106 in a unit of physical page.
However, in the second exemplary embodiment, the memory management circuit 202 can also manage the rewritable non-volatile memory module 106 in the unit of physical block, which is not limited by the invention.
Referring to
When the memory management circuit 202 receives a write command and write data from the host system 1000, the memory management circuit 202 writes the write data into the physical blocks of the second area 940. Then, the memory management circuit 202 duplicates the write data from the second area 940 to the first area 920. Namely, the physical blocks of the second area 940 are used for temporary storage, and the physical blocks of the first area 920 can provide a large storage space.
Referring to
In the second exemplary embodiment, when a physical block of the first area 920 satisfies the first damage condition, the memory management circuit 202 duplicates valid data in the physical block to the other physical block in the first area 920, and marks such physical block as a damaged physical block. In other words, the first area 920 includes a plurality of physical blocks satisfying the first damage condition, and these physical blocks cannot store data under the first program mode. Particularly, these physical blocks are set in the second program mode for replacing the lower physical pages, the middle physical pages and the upper physical pages of one physical block in the first area 920. For example, when the memory management circuit 202 duplicates valid data from the second area 940 to the first area 920, if the first area 920 has no physical block capable of storing data under the first program mode, the memory management circuit 202 sets three physical blocks satisfying the first damage condition in the second program mode, and uses the lower physical pages of the three physical blocks to store valid data. Alternatively, when a physical block of the first area is damaged, the memory management circuit 202 sets three physical blocks in the second program mode, and uses these physical blocks to replace the damaged physical block.
Referring to
In the exemplary embodiment
On the other hand, when the physical block (which is also referred to as a first physical block) of the second area 940 satisfies the second damage condition, the memory management circuit 202 selects a physical block (which is also refereed to as a second physical block) from the first area 920 to replace the first physical block. For example, the memory management circuit 202 selects the physical blocks satisfying the first damage condition in priority from the first area 920 to serve as the physical blocks for replacement. However, the memory management circuit 202 may select the physical blocks with erase count between zero and the first threshold value from the first area 920 to serve as the physical blocks for replacement, which is not limited by the invention. It should be noticed that after the second physical block is grouped to the second area 940, the memory management circuit 202 sets the second physical block in the second program mode, and the second physical block cannot be set back in the first program mode.
Referring to
In step S1204, when a first physical block in the second area satisfies a second damage condition, the memory management circuit 202 uses a second physical block in the first area to replace the first physical block. The memory management circuit 202 sets the second physical block in the second program mode, and the second physical block cannot be set back in the first program mode, where the second damage condition includes: the erase count of the first physical block reaches the second threshold value, the first physical block occurs a program fail, or the number of error bits in the first physical block exceeds an upper limit that can be corrected by the ECC code.
The steps of
In summary, the exemplary embodiments of the invention provide a memory management method, a memory controller and a memory storage device. When the physical bock of the second area is damaged, the used physical block in the first area is used for replacement. Alternatively, when the physical block of the first area is damaged, the damaged physical block is set in the second program mode for further usage. In this way, a usage lifespan of the rewritable non-volatile memory is increased.
The previously described exemplary embodiments of the present invention have the advantages aforementioned, wherein the advantages aforementioned not required in all versions of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
Claims
1. A memory management method, for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module comprises a plurality of physical unit groups, each of the physical unit groups comprises a plurality of physical unit sets, each of the physical unit sets comprises a plurality of physical units, and the physical units in each of the physical unit sets at least comprise a first physical unit, the memory management method comprising:
- grouping the physical unit groups into at least a first area and a second area, setting the physical unit groups of the first area in a first program mode and setting the physical unit groups of the second area in a second program mode, wherein the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical unit is programmable; and
- when a first physical unit group in the second area satisfies a second damage condition, using a second physical unit group of the first area to replace the first physical unit group, and setting the second physical unit group in the second program mode, wherein the second physical unit group is unable to be set back in the first program mode.
2. The memory management method as claimed in claim 1, wherein the second damage condition comprises: an erase count of the first physical unit group reaches a second threshold value, the first physical unit group occurs a program fail, or the number of error bits in the first physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
3. The memory management method as claimed in claim 1, wherein the step of using the second physical unit group of the first area to replace the first physical unit group when the first physical unit group in the second area satisfies the second damage condition comprises:
- obtaining the second physical unit group satisfying a first damage condition from the physical unit groups of the first area to replace the first physical unit group, wherein the first damage condition comprises: an erase count of the second physical unit group reaches a first threshold value, the second physical unit group occurs a program fail, or the number of error bits in the second physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
4. The memory management method as claimed in claim 1, wherein the step of using the second physical unit group of the first area to replace the first physical unit group when the first physical unit group in the second area satisfies the second damage condition comprises:
- obtaining the second physical unit group with an erase count between zero and a first threshold value from the physical unit groups of the first area to replace the first physical unit group.
5. The memory management method as claimed in claim 1, further comprising:
- when a third physical unit group of the first area satisfies a first damage condition, grouping the third physical unit group to the second area; and
- setting the third physical unit group in the second program mode, wherein the third physical unit group is unable to be set back in the first program mode, and the first damage condition comprises: an erase count of the third physical unit group reaches a first threshold value, the third physical unit group occurs a program fail, or the number of error bits in the third physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
6. The memory management method as claimed in claim 1, further comprising:
- when a third physical unit group of the first area satisfies a first damage condition, obtaining a plurality of fourth physical unit groups in the first area that satisfy the first damage condition;
- setting the fourth physical unit groups in the second program mode; and
- using the fourth physical unit groups to replace the third physical unit group, wherein the first damage condition comprises: an erase count of the fourth physical unit groups reaches a first threshold value, the fourth physical unit groups occur a program fail, or the number of error bits in the fourth physical unit groups exceeds an upper limit capable of being corrected by an error checking and correcting code.
7. The memory management method as claimed in claim 6, wherein the step of obtaining the fourth physical unit groups in the first area that satisfy the first damage condition when the third physical unit group of the first area satisfies the first damage condition comprises:
- determining whether the first area has a physical unit group that is capable of storing data under the first program mode, and if not, obtaining the fourth physical unit groups to replace the third physical unit group.
8. A memory storage device, comprising:
- a connector, coupled to a host system;
- a rewritable non-volatile memory module, comprising a plurality of physical unit groups, wherein each of the physical unit groups comprises a plurality of physical unit sets, each of the physical unit sets comprises a plurality of physical units, and the physical units in each of the physical unit sets at least comprise a first physical unit; and
- a memory controller, coupled to the connector and the rewritable non-volatile memory module,
- wherein the memory controller is configured to group the physical unit groups into at least a first area and a second area, set the physical unit groups of the first area in a first program mode, and set the physical unit groups of the second area in a second program mode, wherein the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical units are programmable,
- wherein when a first physical unit group in the second area satisfies a second damage condition, the memory controller is configured to use a second physical unit group of the first area to replace the first physical unit group, and set the second physical unit group in the second program mode, wherein the second physical unit group is unable to be set back in the first program mode.
9. The memory storage device as claimed in claim 8, wherein the second damage condition comprises: an erase count of the first physical unit group reaches a second threshold value, the first physical unit group occurs a program fail, or the number of error bits in the first physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
10. The memory storage device as claimed in claim 9, wherein the memory controller is further configured to obtain the second physical unit group satisfying a first damage condition from the physical unit groups of the first area to replace the first physical unit group, wherein the first damage condition comprises: an erase count of the second physical unit group reaches a first threshold value, the second physical unit group occurs a program fail, or the number of error bits in the second physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
11. The memory storage device as claimed in claim 8, wherein the memory controller is further configured to obtain the second physical unit group with an erase count between zero and a first threshold value from the physical unit groups of the first area to replace the first physical unit group.
12. The memory storage device as claimed in claim 8, wherein when a third physical unit group of the first area satisfies a first damage condition, the memory controller is further configured to group the third physical unit group to the second area, and set the third physical unit group in the second program mode, wherein the third physical unit group is unable to be set back in the first program mode, and the first damage condition comprises: an erase count of the third physical unit group reaches a first threshold value, the third physical unit group occurs a program fail, or the number of error bits in the third physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
13. The memory storage device as claimed in claim 8, wherein when a third physical unit group of the first area satisfies a first damage condition, the memory controller is further configured to obtain a plurality of fourth physical unit groups in the first area that satisfy the first damage condition, set the fourth physical unit groups in the second program mode, and uses the fourth physical unit groups to replace the third physical unit group, wherein the first damage condition comprises: an erase count of the fourth physical unit groups reach a first threshold value, the fourth physical unit groups occur a program fail, or the number of error bits in the fourth physical unit groups exceeds an upper limit capable of being corrected by an error checking and correcting code.
14. The memory storage device as claimed in claim 8, wherein the memory controller is further configured to determine whether the first area has a physical unit group that is capable of storing data under the first program mode, and if not, the memory controller obtains the fourth physical unit groups to replace the third physical unit group.
15. A memory controller, comprising:
- a host interface, coupled to a host system;
- a memory interface, coupled to a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module comprises a plurality of physical unit groups, each of the physical unit groups comprises a plurality of physical unit sets, each of the physical unit sets comprises a plurality of physical units, and the physical units in each of the physical unit sets at least comprise a first physical unit; and
- a memory management circuit, coupled to the host interface and the memory interface,
- wherein the memory management circuit is configured to group the physical unit groups into at least a first area and a second area, set the physical unit groups of the first area in a first program mode, and set the physical unit groups of the second area in a second program mode, wherein the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical units are programmable,
- wherein when a first physical unit group in the second area satisfies a second damage condition, the memory management circuit is configured to use a second physical unit group of the first area to replace the first physical unit group, and set the second physical unit group in the second program mode, wherein the second physical unit group is unable to be set back in the first program mode.
16. The memory controller as claimed in claim 15, wherein the second damage condition comprises: an erase count of the first physical unit group reaches a second threshold value, the first physical unit group occurs a program fail, or the number of error bits in the first physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
17. The memory controller as claimed in claim 16, wherein the memory management circuit is further configured to obtain the second physical unit group satisfying a first damage condition from the physical unit groups of the first area to replace the first physical unit group, wherein the first damage condition comprises: an erase count of the second physical unit group reaches a first threshold value, the second physical unit group occurs a program fail, or the number of error bits in the second physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
18. The memory controller as claimed in claim 16, wherein the memory management circuit further obtains the second physical unit group with an erase count between zero and a first threshold value from the physical unit groups of the first area to replace the first physical unit group.
19. The memory controller as claimed in claim 15, wherein when a third physical unit group of the first area satisfies a first damage condition, the memory management circuit is further configured to group the third physical unit group to the second area, and set the third physical unit group in the second program mode, wherein the third physical unit group is unable to be set back in the first program mode, and the first damage condition comprises: an erase count of the third physical unit group reaches a first threshold value, the third physical unit group occurs a program fail, or the number of error bits in the third physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
20. The memory controller as claimed in claim 15, wherein when a third physical unit group of the first area satisfies a first damage condition, the memory management circuit is further configured to obtain a plurality of fourth physical unit groups in the first area that satisfy the first damage condition, set the fourth physical unit groups in the second program mode, and use the fourth physical unit groups to replace the third physical unit group, wherein the first damage condition comprises: an erase count of the fourth physical unit groups reach a first threshold value, the fourth physical unit groups occur a program fail, or the number of error bits in the fourth physical unit groups exceeds an upper limit capable of being corrected by an error checking and correcting code.
21. The memory controller as claimed in claim 20, wherein the memory management circuit is further configured to determine whether the first area has a physical unit group that is capable of storing data under the first program mode, and if not, the memory management circuit obtains the fourth physical unit groups to replace the third physical unit group.
22. A memory management method, for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module comprises a plurality of physical unit groups, each of the physical unit groups comprises a plurality of physical unit sets, each of the physical unit sets comprises a plurality of physical units, and the physical units in each of the physical unit sets at least comprise a first physical unit, the memory management method comprising:
- grouping the physical unit groups into at least a first area and a second area, setting the physical unit groups of the first area in a first program mode and setting the physical unit groups of the second area in a second program mode, wherein the first program mode indicates that all of the physical units are programmable, and the second program mode indicates that only the first physical units are programmable; and
- when at least one first physical unit group in the first area satisfies a first damage condition, grouping the at least one first physical unit group to the second area and setting the at least one first physical unit group in the second program mode, wherein the at least one first physical unit group is unable to be set back in the first program mode.
23. The memory management method as claimed in claim 22, wherein the first damage condition comprises: an erase count of the at least one first physical unit group reaches a first threshold value, the at least one first physical unit group occurs a program fail, or the number of error bits in the at least one first physical unit group exceeds an upper limit capable of being corrected by an error checking and correcting code.
24. The memory management method as claimed in claim 23, further comprising:
- dividing the first area into a data area and a third area, and configuring a plurality of logical unit groups for mapping to the physical unit groups of the data area;
- when the at least one first physical unit group satisfies the first damage condition, determining whether the third area has a physical unit group that is capable of storing data under the first program mode, and if not, obtaining a plurality of second physical unit groups from the second area; and
- grouping the second physical unit groups to the third area.
8001317 | August 16, 2011 | Yeh et al. |
20090150597 | June 11, 2009 | Yang et al. |
20090248961 | October 1, 2009 | Chu et al. |
20100302847 | December 2, 2010 | Komai et al. |
20110022787 | January 27, 2011 | Yeh et al. |
20110191525 | August 4, 2011 | Hsu et al. |
Type: Grant
Filed: Aug 6, 2012
Date of Patent: Jul 16, 2013
Assignee: Phison Electronics Corp. (Miaoli)
Inventors: Kim-Hon Wong (Hsinchu County), Ying-Chi Lin (Miaoli)
Primary Examiner: Guerrier Merant
Application Number: 13/567,102
International Classification: G11C 29/00 (20060101); G11C 11/34 (20060101); G11C 16/04 (20060101); G06F 13/00 (20060101); G06F 13/28 (20060101);