English
Language : 

MC9S12KG128_10 Datasheet, PDF (134/606 Pages) Freescale Semiconductor, Inc – HCS12 Microcontrollers
Chapter 3 2 Kbyte EEPROM Module (S12EETS2KV1)
3.4.1.3 Valid EEPROM Commands
Table 3-10 summarizes the valid EEPROM commands. Also shown are the effects of the commands on
the EEPROM array.
Table 3-10. Valid EEPROM Commands
ECMD
0x05
0x20
0x40
0x41
0x60
Meaning
Function on EEPROM Array
Erase Verify Verify all memory bytes of the EEPROM array are erased. If the array is erased, the BLANK bit
will set in the ESTAT register upon command completion.
Program Program a word (two bytes).
Sector Erase Erase two words (four bytes) of EEPROM array.
Mass Erase Erase all of the EEPROM array. A mass erase of the full array is only possible when EPDIS and
EPOPEN are set.
Sector Modify Erase two words of EEPROM, re-program one word.
CAUTION
An EEPROM word must be in an erased state before being programmed.
Cumulative programming of bits within a word is not allowed.
The sector modify command (0x60) is a two-step command which first erases a sector (2 words) of the
EEPROM array and then re-programs one of the words in that sector. The EEPROM sector which is erased
by the sector modify command is the sector containing the address of the aligned array write which starts
the valid command sequence. That same address is re-programmed with the data which is written. By
launching a sector modify command and then pipelining a program command it is possible to completely
replace the contents of an EEPROM sector.
3.4.1.4 Illegal EEPROM Operations
The ACCERR flag will be set during the command write sequence if any of the following illegal
operations are performed causing the command write sequence to immediately abort:
1. Writing to the EEPROM address space before initializing ECLKDIV.
2. Writing a misaligned word or a byte to the valid EEPROM address space.
3. Writing to the EEPROM address space while CBEIF is not set.
4. Writing a second word to the EEPROM address space before executing a program or erase
command on the previously written word.
5. Writing to any EEPROM register other than ECMD after writing a word to the EEPROM address
space.
6. Writing a second command to the ECMD register before executing the previously written
command.
7. Writing an invalid command to the ECMD register in normal mode.
8. Writing to any EEPROM register other than ESTAT (to clear CBEIF) after writing to the command
register (ECMD).
MC9S12KG128 Data Sheet, Rev. 1.16
134
Freescale Semiconductor