M58CR064C, M58CR064D, M58CR064P, M58CR064Q
Figure 24. Block Erase Flowchart and Pseudo Code
Start
Write 20h
Write Block
Address & D0h
Read Status
Register
erase_command ( blockToErase ) {
writeToFlash (bank_address, 0x20) ;
writeToFlash (blockToErase, 0xD0) ;
/* only A12-A20 are significannt */
/* Memory enters read status state after
the Erase Command */
do {
status_register=readFlash (bank_address) ;
/* E or G must be toggled*/
NO
SR7 = 1
YES
NO
SR3 = 0
YES
YES
SR4, SR5 = 1
NO
NO
SR5 = 0
YES
NO
SR1 = 0
YES
End
VPP Invalid
Error (1)
Command
Sequence Error (1)
Erase Error (1)
Erase to Protected
Block Error (1)
} while (status_register.SR7== 0) ;
if (status_register.SR3==1) /*VPP invalid error */
error_handler ( ) ;
if ( (status_register.SR4==1) && (status_register.SR5==1) )
/* command sequence error */
error_handler ( ) ;
if ( (status_register.SR5==1) )
/* erase error */
error_handler ( ) ;
if (status_register.SR1==1) /*program to protect block error */
error_handler ( ) ;
}
Note: If an error is found, the Status Register must be cleared before further Program/Erase operations.
AI06174
62/70