4.5. Erasing Blocks

The flashEraseBlocks() method is implemented to erase blocks. It iterates over the blocks, first unlocking them, then performing an erase, and then locking them. The unlocking is necessary because the default state of many flash devices is to have the blocks locked. The locking after the erase is optional, but is included to prevent accidental modification of the flash contents.

After erasing each block the flash device status register is checked for any errors. If an error is detected then the method returns immediately without attempting further erase operations.

The flash blocks are always left in read mode after erasing is complete. Care is taken to ensure that read mode is selected even in the case of an error being detected.

Copyright © 2007. All rights reserved.DAI0190A
Non-Confidential