Re: [Yaffs] [Yaffs2] Problem with ECC (two bit flops)

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: Lukasz Majewski
CC: yaffs
Subject: Re: [Yaffs] [Yaffs2] Problem with ECC (two bit flops)
On Fri, May 5, 2017 at 10:34 AM, Lukasz Majewski <> wrote:

> Dear All,
>
> I'm working on embedded system equipped with NAND Flash memory.
>
> The code is pretty old and corresponds to SHA1:
> 60f5ecebdeee37d56f33374c407376f596baa468
>
> from: git://www.aleph1.co.uk/yaffs2
>
>
> From my debugging I do see two bit flips (should be 1s, but I read 0s)
> happening in the same chunk of data (0x100), from which ECC is
> calculated.
> As fair as I know the ECC will be "correct" for two bit flops.
>
>
> I've looked to the yaffs_ecc.* files and found following comment:
>
>
> /*
>  * This code implements the ECC algorithm used in SmartMedia.
>  *
>  * The ECC comprises 22 bits of parity information and is stuffed into
>    3 bytes.
>  * The two unused bit are set to 1.
>  * The ECC can correct single bit errors in a 256-byte page of data.
>  * Thus, two such ECC blocks are used on a 512-byte NAND page.
>  *
>  */

>
> So it seems like two bit flops are not detected - only single bit flop
> is detected and corrected.
>
> Is there any way to mitigate this issue?
>


There are many ways to do ECC in the system. Yaffs provides an ECC function
that is really intended for older flash devices (SmartMedia etc - really,
really old) running in Yaffs1 mode where 1-bit correcting ECC was the norm.
That Yaffs ECC code is also used for protecting very small blocks of
unprotected data (eg. tags).

In most circumstances (ie. running Yaffs2 mode), the actual ECC that is
used is done in the driver and it is not part of Yaffs.




>
> IMHO the NAND flash page for this data chunk shall be marked as BAD ->
> but we cannot detect such errors.
>
> Is there any plan to implement new algorithm?
>


When Yaffs2 was introduced (many years ago now), the biggest motivation was
that there are different NAND types with different ECC requirements,
different write order requirements etc.

ie. the decision was made that it is impossible to try handle all the ECC
variants (hw/sw/BCH/...) within Yaffs and it was better to move that into
the driver.

If you can post a bit more info about the flash parts you are using etc,
then I can give a better appraisal.

Feel free to do this off list if there is sensitive proprietary information.

-- Charles