NAND write verify failed problem
Hi
I'm testing a new board with a NAND device chip
and I've hit a couple of problems which I'm not
sure what the problem is.
My configuration is as follows.
CPU: MPC850SR powerpc
NAND: Samsung K9FF5608U0B (32Mb, 8bit interface).
Kernel: LinuxPPC 2.4.21-rc2 devel.
The kernel has fairly recent MTD drivers and a diff found no major differences.
I use the mtd utils from the latest nightly tarball.
The NAND driver is a custom one I made based on the example in the docs. It is fairly simple and the chip is detected alright at boot time.
The relevant .config fragment is as follows:
CONFIG_MTD=yCONFIG_MTD_DEBUG=yCONFIG_MTD_DEBUG_VERBOSE=0CONFIG_MTD_PARTITIONS=yCONFIG_MTD_CONCAT=yCONFIG_MTD_CMDLINE_PARTS=yCONFIG_MTD_CHAR=yCONFIG_MTD_BLOCK=yCONFIG_MTD_NAND=yCONFIG_MTD_NAND_VERIFY_WRITE=yCONFIG_MTD_NAND_NETVIA=y # the name of my boardCONFIG_MTD_NAND_IDS=y
I intend to use JFFS2 which I used in a previous
design with a NOR flash.
Mounting an NFS root from a shell on the target...
Erasing seems to go well.
Quoted 1 line
root$ eraseall -j
/dev/mtd0
Erasing 16 Kibyte @ 1ffc000 -- 99 % complete. Cleanmarker written at 1ffc000
Making a test jffs2 image (size 540672 bytes)
Quoted 1 line
root$ mkfs.jffs2 -e16384 -b -p -v -d
/root/-o/tmp/root.jffs2.image
Copying the image to the NAND.
Quoted 4 lines
root$ fcp -v
/tmp/root.jffs2.image/dev/mtd0
Erasing blocks: 33/33 (100%)
Writing data: 528k/528k (100%)
Verifying data: 20k/528k (3%)File does not seem to match flash data. First mismatch at 0x00002800-0x00005000
We have the first warning that something is amiss. Still no warning or error at syslog.
Now things get interesting...
Quoted 1 line
root$ mount -t jffs2
/dev/mtdblock0/mnt/
Mount takes 30 seconds to finish, and during that time the board does not respond to any external stimulus. This is caused I believe from the scaning of the NAND, which I take it is normal.
The contents of the files match what was written to the image.
But when I try to write by copying a small file the write fails and I get the following to the syslog.
nand_write_page: Failed write verify, page 0x0000040b <5>Write of 68 bytes at 0x00081774 failed. returned -5, retlen 0
Mar 10 21:44:22 netvia-ppc kernel: Not marking the space at 0x00081774 as dirty because the flash driver returned retlen zero
Any ideas how to proceed?
Regards
Pantelis
Re: NAND write verify failed problem (SOLVED?)
Quoted 80 lines · Pantelis Antoniou
Hi
I'm testing a new board with a NAND device chip
and I've hit a couple of problems which I'm not
sure what the problem is.My configuration is as follows.
CPU: MPC850SR powerpc
NAND: Samsung K9FF5608U0B (32Mb, 8bit interface).
Kernel: LinuxPPC 2.4.21-rc2 devel.The kernel has fairly recent MTD drivers and a diff found no major differences.
I use the mtd utils from the latest nightly tarball.The NAND driver is a custom one I made based on the example in the docs. It is fairly simple and the chip is detected alright at boot time.
The relevant .config fragment is as follows:
CONFIG_MTD=yCONFIG_MTD_DEBUG=yCONFIG_MTD_DEBUG_VERBOSE=0CONFIG_MTD_PARTITIONS=yCONFIG_MTD_CONCAT=yCONFIG_MTD_CMDLINE_PARTS=yCONFIG_MTD_CHAR=yCONFIG_MTD_BLOCK=yCONFIG_MTD_NAND=yCONFIG_MTD_NAND_VERIFY_WRITE=yCONFIG_MTD_NAND_NETVIA=y# the name of my boardCONFIG_MTD_NAND_IDS=yI intend to use JFFS2 which I used in a previous
design with a NOR flash.Mounting an NFS root from a shell on the target...
Erasing seems to go well.
Quoted 1 line
root$ eraseall -j
/dev/mtd0Erasing 16 Kibyte @ 1ffc000 -- 99 % complete. Cleanmarker written at 1ffc000
Making a test jffs2 image (size 540672 bytes)
Quoted 1 line
root$ mkfs.jffs2 -e16384 -b -p -v -d
/root/-o/tmp/root.jffs2.imageCopying the image to the NAND.
Quoted 4 lines
root$ fcp -v
/tmp/root.jffs2.image/dev/mtd0
Erasing blocks: 33/33 (100%)
Writing data: 528k/528k (100%)
Verifying data: 20k/528k (3%)File does not seem to match flash data.First mismatch at 0x00002800-0x00005000
We have the first warning that something is amiss. Still no warning or error at syslog.
Now things get interesting...
Quoted 1 line
root$ mount -t jffs2
/dev/mtdblock0/mnt/Mount takes 30 seconds to finish, and during that time the board does not respond to any external stimulus. This is caused I believe from the scaning of the NAND, which I take it is normal.
The contents of the files match what was written to the image.
But when I try to write by copying a small file the write fails and I get the following to the syslog.
nand_write_page: Failed write verify, page0x0000040b<5>Write of 68 bytes at0x00081774failed. returned -5, retlen 0Mar 10 21:44:22 netvia-ppc kernel: Not marking the space at 0x00081774 as dirty because the flash driver returned retlen zeroAny ideas how to proceed?
Regards
Quoted 9 lines
Pantelis
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
I hate to reply to myself, but the problem appears to be the NAND verify code. When I removed it everything works fine. Should I be worried though?
Regards
Pantelis
Quoted 5 lines · Pantelis Antoniou
Quoted 5 lines
root$ fcp -v
/tmp/root.jffs2.image/dev/mtd0
Erasing blocks: 33/33 (100%)
Writing data: 528k/528k (100%)
Verifying data: 20k/528k (3%)File does not seem to match flash data.
Are you writing with ECC ? If not use nandwrite from mtd/utils
Quoted 3 lines
Mount takes 30 seconds to finish, and during that time the board does not respond to any external stimulus. This is caused I believe from the scaning of the NAND, which I take it is normal.
Should be much faster with current MTD CVS code
Quoted 5 lines
nand_write_page: Failed write verify, page0x0000040b<5>Write of 68 bytes at0x00081774failed. returned -5, retlen 0Mar 10 21:44:22 netvia-ppc kernel: Not marking the space at 0x00081774as dirty because the flash driver returned retlen zero Any ideas how to proceed?
Yes, update nand driver from MTD-CVS. It's fixed.
Signature · 5 lines
Thomas ________________________________________________________________________ linutronix - competence in embedded & realtime linux http://www.linutronix.de mail: [email protected]
Quoted 23 lines · Thomas Gleixner
Quoted 6 lines · Pantelis Antoniou
Quoted 4 lines
root$ fcp -v
/tmp/root.jffs2.image/dev/mtd0
Erasing blocks: 33/33 (100%)
Writing data: 528k/528k (100%)
Verifying data: 20k/528k (3%)File does not seem to match flash data.Are you writing with ECC ? If not use nandwrite from mtd/utils
Quoted 5 lines
Mount takes 30 seconds to finish, and during that time the board does not respond to any external stimulus. This is caused I believe from the scaning of the NAND, which I take it is normal.
Should be much faster with current MTD CVS code
Quoted 10 lines
Quoted 6 lines
nand_write_page: Failed write verify, page0x0000040b<5>Write of 68 bytes at0x00081774failed. returned -5, retlen 0Mar 10 21:44:22 netvia-ppc kernel: Not marking the space at 0x00081774as dirty because the flash driver returned retlen zero Any ideas how to proceed?
Yes, update nand driver from MTD-CVS. It's fixed.
I ran into problems by trying to use a vanilla 2.4.21-rc7 with utils from the MTD latest snapshot.
Patching the kernel with the MTD-CVS fixed everything.
BTW, is there something anologous to CRAMFS for NAND flash? I have a need for a compressed read-only filesystem on NAND but CRAMFS has no concept of bad blocks.
Regards and thanks for the reply.
Pantelis
Re: NAND write verify failed problem -->cramfs
Quoted 4 lines
BTW, is there something anologous to CRAMFS for NAND flash? I have a need for a compressed read-only filesystem on NAND but CRAMFS has no concept of bad blocks.
You could use loop mounting. ie. store the CRAMFS image using a normal NAND file system (YAFFS or JFFS2) and loop mount it with cramfs.
-- CHarles
Re: NAND write verify failed problem -->cramfs
Sorry I am new to this list and I have two questions as below:
1. To loop mount a CRAMFS (root file system) image on one JFFS2 partition, we should mount that partition first, shouldn't we? But how can we mount that JFFS2 partition without mounting the root file system?
2. Currently I use NAND flash with ramdisk image on /dev/mtdblock1 as the root file system. Usually I write the ramdisk image using the command "nandwrite /dev/mtdblock1 ramdisk.gz". So far everything works fine. But I am wondering whether the kernel can still load the ramdisk image if there are some bad blocks on /dev/mtdblock1?
Thanks a lot for the help.
Regards,
Kevin
----- Original Message -----
From: "Charles Manning" <[email protected]>
To: "Pantelis Antoniou" <[email protected]>; <[email protected]>
Cc: <[email protected]>
Sent: Friday, June 06, 2003 5:10 AM
Subject: Re: NAND write verify failed problem -->cramfs
Quoted 3 lines
BTW, is there something anologous to CRAMFS for NAND flash? I have a need for a compressed read-only filesystem on NAND but CRAMFS has no concept of bad blocks.
You could use loop mounting. ie. store the CRAMFS image using a normal NAND file system (YAFFS or JFFS2) and loop mount it with cramfs.
-- CHarles
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: NAND write verify failed problem -->cramfs
Quoted 5 lines · you
Sorry I am new to this list and I have two questions as below:
1. To loop mount a CRAMFS (root file system) image on one JFFS2 partition, we should mount that partition first, shouldn't we? But how can we mount that JFFS2 partition without mounting the root file system?
Doing this with a root file system makes it a bit more challenging... I don't know if that can be done.
Quoted 6 lines
2. Currently I use NAND flash with ramdisk image on
/dev/mtdblock1as the root file system. Usually I write the ramdisk image using the command "nandwrite/dev/mtdblock1ramdisk.gz". So far everything works fine. But I am wondering whether the kernel can still load the ramdisk image if there are some bad blocks on/dev/mtdblock1?
You could perhaps use a cut-down version of YAFFS (like is used in the YAFFS bootloader) to store a CRAMFS image. This is relatively simple and quite a few people do this for booting.
Do you have enough RAM to load the image into RAM at boot? That would make it even easier.
-- CHarles
Quoted 31 lines
Thanks a lot for the help.
Regards,
Kevin----- Original Message -----
From: "Charles Manning" <[email protected]>
To: "Pantelis Antoniou" <[email protected]>; <[email protected]>
Cc: <[email protected]>
Sent: Friday, June 06, 2003 5:10 AM
Subject: Re: NAND write verify failed problem -->cramfsQuoted 3 lines
BTW, is there something anologous to CRAMFS for NAND flash? I have a need for a compressed read-only filesystem on NAND but CRAMFS has no concept of bad blocks.
You could use loop mounting. ie. store the CRAMFS image using a normal NAND file system (YAFFS or JFFS2) and loop mount it with cramfs.
-- CHarles
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/