Flash programming may be performed by the main application in Standby mode. The entire flash may be programmed, or a flash block may be selected for partial flash updates. The main application determines whether each flash block is stored in flash or EEPROM, if it is in use. Therefore the procedure is identical for EEPROM programming.
The following commands are used to erase, program, and verify a flash block:
Figure 5-17 demonstrates the flash programming steps. The steps to write each command must follow the write command handler procedure described in Section 3.4.3.
- Write Flash Data Type Select - Sets the desired flash block or blocks to be erased and re-programmed.
- Write Flash Erase Data - Erases the selected flash block(s). This process may require significant time to complete. The Write Command Handler should expect additional time to poll the Short Status to confirm that the command tag has changed to the appropriate value and that the Request In Progress bit has been cleared before proceeding to the next step.
- Flash Write Data - Repeatedly write up to a page (256 bytes) of flash data. The data size being written must be a multiple of 4. After each section of data is written, read the short status repeatedly until the write has completed. Continue until there is no remaining flash data.
- Flash Verify Data - Begin verification of the flash. This process may require significant time to complete. The Write Command Handler should expect additional time to poll the Short Status to confirm that the command tag has changed to the appropriate value and that the Request In Progress bit has been cleared. A flash verification error will flag the Command Error bit in the Short Status. This should be detected in the write command handling procedure.