Patent ID: 8254170

Claim:
A method comprising: at a storage device that is embedded in a host device, wherein the storage device includes a storage manager and a plurality of memory cells, the storage device containing in a first group of the plurality of memory cells data from a programming device, performing: reading the data from the first group of memory cells by applying a first set of reference voltages; calculating a first number of erroneous data bits in the read data; when the first number of erroneous data bits is larger than a threshold: generating a second set of reference voltages by lowering at least one reference voltage of the first set of reference voltages by an amount that is determined based on the first number of erroneous data bits; rereading the data from the first group of memory cells by applying the second set of reference voltages; calculating a second number of erroneous data bits in the reread data; and when the second number of erroneous data bits is less than or equal to the threshold, correcting the data based on the second set of reference voltages and writing the corrected data to a second group of the plurality of memory cells.