M58LT128HST, M58LT128HSB
Flowcharts and pseudo codes
Figure 21. Buffer Program flowchart and pseudo code
Buffer_Program_command (Start_Address, n, buffer_Program[] )
Start
/* buffer_Program [] is an array structure used to store the address and
data to be programmed to the Flash memory (the address must be within
the segment Start Address and Start Address+n) */
{
Buffer Program E8h
Command,
Start Address
do {writeToFlash (Start_Address, 0xE8) ;
status_register=readFlash (Start_Address);
} while (status_register.SR7==0);
Read Status
Register
NO
SR7 = 1
YES
Write n(1)
writeToFlash (Start_Address, n);
,
Start Address
Write Buffer Data,
Start Address
writeToFlash (buffer_Program[0].address, buffer_Program[0].data);
/*buffer_Program[0].address is the start address*/
X = 0
x = 0;
YES
while (x<n)
X = n
NO
Write Next Buffer Data,
Next Program Address
(2)
{ writeToFlash (buffer_Program[x+1].address, buffer_Program[x+1].data);
x++;
X = X + 1
}
Program
Buffer to Flash
Confirm D0h
writeToFlash (Start_Address, 0xD0);
Read Status
Register
do {status_register=readFlash (Start_Address);
} while (status_register.SR7==0);
NO
SR7 = 1
YES
Full Status
full_status_register_check();
Register Check(3)
}
End
AI08913b
1. n + 1 is the number of data being programmed.
2. Next program data is an element belonging to buffer_Program[].data; next program address is an element belonging to
buffer_Program[].address
3. Routine for Error Check by reading SR3, SR4 and SR1.
93/110