# Patent

## Title
Program method, data recovery method, and flash memory using the same

## Abstract

A program method for a multi-level cell (MLC) flash memory is provided. The memory array includes a plurality of pages and a plurality of paired pages, which correspond to the respective pages. The program method includes the following steps. Firstly, a program address command is obtained. Next, whether the program address command corresponding to any one of the paired pages is determined. When the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, data stored in the first page to a non-volatile memory are copied. After that, the first paired page is programmed.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The invention relates in general to a program method and a data recovery method, and more particularly to a program method and a data recovery method applied on a multi-level cell (MLC) flash memory.
2. Description of the Related Art
In the present age, non-volatile memory devices have become more popular for use in various electronic devices. For example, flash memory is one of the most popular non-volatile semiconductor memories applied in the present age. In detail, flash memory includes flash memory cells with programmable threshold voltages, so that each of the flash memory cells can be programmed to indicate at least one bit of data. In a case of multi-level cell (MLC) flash memory, each memory cells thereof can be programmed with more than two different levels, so that more than one bit of data, e.g. two bit of data, can be stored therein.
Generally, two program cycles have to be applied to each of the MLC cells, so that the two bit of data stored therein can be programmed with designated values. For MLC cells corresponding to a same block (i.e. a unit array for program operation), bits of data, stored therein, programmed in the same first program cycle are arranged as pages, while bits of data, stored therein, programmed in the same second program cycle are arranged as paired pages corresponding to the respective pages.
Conventionally, MLC flash memory suffers from data loss of the pages of the block if power off event strikes in the program cycle of the paired pages of the block. Thus, how to provide a decent program method and a decent data recovery method capable of preventing the data loss of the pages has become a prominent object for the industries.
SUMMARY OF THE INVENTION
The invention is directed to a program method and a data recovery method applied in a flash memory. The program method determines whether a program address command is corresponding to a paired page within the flash memory, and employs a non-volatile memory for copying data stored in a page corresponding to the paired page before programming the paired page. The data recovery method determines whether a program fail event has taken place in the paired page, and recovers data stored in the page within the copied data stored in the non-volatile memory, so that data recovery of the page can be achieved after even program failure has taken place on the paired page. Thus, in comparison to conventional multi-level cell (MLC) memory access method, the program, data recovery methods, and the flash memory thereof directed by the invention are capable of preventing the data loss of the pages.
According to an aspect of the present invention, a program method for an MLC flash memory is provided. The memory array includes a plurality of pages and a plurality of paired pages, which correspond to the respective pages. The program method includes the following steps. Firstly, a program address command is obtained. Next, the program address command corresponding to any one of the paired pages is determined. When the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, data stored in the first page to a non-volatile memory are copied. After that, the first paired page is programmed.
According to a second aspect of the invention, a data recovery method for an MLC flash memory is provided. The memory array includes a plurality of pages and a plurality of paired pages, which correspond to the respective pages. The data recovery method includes the following steps. Firstly, a program completed flag has been set to indicate a fair program operation is determined. When the program completed flag indicates that a program fail event has taken place in a marked paired page within a first block, data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block are moved to a clean second block. After the data have been moved, a reserved page within the clean second block with backup data, which are recorded in a non-volatile memory, of the marked page is programmed, so that data recovery of the marked page can be achieved even after program failure has taken place on the marked paired page.
According to a third aspect of the invention, a flash memory is provided. The flash memory includes a memory controller and an MLC flash memory circuit. The memory controller provides a program address command. The MLC flash memory circuit includes a memory array, a non-volatile memory, and a controller. The memory array includes pages and paired pages, which correspond to the respective pages. The controller determines whether the program address command corresponds to any one of the paired pages. When the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, the controller copies data stored in the first page to the non-volatile memory. The controller further programs the first paired page after the data stored in the page has been copied.
According to a fourth aspect of the invention, a flash memory is provided. The flash memory includes a non-volatile memory and an MLC flash memory circuit. The MLC flash memory circuit includes a memory array, wherein the memory array includes a plurality of pages and a plurality of paired pages, which correspond to the respective pages. The memory controller determines whether a program address command corresponds to any one of the paired pages. When the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, the memory controller copies data stored in the first page to the non-volatile memory. The memory controller further programs the first paired page after the data stored in the page has been copied.
The invention will become apparent from the following detailed description of the preferred but non-limiting embodiments. The following description is made with reference to the accompanying drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of the flash memory according to a first embodiment of the invention.
FIG. 2 is an illustration for a page and a corresponding paired page of a memory block MB.
FIG. 3 is another illustration for pages and corresponding paired pages of a memory block MB'.
FIG. 4 is a flow chart of the program method according to the first embodiment of the invention.
FIG. 5 is a flow chart of the program method according to the first embodiment of the invention.
FIG. 6 is a block diagram of the flash memory according to a second embodiment of the invention.



DETAILED DESCRIPTION OF THE INVENTION
First Embodiment
Referring to FIG. 1, a block diagram of the flash memory according to the first embodiment of the invention is shown. The flash memory 1 includes a multi-level cell (MLC) flash memory circuit 12, a memory controller 14, and a host interface 16. The memory controller 14 is connected to a host (not shown) via the host interface 16 and provides a program address command CMD under the control of the host.
The MLC flash memory circuit 12 includes a non-volatile memory 121, a controller 123, a memory array 125, and a memory interface 127. The memory array 125 includes a number of MLC cells, each of which can be programmed with more than two different levels, so that more than one bit of data can be stored therein. In an example, each of the MLC cells is able to store two bits of data and two program cycles are accordingly needed to respectively have the two bit of data stored therein programmed with designated values. In other words, the number of bits that can be stored in the memory array 125 is substantially double than the number of MLC cells therein.
The data stored in the MLC cells are further arranged into a number of blocks, which are regarded as a unit array for program operation. For MLC cells corresponding to a same block, the first bits, i.e. the bits stored therein and programmed in a first program cycle, are clustered as at least a page, while the second bits, i.e. the bits stored therein and programmed in a second program cycle, are clustered as at least a paired page corresponding to the page. For example, a block MB is arranged into at least a page P and at least a paired page Pp, which are respectively programmed in the first and the second program cycles, as depicted in FIG. 2. N MLC cells C_1-C_N are employed for storing the N first bits B1_1-B1_N of the page P and the n second bits B2_1-B2_N of the paired page Pp.
In another example, the blocks of the memory array 125 are not limited as including only one page P and one paired page and may include more than one pages P_1-P_M and more than one paired pagesPp_1-Pp_M, while each of the pages P_1-P_M and the corresponding pair pages Pp_1-Pp_M have the same bits arrangement as that of the illustrated page P and the paired page Pp, as depicted in FIG. 3, wherein M is a natural number greater than 1.
The non-volatile memory 121 is, for example, a phase change memory, e.g. PCME, PRAM, PCRAM, Ovonic Unified Memory, Chalcogenide RAM and C-RAM. In an embodiment, the non-volatile memory 121 is a PCRAM memory.
The controller 123 is connected to the memory controller 14 via the memory interface 127. The controller 123 further executes a program method for the memory array 125 programmed according to the program address command CMD. Referring to FIG. 4, a flow chart of the program method according to the first embodiment of the invention is shown. The program method includes the following steps.
As shown in step (a), the controller 123 firstly obtains the program address command CMD provided by the memory controller 14. As shown in step (b), the controller 123 then determines whether the program address command CMD corresponding to any one of the paired pages of the memory array 125, e.g. the paired pages Pp_1-Pp_M of the block MB′.
When the program address command CMD corresponds to a first paired page, e.g. a paired page Pp_i of the block MB′, the program method proceeds to step (c), in which the controller 123 copies data stored in a first page, e.g. the page P_i corresponding to a paired page Pp_i, to the non-volatile memory 121, wherein i is a natural number smaller than or equal to M. As shown in step (d), the controller 123 then programs the first paired page after the data stored in the first page has been copied.
After step (b), when the program address command CMD corresponds to the first page, e.g. the page P_i, rather than any one of the paired pages of the memory array 125, the program method directly proceeds to step (d).
In an example, the program method further includes step (e), which is executed after step (d), in which the controller 123 sets a program completed flag FG after the first paired page has been programmed. For example, the program compete flag FG is a flag of the non-volatile memory 121 and the program complete flag FG indicates the first paired page has been programmed completely or not.
Based on the above description, the program method executed by the controller 123 can have the data stored in the first page copied before the program operation of the corresponding first paired page. Thus, even power failure strikes when the first paired page is programmed, the data stored in the first page, i.e. the data stored in the same MLC cells as the first paired page, will be kept in the non-volatile memory 121, so as to avoid the unwanted data loss situation.
The controller 123 further executes a data recovery method for the lost data, if any, of the memory array 125 recovered according to the data copied in the non-volatile memory 121. Referring to FIG. 5, a flow chart of the program method according to the first embodiment of the invention is shown. The data recovery method includes the following steps. As shown in step (a), the controller 123 firstly determines whether the program completed flag FG has been set to indicate a fair program operation of the memory array 125; if so, the data recovery method accordingly ends.
When the program completed flag FG indicates that a program fail event has taken place in a marked paired page of a first block, e.g. the paired page Pp_i, the data recovery method proceeds to step (b), in which the controller 123 moves data stored in pages, except the marked paired page and a marked page, e.g. the page P_i, corresponding to the marked paired page of the first block to a clean second block. For example, the clean second block is an empty block of the memory array 125.
After step (b), the data recovery method proceeds to step (c), in which the controller 123 programs a reserved page within the clean second block with backup data, which are recorded in the non-volatile memory 121, of the marked page, so that data recovery of the marked page can be achieved even after program failure has taken place on the marked paired page. After step (c), the data recovery method proceeds to step (d), in which the controller 123 programs a reserved paired page, corresponding to the reserved page, within the clean second block after the reserved page has been programmed.
Based on the above description, the data recovery method executed by the controller 123 can have the data stored in the marked page recovered with the copied data stored in the non-volatile memory 121. Thus, even power failure strikes when the marked paired page is programmed, the data stored in the marked page, i.e. the data stored in the same MLC cells as the marked paired page, can be recovered by the copied data stored the non-volatile memory 121, so as to avoid the unwanted data loss situation.
Second Embodiment
Referring to FIG. 6, a block diagram of the flash memory according to the second embodiment of the invention is shown. The flash memory 2 according to the second embodiment is different from the flash memory 1 according to the first embodiment in that the non-volatile memory 247 is provided in the memory controller 24, rather than in the MLC flash memory circuit 22. Thus, the operation of the controller 123 disclosed in the first embodiment is now executed by a processor 243 of the memory controller 24.
The program method according to the above mentioned embodiments determines whether a program address command is corresponding to a paired page within the flash memory, and employs a non-volatile memory for copying data stored in a page corresponding to the paired page before programming the paired page. The data recovery method according to the above mentioned embodiments determines whether a program fail event has taken place in the paired page, and recovers data stored in the page within the copied data stored in the non-volatile memory, so that data recovery of the page can be achieved even program failure has taken place on the paired page. Thus, in comparison to conventional multi-level cell (MLC) memory access method, the program, data recovery methods, and the flash memory thereof according to the above mentioned embodiments are capable of preventing the data loss of the pages.
While the invention has been described by way of example and in terms of a preferred embodiment, it is to be understood that the invention is not limited thereto. On the contrary, it is intended to cover various modifications and similar arrangements and procedures, and the scope of the appended claims therefore should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements and procedures.

## Claims

1. A program method for a multi-level cell (MLC) flash memory, the MLC flash memory circuit comprising a memory array, the memory array comprising a plurality of pages and a plurality of paired pages, which respectively correspond to the pages, the program method comprising:
obtaining a program address command;
determining whether the program address command corresponds to any one of the paired pages;
when the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, copying data stored in the first page to a non-volatile memory;
programming the first paired page after the data stored in the first page has been copied; and
when a program fail event has taken place in a marked paired page within a first block of the memory array, moving data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block to a clean second block.

2. The program method according to claim 1, further comprising:
when the program address command corresponds to a second page among the pages, directly programming the second page.

3. The program method according to claim 1, further comprising:
setting a program completed flag after the first paired page has been programmed.

4. A data recovery method for a multi-level cell (MLC) flash memory, the MLC flash memory circuit comprising a memory array, the memory array comprising a plurality of pages and a plurality of paired pages, which respectively correspond to the pages, the data recovery method comprising:
determining whether a program completed flag has been set to indicate a fair program operation;
when the program completed flag indicates that a program fail event has taken place in a marked paired page within a first block, moving data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block to a clean second block; and
after the data have been moved, programming a reserved page within the clean second block with backup data, which are recorded in a non-volatile memory, of the marked page, so that data recovery of the marked page can be achieved even program failure has taken place on the marked paired page.

5. The data recovery method according to claim 4, further comprising:
programming a reserved paired page, corresponding to the reserved page, within the clean second block after the reserved page has been programmed.

6. A flash memory, comprising:
a memory controller, for providing a program address command; and
a multi-level cell (MLC) flash memory circuit, comprising:
a memory array, comprising a plurality of pages and a plurality of paired pages, which respectively correspond to the pages;
a non-volatile memory; and
a controller, determining whether the program address command corresponds to any one of the paired pages, when the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, the controller copying data stored in the first page to the non-volatile memory, wherein,
the controller further programs the first paired page after the data stored in the page has been copied, and when a program fail event has taken place in a marked paired page within a first block of the memory array, data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block are moved to a clean second block.

7. The flash memory according to claim 6, wherein when the program address command corresponds to a second page among the pages, the controller directly programs the second page.

8. The flash memory according to claim 6, wherein the non-volatile memory further comprises:
a program completed flag, the controller setting the program completed flag after the first paired page has been programmed.

9. The flash memory according to claim 8, wherein the controller further determines whether the program completed flag has been set to indicate a fair program operation,
wherein, when the program completed flag indicates that a program fail event has taken place in a marked paired page within a first block, the controller moves data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block to a clean second block.

10. The flash memory according to claim 9, wherein after the data have been moved, the controller programs a reserved page within the clean second block with the data copied and stored in the non-volatile memory, of the marked page, so that data recovery of the marked page can be achieved even program failure has taken place on the marked paired page.

11. A flash memory, comprising:
a non-volatile memory;
a multi-level cell (MLC) flash memory circuit, comprising:
a memory array, wherein the memory array comprises a plurality of pages and a plurality of paired pages, which respectively correspond to the pages; and
a memory controller, for determining whether a program address command corresponds to any one of the paired pages, when the program address command corresponds to a first paired page, which corresponds to a first page among the pages, among the paired pages, the memory controller copying data stored in the first page to the non-volatile memory, wherein,
the memory controller further programs the first paired page after the data stored in the page has been copied, and when a program fail event has taken place in a marked paired page within a first block of the memory array, data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block are moved to a clean second block.

12. The flash memory according to claim 11, wherein when the program address command corresponds to a second page among the pages, the controller directly programs the second page.

13. The flash memory according to claim 12, wherein the non-volatile memory further comprises:
a program completed flag, the memory controller setting the program completed flag after the first paired page has been programmed.

14. The flash memory according to claim 13, wherein the memory controller further determines whether the program completed flag has been set to indicate a fair program operation,
wherein, when the program completed flag indicates that a program fail event has taken place in a marked paired page within a first block, the memory controller moves data stored in pages, except the marked paired page and a marked page corresponding to the marked paired page, of the first block to a clean second block.

15. The flash memory according to claim 14, wherein after the data have been moved, the memory controller programs a reserved page within the clean second block with the data copied and stored in the non-volatile memory, of the marked page, so that data recovery of the marked page can be achieved even program failure has taken place on the marked paired page.