* SW ECC - double bit flip detection on old NAND devices
@ 2017-05-05 13:14 Lukasz Majewski
2017-05-07 13:53 ` Richard Weinberger
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2017-05-05 13:14 UTC (permalink / raw)
To: linux-mtd
Dear All,
I've a problem with pretty old Flash NAND memory (Samsung 128Mx8) [1]
It doesn't support On-Chip ECC - one needs to calculate ECC manually.
The Yaffs2 FS (for this version) uses "1bit correction
ECC" (yaffs_ecc.c). It calculates ECC for 256 bytes -> we have got 22
bits for ECC (rounded up to 3 bytes).
For 2048 bytes page we do have 8 such ECC blocks -> 24 ECC bytes in
total in OOB.
This code (as noted in yaffs_ecc.* header) is able to correct one
single bit flip.
I've also looked into Linux kernel code for SW ECC calculation:
http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/nand/nand_ecc.c#L523
And here it is also explicitly said that we can correct one bit in such
chunk.
Please correct me if I'm wrong but when we have two bit-flips in such
256 bytes chunk, the ECC will be still correct and such obviously
broken page will not be "retired".
What one can do to prevent such situation?
My idea, if the above holds, would be to implement better ECC scheme as
proposed in "Error Correction Code (ECC) in Micron" doc [2].
Maybe somebody knows better/simpler solution?
Side note: newer NANDs support On-Chip ECC with algorithms allowing
correction of up to 4 bits in 512B chunks of data.
[1] -
http://www.sst-ic.com/File/Seriea/PDF/100923163334f47b2ce6-13b7-43d0-9b8c-ec1c75ca2c6f.pdf
[2] -
https://www.micron.com/~/media/documents/products/technical-note/nand-flash/tn2963_ecc_in_slc_nand.pdf
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: SW ECC - double bit flip detection on old NAND devices
2017-05-05 13:14 SW ECC - double bit flip detection on old NAND devices Lukasz Majewski
@ 2017-05-07 13:53 ` Richard Weinberger
2017-05-07 20:24 ` Lukasz Majewski
0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2017-05-07 13:53 UTC (permalink / raw)
To: Lukasz Majewski; +Cc: linux-mtd@lists.infradead.org
Lukasz,
On Fri, May 5, 2017 at 3:14 PM, Lukasz Majewski <lukma@denx.de> wrote:
> Dear All,
>
> I've a problem with pretty old Flash NAND memory (Samsung 128Mx8) [1]
>
> It doesn't support On-Chip ECC - one needs to calculate ECC manually.
>
> The Yaffs2 FS (for this version) uses "1bit correction
> ECC" (yaffs_ecc.c). It calculates ECC for 256 bytes -> we have got 22
> bits for ECC (rounded up to 3 bytes).
>
> For 2048 bytes page we do have 8 such ECC blocks -> 24 ECC bytes in
> total in OOB.
>
> This code (as noted in yaffs_ecc.* header) is able to correct one
> single bit flip.
>
> I've also looked into Linux kernel code for SW ECC calculation:
>
> http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/nand/nand_ecc.c#L523
This is for ecc->algo == NAND_ECC_HAMMING.
> And here it is also explicitly said that we can correct one bit in such
> chunk.
>
> Please correct me if I'm wrong but when we have two bit-flips in such
> 256 bytes chunk, the ECC will be still correct and such obviously
> broken page will not be "retired".
>
> What one can do to prevent such situation?
>
> My idea, if the above holds, would be to implement better ECC scheme as
> proposed in "Error Correction Code (ECC) in Micron" doc [2].
>
> Maybe somebody knows better/simpler solution?
I'd suggest to use BCH instead of Hamming.
Please see NAND_ECC_BCH.
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: SW ECC - double bit flip detection on old NAND devices
2017-05-07 13:53 ` Richard Weinberger
@ 2017-05-07 20:24 ` Lukasz Majewski
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2017-05-07 20:24 UTC (permalink / raw)
To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org
Hi Richard,
Thanks for your support.
> Lukasz,
>
> On Fri, May 5, 2017 at 3:14 PM, Lukasz Majewski <lukma@denx.de> wrote:
> > Dear All,
> >
> > I've a problem with pretty old Flash NAND memory (Samsung 128Mx8)
> > [1]
> >
> > It doesn't support On-Chip ECC - one needs to calculate ECC
> > manually.
> >
> > The Yaffs2 FS (for this version) uses "1bit correction
> > ECC" (yaffs_ecc.c). It calculates ECC for 256 bytes -> we have got
> > 22 bits for ECC (rounded up to 3 bytes).
> >
> > For 2048 bytes page we do have 8 such ECC blocks -> 24 ECC bytes in
> > total in OOB.
> >
> > This code (as noted in yaffs_ecc.* header) is able to correct one
> > single bit flip.
> >
> > I've also looked into Linux kernel code for SW ECC calculation:
> >
> > http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/nand/nand_ecc.c#L523
>
> This is for ecc->algo == NAND_ECC_HAMMING.
In my current 2.6.27 kernel it is called:
NAND_ECC_SOFT -> But this is the same.
the
ecc.correct = nand_correct_data()
, which has following statement in the function description:
*
* Detect and correct a 1 bit error for 256 byte block
*/
So now it is clear that two+ bit flips happening in the 256 B chunk
cannot be detected.
>
> > And here it is also explicitly said that we can correct one bit in
> > such chunk.
> >
> > Please correct me if I'm wrong but when we have two bit-flips in
> > such 256 bytes chunk, the ECC will be still correct and such
> > obviously broken page will not be "retired".
> >
> > What one can do to prevent such situation?
> >
> > My idea, if the above holds, would be to implement better ECC
> > scheme as proposed in "Error Correction Code (ECC) in Micron" doc
> > [2].
> >
> > Maybe somebody knows better/simpler solution?
>
> I'd suggest to use BCH instead of Hamming.
> Please see NAND_ECC_BCH.
Thanks for your tip. I will try to backport this feature ...
>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-07 20:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05 13:14 SW ECC - double bit flip detection on old NAND devices Lukasz Majewski
2017-05-07 13:53 ` Richard Weinberger
2017-05-07 20:24 ` Lukasz Majewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).