English
Language : 

MC9S12KG128 Datasheet, PDF (106/600 Pages) Freescale Semiconductor, Inc – Microcontrollers
Chapter 2 128 Kbyte ECC Flash Module (FTS128K1ECCV1)
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.
Read: Register FCLKDIV
Clock Register
Loaded
Check
Bit FDIVLD set? no
yes
Write: Register FCLKDIV
1.
Write: Flash Address and
Program Data
2.
Write: Register FCMD
Program Command 0x20
3.
Write: Register FSTAT
Clear bit CBEIF 0x80
Read: Register FSTAT
NOTE: command write sequence
aborted by writing 0x00 to
FSTAT register.
NOTE: command write sequence
aborted by writing 0x00 to
FSTAT register.
Protection
Violation Check
Access
Error Check
Address, Data,
Command
Buffer Empty Check
Bit
PVIOL
Set?
no
Bit
ACCERR
Set?
no
yes Write: Register FSTAT
Clear bit PVIOL 0x20
yes Write: Register FSTAT
Clear bit ACCERR 0x10
Bit
CBEIF
yes
Set?
no
yes
Next Write?
no
Bit Polling for
Command
Completion Check
Bit
CCIF
no
Set?
yes
Read: Register FSTAT
EXIT
Figure 2-26. Example Program Command Flow
MC9S12KG128 Data Sheet, Rev. 1.15
106
Freescale Semiconductor