Why am I getting a „too many bad blocks error‟ when using a programmer to program a Cypress NAND flash device?
The short answer to this question is that the bad block marks are programmed in multiple good blocks. This makes the production programming tool fail for too many bad blocks. (Note: there may be other causes for this failure signature, but the cause outlined here is quite common).
Before programming the production image, some system manufacturers run quality assurance tests that check every bit by programming and reading back all locations, including the factory (Cypress) bad block mark locations. However, every NAND block that has non-FF data in any of the bad block marker locations (1 st byte in the spare area of the 1st, 2nd, and last pages) is considered to be a “bad block” by the NAND flash datasheet and by the flash programming tool, so if the programmed quality assurance pattern is not removed, the production programming step can fail.
To address this failure, any good blocks with bad block marks must be cleared at the end of the quality assurance tests before programming the production image. To clear the bad block mark locations in good blocks, erase the good blocks. For Cypress NAND flash, factory bad block marks cannot be cleared by the Block Erase command, so these marks persist even if the system attempts to erase all blocks in the device.