Chapter 3 2 Kbyte EEPROM Module (EETS2KV1)
MC9S12HZ256 Data Sheet, Rev. 2.05
110
Freescale Semiconductor
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 ags must be cleared in the ESTAT register).
After this initial step, the CBEIF ag 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 ag by writing a 1 to CBEIF to launch the command. When the CBEIF ag is
cleared, the CCIF ag is cleared by hardware indicating that the command was successfully
launched. The CBEIF ag 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 ag setting. The CCIF ag only sets when all
active and pending commands have been completed.
The EEPROM command controller will ag errors in command write sequences by means of the
ACCERR (access error) and PVIOL (protection violation) ags in the ESTAT register. An erroneous
command write sequence will abort and set the appropriate ag. If set, the user must clear the ACCERR
or PVIOL ags before commencing another command write sequence. By writing a 0 to the CBEIF ag
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 ag in
this way will set the ACCERR ag.
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.