2018-11-30: Tests proposed to Quallenauge for understanding NAND problems with 512 byte sub-pages ------------------------------------------------------------------------------------------------- I think the most reasonable test program is nanddump, because it is non destructive, and reports the number of the erase blocks (relative to partition start) to stderr if the ECC is incorrect, and this number is easy to remember or to write down. +----------------------------------------------------------+ | I advise to stop testing if unexpected errors are shown | +----------------------------------------------------------+ 1. Only if mtd12 is still ubiformatted with 2048 sub-page size (i.e. no sub-pages) and containing some data.. Purpose: Check if there nevertheless are errors. --> nanddump /dev/mtd12 > /dev/null 2. I am not sure if you want to run this test, because it means an extra erase cycle, and it is less important to me. Purpose: Verify that with flash_erase really all bytes (even out-of-band data) are erased. # Erase whole mtd12 --> flash_erase /dev/mtd12 0 0 # First fast check for errors --> nanddump /dev/mtd12 > /dev/null # Check that all bytes, even in out-of-band areas, are set to 0xFF # This takes a while ... --> nanddump -o -c /dev/mtd12 | grep -vF 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff' # ... and above command SHOULD NOT show dump data; should only produce output like this here: ECC failed: 0 (uncorrectable errors since linux startup) ECC corrected: 0 (correctable errors since linux startup) Number of bad blocks: 1 (known bad blocks within partition which are listed in bad block table bbt) Number of bbt blocks: 0 (blocks belonging to bbt which are located within partition) Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x13200000... root@OpenWrt:~# Only if no additional line with nand content was shown above, then try sub-pages again: --> ubiformat /dev/mtd12 --> nanddump /dev/mtd12 > /dev/null --> ubiattach -m 12 --> nanddump /dev/mtd12 > /dev/null --> ubimkvol -N MyImportantStuff /dev/ubi0 -m --> nanddump /dev/mtd12 > /dev/null --> mount -t ubifs /dev/ubi0_0 /mnt/ --> echo 'Hello World!' > /mnt/echo.txt --> umount /mnt && ubidetach -m 12 --> nanddump /dev/mtd12 > /dev/null 3. This test I find important (unless you ran #2 and there were no errors) Purpose: Use U-Boot's command "nand erase" instead of the linux command flash_erase Don't laugh :-) ... wierd proposal, I know. I think I did this and this solved a problem which I had. Maybe it was the one which your NAND is currently showing. But I tried so many things and cannot remember all the steps I did. In U-Boot: --> nand erase 0x08C00000 0x13200000 (when above command is finished, better DO NOT TO PRESS again, as this would repeat the command) Then boot a ramimage, perform a first nanddump check for errors, on success try sub-pages again: --> nanddump /dev/mtd12 > /dev/null --> ubiformat /dev/mtd12 --> nanddump /dev/mtd12 > /dev/null --> ubiattach -m 12 --> nanddump /dev/mtd12 > /dev/null --> ubimkvol -N MyImportantStuff /dev/ubi0 -m --> nanddump /dev/mtd12 > /dev/null --> mount -t ubifs /dev/ubi0_0 /mnt/ --> echo 'Hello World!' > /mnt/echo.txt --> umount /mnt && ubidetach -m 12 --> nanddump /dev/mtd12 > /dev/null