# Patent

## Title
System and method for detecting copyback programming problems

## Abstract

Methods and systems are disclosed herein for detecting problems related to copyback programming. After the copyback data is read into the internal flash buffer, a part of the copyback data stored in the internal flash buffer (such as spare data) is analyzed to determine whether there are any errors in a part of the copyback data read. The analysis may be used by the flash memory in one or more ways related to the current copyback operation, subsequent copyback operations, subsequent treatment of the data in the current copyback operation, and subsequent treatment of the section in memory associated with the source page.

## Background
REFERENCE TO RELATED APPLICATION
This application claims the benefit of U.S. Provisional Application No. 61/498,583, filed Jun. 19, 2011, the entirety of U.S. Provisional Application No. 61/498,583 is hereby incorporated by reference herein.


TECHNICAL FIELD
This application relates generally to managing data in a memory device. More specifically, this application relates to a flash memory implementing an improved programming sequence for detecting copyback programming problems.
BACKGROUND
Copyback is an operation used to read and copy data stored in one page (a source page) and reprogram it in another page (a destination page) in a flash memory. Unlike standard read and program operations, data retrieved from the source page is not streamed out (such as streamed out of the flash memory chip), but is saved in an internal buffer in the flash memory and then programmed directly into the destination page without using an external memory. In this way, the data is kept entirely within the flash memory chip and not sent to any external chip within the flash memory (such as to an external controller in the flash memory). Thus, the copyback operation is faster and more efficient than standard operations because reading out the data and then re-loading the data to be programmed are not required. The operation is particularly useful when a portion of a page is updated and the rest of the page needs to be copied to a newly assigned block.
Copyback operations are “blind” in that the data is moved without being checked. In particular, as the data read from the source page is internal to the flash memory during a copyback operation, the Error Correction Code (ECC) cannot be evaluated before copying the source page to the destination page. As a result, any bit error (either caused by the copyback read operation or other error) cannot be detected and will be copied into the destination page, resulting in propagation and accumulation of the bit error.
SUMMARY
In order to address problems related to copyback programming, methods and systems are disclosed herein for detecting problems related to copyback programming.
According to a first aspect, a method of detecting errors in a copyback operation in a flash memory device is disclosed. The method includes, in the flash memory device with a controller, performing: internally copying data from a first non-volatile portion in a flash memory chip of the flash memory device to a volatile portion of the flash memory device; using a part of the data copied to the volatile portion to detect the presence of one or more errors; internally copying the data from the volatile portion to a second non-volatile portion of the flash memory chip; and modifying some or all of the data based on the detected presence of the one or more errors. In one embodiment, the copyback operation is performed on the flash memory chip, with copying from a first non-volatile portion on the flash memory chip to a volatile portion of the flash memory chip, and then copying from the volatile portion on the flash memory chip to a second portion on the flash memory chip. In another embodiment, part of the data copied to the volatile portion is copied external to the flash memory chip, such as to a volatile memory associated with the controller. In still another embodiment, depending on the detection of the one or more errors, the data associated with the copyback operation is modified, such as by verifying the data copied to the second portion of the flash memory chip and/or modifying the part of the data stored in the volatile portion prior to copying to the second portion of the flash memory chip. In yet another embodiment, depending on the detection of the one or more errors, a subsequent copyback operation is modified, such as disabling all subsequent copyback operations for the first non-volatile portion.
In another aspect, a storage device is disclosed. The storage device may comprise a flash memory device that is configured to detect errors in a copyback operation. The flash memory device comprises: a flash memory chip that includes a first non-volatile portion, a second non-volatile portion, and a volatile portion; and a controller in communication with the flash memory chip. The controller is configured to: command the flash memory chip to internally copy data from the first non-volatile portion to the volatile portion; use part of the data copied to the volatile portion to detect the presence of one or more errors; command the flash memory chip to internally copy the data from the volatile portion to the second non-volatile portion; and modify some or all the data associated with the copyback operation based on the detected presence of the one or more errors.
Other features and advantages will become apparent upon review of the following drawings, detailed description and claims. Additionally, other embodiments are disclosed, and each of the embodiments can be used alone or together in combination. The embodiments will now be described with reference to the attached drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates a host connected with a flash memory device having a multi-bank non-volatile memory containing multiple die.
FIG. 2 is a flow chart of one method for analyzing data during a copyback operation and potential applications of the analysis.
FIG. 3 is a flow chart of a method to program the spare area of the flash array with program integrity check data.
FIG. 4 is a flow chart of another method for analyzing data during a copyback operation and potential applications of the analysis.
FIG. 5 illustrates charge levels in a MLC memory and migration of charge due to the effect of over-programming.
FIG. 6 illustrates charge levels in the MLC memory migration of charge due to the effect of retention loss.



DETAILED DESCRIPTION
As discussed in the background, copyback operations are “blind” in that the data is moved without being checked. In one embodiment, at least part of the data copied in the copyback process is checked during the copyback process. For example, after the copyback data is read into the internal flash buffer, a part of the copyback data stored in the internal flash buffer is analyzed to determine whether there are any errors in a part of the copyback data read.
One example of copyback data read into the internal flash is data in the source page. The data in the source page may include user data, metadata, and potentially spare data. Examples of metadata include logical block addresses (LBAs) of the user data and the relative age of the LBAs. Spare data includes one or more unused bytes in the source page.
In one aspect, part (or all) of the spare data stored in the internal flash buffer is analyzed to determine whether there is a problem in the copyback programming. To perform the analysis, part (or all) of the spare data may be moved external to the flash memory chip, such as from the internal flash buffer to a buffer within the controller of the flash memory, as discussed in more detail below. The controller may then analyze the spare data in order to determine whether there is a problem with the copyback programming.
The controller's analysis may include comparing an expected value of the spare data with the actual value of the spare data. In one embodiment, the expected value is a predetermined integrity check data value (such as ‘FF00’), which may have been programmed previously into the source page prior to the start of the copyback operation. In another embodiment, the expected value is an initialization value that was programmed as part of an initialization. For example, prior to use of the source page, the source page is initialized with ‘FF’ values. In this way, the expected value of ‘FF’ need not be programmed in an operation separate from the initialization.
The comparison of the expected value with the actual value may indicate whether there is a problem with the copyback programming. For example, the analysis may indicate that one or more bytes of spare data include errors. The number of bytes that include errors may indicate that other data in the copyback programming, including the user data and the metadata, may have errors as well.
The controller's analysis may be used by the flash memory device in one or more ways related to the data associated with the current copyback operation, subsequent copyback operations, and subsequent treatment of the section in memory associated with the source page.
In one aspect, the controller's analysis may be used to modify or change the data associated with the current copyback operation, such as modify the data stored in the internal flash buffer or modify the data after it is stored back into non-volatile memory. For example, if the number of bytes in error is above a predetermined number, one or more bytes stored in the internal flash buffer (such as part (or all) of the spare data in the internal flash buffer) may be modified. As another example, the controller's analysis may be used to modify subsequent treatment of the data in the current copyback operation. For example, if the number of bytes in error is above a predetermined number, it may be determined that some (or all) of the data in the current copyback operations should be verified. So that, after copying of the data to the destination page in flash memory, the data may be verified by the controller using ECC.
In another aspect, the controller's analysis may be used to modify a subsequent copyback operation. For example, if the number of bytes in error is above a predetermined number, subsequent or future copyback operations for a particular part of the flash memory device (such as the block associated with the source page) may be prevented. Instead, updating of the pages in the block associated with the source page may be performed by copying to the buffer within the controller and by using the controller to perform ECC on the copied data.
In yet another aspect, the controller's analysis may be used to modify subsequent treatment of the section in flash memory associated with the source page. For example, if the number of bytes in error is above a predetermined number, it may be determined that part of the non-volatile memory (such as the block associated with the source page) may be reclaimed.
A flash memory device 102 suitable for use in implementing a copyback operation is shown in FIG. 1. A host system 100 of FIG. 1 stores data into and retrieves data from the flash memory device 102. The flash memory device 102 may be flash memory embedded within the host, such as in the form of a solid state disk (SSD) drive installed in a personal computer, a computer server, or a storage array. Alternatively, the flash memory device 102 may be in the form of a card that is removably connected to the host through mating parts 104 and 106 of a mechanical and electrical connector as illustrated in FIG. 1. A flash memory device configured for use as an internal or embedded SSD drive may look similar to the schematic of FIG. 1, with the primary difference being the location of the flash memory device 102 internal to the host. SSD drives may be in the form of discrete modules that are drop-in replacements for rotating magnetic disk drives.
The host system 100 of FIG. 1 may be viewed as having two major parts, insofar as the flash memory device 102 is concerned, made up of a combination of circuitry and software. They are an applications portion 108 and a driver portion 110 that interfaces with the flash memory device 102. In a PC, for example, the applications portion 108 can include a processor, such as CPU 112, running word processing, graphics, control or other popular application software, as well as the file system 114 for managing data on the host 100. In a camera, cellular telephone or other host system that is primarily dedicated to perform a single set of functions, the applications portion 108 includes the software that operates the camera to take and store pictures, the cellular telephone to make and receive calls, and the like.
The flash memory device 102 of FIG. 1 may include non-volatile memory, such as flash memory 116, and a system controller 118. The system controller 118 controls the flash memory 116 and communicates with the host 100 to which the flash memory device 102 is connected in order to pass data back and forth. The system controller 118 may convert between logical addresses of data used by the host 100 and physical addresses of the flash memory 116 during data programming and reading.
The flash memory 116 may include one or more flash memory chips 130. The flash memory chip 130 includes a flash memory array 120, which is a non-volatile memory, and a flash memory buffer 128, which is a volatile memory. FIG. 1 illustrates a single flash memory chip 130 with a single flash memory array 120 and a single flash memory buffer 128 by way of example. Further, the flash memory 116 may include multiple die, each containing an array of memory cells organized into multiple planes, and a volatile memory buffer. Alternatively, the memory cell array may not be divided into planes. In an alternate embodiment, the flash memory chips 130 include the flash memory array 120, and a separate chip may include the flash memory buffer 128.
Functionally, the system controller 118 may include a controller 122, which may comprises a processor, control logic, or the like. The system controller may also include controller firmware 124 for coordinating operation of the flash memory 116, such as monitoring copyback programming as disclosed below in FIGS. 2-4. The system controller 118 may further include controller RAM 126 (or other volatile memory associated with the controller 122). The system controller 118 may be implemented on a single integrated circuit chip, such as an application specific integrated circuit (ASIC), or may be also be incorporated into flash memory 116.
For example, the system controller 118 may initiate the copyback operation by sending a command to a particular flash memory chip in the flash memory 116 to move data from a source page of non-volatile memory into the flash memory buffer of the particular flash memory chip. This is discussed, for example, at 202 in FIGS. 2 and 402 in FIG. 4. The system controller 118 may further send a command (such as a direct memory access (DMA) command) to the particular flash memory chip in order to copy data stored in the flash memory buffer for storage in the controller RAM 126. In one embodiment, the command to copy data stored in the flash memory buffer for storage in the controller RAM 126 moves the data off-chip (from the particular flash memory chip to the controller chip). As discussed below, “spare” data is copied from the flash memory buffer into the controller RAM. This is discussed, for example, at 404 in FIG. 4. Moreover, the system controller 118 may command the particular flash chip to store data sent from the system controller into the flash memory buffer. This is discussed, for example, at 212 in FIG. 2 and 412 in FIG. 4. In addition, the system controller 118 may command the particular flash chip to store the data in the flash memory buffer into the destination page in the non-volatile flash memory array 120. This is discussed, for example, at 226 in FIG. 2.
The memory cells may be operated to store more than two detectable levels of charge in each charge storage element or region, thereby to store more than one bit of data in each. This configuration is referred to as multi level cell (MLC) memory. Alternatively, the memory cells may be operated to store two levels of charge so that a single bit of data is stored in each cell. This is typically referred to as a binary or single level cell (SLC) memory. Both types of memory cells may be used in a memory, for example binary flash memory may be used for caching data and MLC memory may be used for longer term storage. The charge storage elements of the memory cells are most commonly conductive floating gates but may alternatively be non-conductive dielectric charge trapping material.
In implementations of MLC memory operated to store two bits of data in each memory cell, each memory cell is configured to store four levels of charge corresponding to values of “11,” “01,” “10,” and “00.” Each bit of the two bits of data may represent a page bit of a lower page or a page bit of an upper page, where the lower page and upper page span across a series of memory cells sharing a common word line. Typically, the less significant bit of the two bits of data represents a page bit of a lower page and the more significant bit of the two bits of data represents a page bit of an upper page.
As discussed above, copyback operations are typically “blind” in that the data is moved without being checked. As a result, any bit error from the source page cannot be detected and will be copied into the destination page, resulting in propagation and accumulation of the bit error. Errors may be due, for example, to over-programming, which may cause bits in the memory cells to gain charge, and to retention loss, which may cause bits in the memory cells to lose charge. The charge in the cells of the flash memory may thus move due to the various errors, resulting in the bits to move as well, such as to the adjacent right or left state by over-programming or retention.
As discussed below, a part of the data (such as the spare data) stored in the flash buffer memory 128 is analyzed. The analysis of the spare data may be used to determine if the majority movement is towards charge gain or charge loss in a flash memory cell. For example, in a flash memory with a bit assignment, by upper page and lower page bit, of 11, 01, 00, and 10, over-programming may cause ‘1’s to tend to ‘0’ and retention loss may cause ‘0’s to tend to ‘1’s. For the analysis of the spare data to account for both over-programming and retention loss, the spare bits may be programmed with both ‘1’s and ‘0’s (such as FF). Alternatively, if the analysis is only focusing on one of the errors, then the spare bits may include only ‘1’s, so that no preprogramming of a special sequence is necessary.
Referring to FIG. 5, there is shown the effect of errors due to over-programming on a specific type of MLC. In particular, FIG. 5 illustrates ideal charge levels 502, 504, 506, 508 for bits 11, 01, 00, 10, respectively. Further, there is shown curves 510, 512, 514, 516 which illustrate the potential charge levels due to effect of over-programming. The Va, Vb, and Vc are read reference voltages. Thus, FIG. 5 illustrates one example of the effect of over-programming on the values of the bits in 2-bit MLC flash memory. FIG. 5 is for illustration purposes. Other types of flash memory layouts may be affected differently by over-programming.
Similar to FIG. 5, FIG. 6 illustrates ideal charge levels 502, 504, 506, 508 for bits 11, 01, 00, 10, respectively. Further, there is shown curves 602, 604, 606, 608 which illustrate the potential charge levels due to effect of retention loss. Thus, FIG. 6 illustrates one example of the effect of retention-loss on the values of the bits in 2-bit MLC flash memory. FIG. 6 is for illustration purposes. Other types of flash memory layouts may be affected differently by retention loss.
FIG. 2 is a flow chart 200 of one method for analyzing data during a copyback operation and potential applications of the analysis. At 202, data (such as a source page) is copied from flash non-volatile memory (such as flash memory array 120) to flash volatile memory (such as flash memory buffer 128). At 204, the controller 122 analyzes at least a part of the data in the flash volatile memory. As discussed above, the spare data copied into the flash memory buffer 128 is analyzed. At 206, the controller 122 determines whether the analysis finds one or more errors. If not, at 226, the data in the flash volatile memory is written to the flash non-volatile memory. If so, at 208, the controller 122 logs the details of the one or more errors, such as the bits in the spare data that were in error. At 210, the controller 122 determines whether to fix errors in the data in the flash volatile memory. If so, at 212, at least a part of the data in the flash volatile memory is modified. As discussed above, the data in the flash volatile memory may include user data, metadata, and spare data. In one aspect, part (or all) of the spare data is modified.
At 214, the controller 122 determines whether to disable subsequent copyback operations. If so, at 216, the controller 122 logs disabling of subsequent copyback operations for a part of the flash non-volatile memory, such as for the source page or for the entire block associated with the source page. At 218, the controller 122 determines whether to correct the data in the copyback operation. If so, at 220, the data is corrected and moved to flash non-volatile memory.
At 222, the controller 122 determines whether to reclaim part of the non-volatile memory. If the analysis indicates serious errors in the copyback data (such as numerous errors in the spare data stored in the flash volatile memory), the controller 122 may determine that a section of memory should be reclaimed and no longer used. If so, at 224, a part of the flash non-volatile memory (such as the block associated with the source page) is indicated to be reclaimed. At 226, the data in the flash volatile memory is written to the flash non-volatile memory.
FIG. 3 is a flow chart 300 of a method to program the spare area of the flash array with program integrity check data. As discussed above, in certain instances, the flash non-volatile memory may be programmed with a special code for later checking during the copyback process. At 302, a page of user data is moved into the flash memory buffer (such as flash memory buffer 128). At 304, program integrity check data is moved into “spare” area of the flash memory buffer. As discussed above, the spare area of memory may include the space in the flash memory buffer that is not used even with a full page of data loaded into the flash memory buffer. At 306, the contents of the flash memory buffer are written to the flash memory array.
FIG. 4 is a flow chart 400 of another method for analyzing data during a copyback operation and potential applications of the analysis. At 402, a copyback read is performed. At 404, the “spare” area is moved from the flash memory buffer into the stage buffer (which may be controller RAM 126). At 406, the controller 122 may perform a quick check of the “spare” bytes. At 408, the controller 122 may determine whether the “spare” bytes include more than 1 byte in error. If so, at 410, the controller 122 may perform a detailed check of the “spare” area and log the details. Optionally, at 412, the controller 122 may fix any bytes in error in the stage buffer and move the bytes into the flash memory buffer. For example, the controller 122 may input the correct predetermined code (such as the program integrity check data) into the stage buffer, which in turn is sent to the flash memory buffer, and ultimately programmed into the flash memory array. In this way, the errors in the “spare” area need not be propagated.
Optionally, at 414, copyback is disabled for the block associated with the source page. The determination whether to disable copyback for the block associated with the source page may be based on a first predetermined number of “spare” bytes that are in error (as shown in FIG. 4, the first predetermined number of “spare” bytes that are in error is greater than 1). Optionally, at 416, the controller 122 may force verification of the page after the write to the flash memory array. The determination whether to disable copyback for the block associated with the source page may be based on a second predetermined number of “spare” bytes that are in error (as shown in FIG. 4, the second predetermined number of “spare” bytes that are in error is greater than 1). In one embodiment, the first predetermined number of error bytes may be the same as the second predetermined number of error bytes (such as shown in FIG. 4) or may be different. Further, at 418, if more than a third predetermined number of bytes are in error (3, as shown in FIG. 4), the controller 122 forces immediate reclaim of the block associated with the source page, and logs an immediate reclaim request. If the errors are considered severe enough, the controller 122 may determine that the block associated with the source page is unreliable enough that it should not be used further, leading to the block being retired from further use. FIG. 4, including the various steps and the number of error bytes, are merely for illustration purposes. Other steps, and other numbers of error bytes, may be used.
It is intended that the foregoing detailed description be understood as an illustration of selected forms that the invention can take and not as a definition of the invention. It is only the following claims, including all equivalents, which are intended to define the scope of this invention. Also, some of the following claims may state that a component is operative to perform a certain function or configured for a certain task. It should be noted that these are not restrictive limitations. It should also be noted that the acts recited in the claims can be performed in any order and not necessarily in the order in which they are recited.

## Claims

1. A method of detecting errors in a copyback operation in a flash memory device, the method comprising:
in the flash memory device with a controller, prior to a copyback operation, programming a page of data such that a subset of the page of data includes a predetermined sequence of bits;
performing the copyback operation by:
internally copying the page of data from a first non-volatile portion in a flash memory chip of the flash memory device to a volatile portion of the flash memory device;
copying the subset of the page of data from the volatile portion of the flash memory device to memory associated with the controller;
detecting the presence of one or more errors by analyzing the data subset copied to the memory associated with the controller, wherein analyzing the data subset includes determining whether the data subset includes the predetermined sequence of bits; and
in accordance with detecting the presence of the one or more errors in the data subset:
verifying all of the data copied to the volatile portion, the verifying including correcting detected errors; and
storing the verified data to a second non-volatile portion of the flash memory chip.

2. The method of claim 1, wherein the first non-volatile portion, the second non-volatile portion and the volatile portion of the flash memory device are included in the flash memory chip of the flash memory device, and the controller and the memory associated with the controller are included in a system controller chip that is separate from the flash memory chip in the flash memory device.

3. The method of claim 1, wherein the detecting includes detecting a quantity of errors, the method further comprising in accordance with a determination that the quantity of errors exceeds a predetermined threshold, preventing copyback operations, subsequent to the copyback operation, for the first non-volatile portion of the flash memory chip.

4. The method of claim 1, wherein verifying all of the data copied to the volatile portion further comprises correcting the one or more errors detected.

5. The method of claim 1, wherein the detecting includes detecting a quantity of errors, the method further comprising, in accordance with a determination that the quantity of errors exceeds a predetermined threshold, determining whether to reclaim the first non-volatile portion of the flash memory chip.

6. The method of claim 1, wherein the first non-volatile portion of the flash memory chip comprises a block of the flash memory chip, and the data copied from the first non-volatile portion in the flash memory chip of the flash memory device is copied from the block of the flash memory chip and comprises a page of data.

7. A flash memory device configured to detect errors in a copyback operation, the flash memory device comprising:
a flash memory chip comprising a first non-volatile portion, a second non-volatile portion, and a volatile portion; and
a controller in communication with the flash memory chip, the controller configured to:
program a page of data such that a subset of the page of data includes a predetermined sequence of bits;
command the flash memory chip to internally copy the page of data from the first non-volatile portion to the volatile portion of the flash memory device;
copy the subset of the page of data from the volatile portion of the flash memory device to memory associated with the controller;
detect the presence of one or more errors by analyzing the data subset copied to the memory associated with the controller, wherein analyzing the data subset includes determining whether the data subset includes the predetermined sequence of bits; and
command the flash memory chip to in accordance with detecting the presence of the one or more errors in the data subset:
verify all of the data copied to the volatile portion, the verifying including correcting detected errors; and
storing the verified data to a second non-volatile portion of the flash memory chip.

8. The flash memory device of claim 7, wherein the first non-volatile portion, the second non-volatile portion and the volatile portion of the flash memory device are included in the flash memory chip of the flash memory device, and the controller and the memory associated with the controller are included in a system controller chip that is separate from the flash memory chip in the flash memory device.

9. The flash memory device of claim 7, wherein the controller is configured to detect a quantity of errors in the subset of the data, and the controller is further configured to in accordance with a determination that the quantity of errors exceeds a predetermined threshold, prevent copyback operations, subsequent to the copyback operation, for the first non-volatile portion of the flash memory chip.

10. The flash memory device of claim 7, wherein the controller is configured to verify all of the data copied to the volatile portion by at least correcting the one or more errors detected.

11. The flash memory device of claim 7, wherein the controller is configured to detect a quantity of errors, and the controller is further configured to in accordance with a determination that the quantity of errors exceeds a predetermined threshold, determine whether to reclaim the first non-volatile portion of the flash memory chip.

12. The flash memory device of claim 7, wherein the first non-volatile portion of the flash memory chip comprises a block of the flash memory chip, and the data copied from the first non-volatile portion in the flash memory chip of the flash memory device is copied from the block of the flash memory chip and comprises a page of data.