English
Language : 

MC9S12KG128_10 Datasheet, PDF (106/606 Pages) Freescale Semiconductor, Inc – HCS12 Microcontrollers
Chapter 2 128 Kbyte ECC Flash Module (S12FTS128K1ECCV1)
2.4.1.3.4 Sector Erase Command
The sector erase command is used to erase the addressed sector in the Flash memory using an embedded
algorithm. If the Flash sector to be erased is in a protected area of the Flash block, the PVIOL flag in the
FSTAT register will set and the sector erase command will not launch. After the sector erase command
has successfully launched, the CCIF flag in the FSTAT register will set after the sector erase operation has
completed unless a second command has been buffered.
Read: Register FCLKDIV
Clock Register
Loaded
Check
Bit FDIVLD set? no
yes
Write: Register FCLKDIV
1.
Write: Flash Sector Address
and Dummy Data
2.
Write: Register FCMD
Sector Erase Command 0x40
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
Bit
CBEIF
Set?
no
yes Write: Register FSTAT
Clear bit PVIOL 0x20
yes Write: Register FSTAT
Clear bit ACCERR 0x10
yes
yes
Next Write?
no
Bit Polling for
Command
Completion Check
Bit
CCIF
no
Set?
yes
Read: Register FSTAT
EXIT
Figure 2-28. Example Sector Erase Command Flow
MC9S12KG128 Data Sheet, Rev. 1.16
106
Freescale Semiconductor