How to test ecc correction code?
Shannon Holland
holland at loser.net
Fri Dec 10 15:01:54 EST 2004
Hello,
We're developing for a Samsung S3C2410 based system (currently running
linux 2.6.10-rc3-bk2) and are using the internal hardware error
correction code from the cpu's nand controller (3 byte ecc for a 512
byte page). I "think" I've written some code to correct errors but am a
tad stumped as to how to test it.
I had initially tried to read a block of data (including oob) using
nanddump, then erase the block, change a single bit in the first page
of my dumped data and re-write it to flash using nandwrite (specifying
-o as I include oob data). However, the first call to write the OOB
data in page 0 will fail.
At the shell level I'm doing:
# get the block of data with oob
nanddump -a 0 -l 16384 /dev/mtd3 > /tmp/nand
# some magic to flip a bit in the first byte of /tmp namd
# erase the block
flash_erase /dev/mtd3 0 1
#re-write with bad bit
nandwrite -s 0 -o /dev/mtd3 /tmp/nand
The call to nandwrite when it attempts to write the oob data for the
first page (the ioctl(fd, MEMWRITEOOB) it returns an I/O Error.
Am I doing this correctly? Is there a better way to do this? Do any
tools for this exist?
Thanks for any help!
Shannon
More information about the linux-mtd
mailing list