M58LT128HST, M58LT128HSB
Flowcharts and pseudo codes
Figure 23. Block Erase flowchart and pseudo code
Start
erase_command ( blockToErase ) {
writeToFlash (blockToErase, 0x20) ;
/*see note (2) */
Write 20h (2)
writeToFlash (blockToErase, 0xD0) ;
/* Memory enters read status state after
the Erase Command */
Write Block
Address & D0h
do {
Read Status
Register (2)
status_register=readFlash (blockToErase) ;
/* see note (2) */
/* E or G must be toggled*/
NO
SR7 = 1
YES
} while (status_register.SR7== 0) ;
NO
YES
NO
NO
V
Invalid
if (status_register.SR3==1) /*V
error_handler ( ) ;
invalid error */
PP
Error (1)
PP
SR3 = 0
YES
if ( (status_register.SR4==1) && (status_register.SR5==1) )
/* command sequence error */
Command
Sequence Error (1)
SR4, SR5 = 1
NO
error_handler ( ) ;
if ( (status_register.SR5==1) )
/* erase error */
SR5 = 0
YES
Erase Error (1)
error_handler ( ) ;
Erase to Protected
Block Error (1)
if (status_register.SR1==1) /*program to protect block error */
error_handler ( ) ;
SR1 = 0
YES
End
}
AI10976
1. If an error is found, the Status Register must be cleared before further Program/Erase operations.
2. Any address within the bank can equally be used.
95/110