English
Language : 

MC9S12KG128 Datasheet, PDF (132/600 Pages) Freescale Semiconductor, Inc – Microcontrollers
Chapter 3 2 Kbyte EEPROM Module (EETS2KV1)
3.4.1.2 Command Write Sequence
The EEPROM command controller is used to supervise the command write sequence to execute program,
erase, mass erase, sector modify, and erase verify operations. Before starting a command write sequence,
it is necessary to check that there is no pending access error or protection violation (the ACCERR and
PVIOL flags must be cleared in the ESTAT register).
After this initial step, the CBEIF flag must be tested to ensure that the address, data and command buffers
are empty. If so, the command sequence can be started. The following 3-step command write sequence
must be strictly adhered to and no intermediate access to the EEPROM array is permitted between the 3
steps. It is possible to read any EEPROM register during a command sequence. The command write
sequence is as follows:
1. Write an aligned word to be to a valid EEPROM array address. The address and data will be stored
in internal buffers.
— For program and sector modify, all address and data bits are valid.
— For erase, the value of the data bytes are ignored.
— For mass erase and erase verify, the address can be anywhere in the available address space of
the array.
— For sector erase, the address bits[1:0] are ignored.
2. Write a valid command, listed in Table 3-10, to the ECMD register.
3. Clear the CBEIF flag by writing a 1 to CBEIF to launch the command. When the CBEIF flag is
cleared, the CCIF flag is cleared by hardware indicating that the command was successfully
launched. The CBEIF flag will be set again indicating the address, data, and command buffers are
ready for a new command write sequence to begin.
The completion of the command is indicated by the CCIF flag setting. The CCIF flag only sets when all
active and pending commands have been completed.
The EEPROM command controller will flag errors in command write sequences by means of the
ACCERR (access error) and PVIOL (protection violation) flags in the ESTAT register. An erroneous
command write sequence will abort and set the appropriate flag. If set, the user must clear the ACCERR
or PVIOL flags before commencing another command write sequence. By writing a 0 to the CBEIF flag
the command sequence can be aborted after the word write to the EEPROM address space or after writing
a command to the ECMD register and before the command is launched. Writing a 0 to the CBEIF flag in
this way will set the ACCERR flag.
A summary of the launching of a program operation is shown in Figure 3-18. For other operations, the user
writes the appropriate command to the ECMD register.
MC9S12KG128 Data Sheet, Rev. 1.15
132
Freescale Semiconductor