M58LT128HST, M58LT128HSB
Flowcharts and pseudo codes
Appendix C
Flowcharts and pseudo codes
Figure 19. Program flowchart and pseudo code
Start
program_command (addressToProgram, dataToProgram) {:
writeToFlash (addressToProgram, 0x40);
/*writeToFlash (addressToProgram, 0x10);*/
/*see note (3)*/
Write 40h or 10h (3)
writeToFlash (addressToProgram, dataToProgram) ;
/*Memory enters read status state after
the Program Command*/
Write Address
& Data
do {
Read Status
Register (3)
status_register=readFlash (addressToProgram);
"see note (3)";
/* E or G must be toggled*/
NO
SR7 = 1
} while (status_register.SR7== 0) ;
YES
NO
NO
NO
V
Invalid
if (status_register.SR3==1) /*V
invalid error */
PP
PP
SR3 = 0
YES
Error (1, 2)
error_handler ( ) ;
Program
if (status_register.SR4==1) /*program error */
error_handler ( ) ;
SR4 = 0
YES
Error (1, 2)
Program to Protected
Block Error (1, 2)
if (status_register.SR1==1) /*program to protect block error */
error_handler ( ) ;
SR1 = 0
YES
End
}
AI06170b
1. Status check of SR1 (protected block), SR3 (VPP Invalid) and SR4 (program error) can be made after each program
operation or after a sequence.
2. If an error is found, the Status Register must be cleared before further Program/Erase Controller operations.
3. Any address within the bank can equally be used.
91/110