Datasheet

Chapter 2 256 Kbyte Flash Module (S12FTS256K2V1)
MC9S12E256 Data Sheet, Rev. 1.10
110 Freescale Semiconductor
2.4.1.3.3 Program Command
The program command is used to program a previously erased word in the Flash memory using an
embedded algorithm. If the word to be programmed is in a protected area of the Flash block, the PVIOL
flag in the FSTAT register will set and the program command will not launch. After the program command
has successfully launched, the CCIF flag in the FSTAT register will set after the program operation has
completed unless a second command has been buffered.
A summary of the launching of a program operation is shown in Figure 2-26.
Figure 2-26. Example Program Command Flow
Write: Register FCLKDIV
Read: Register FCLKDIV
Bit FDIVLD set?
Write: Flash Address and
Write: Register FCMD
Program Command 0x20
Write: Register FSTAT
yes
no
Clear bit CBEIF 0x80
yes
Clock Register
Loaded
Check
1.
2.
3.
Clear bit ACCERR 0x10
Write: Register FSTAT
no
yes
no
Protection
Violation Check
Access
Error Check
Read: Register FSTAT
no
no
Address, Data,
Command
Buffer Empty Check
Next Write?
yes
EXIT
no
Program Data
Clear bit PVIOL 0x20
Write: Register FSTAT
yes
Bit Polling for
Command
Completion Check
Read: Register FSTAT
yes
NOTE: command write sequence
aborted by writing 0x00 to
FSTAT register.
NOTE: command write sequence
aborted by writing 0x00 to
FSTAT register.
CCIF
Set?
Bit
CBEIF
Set?
Bit
ACCERR
Set?
Bit
PVIOL
Set?
Bit