MPC5604B/C Microcontroller Reference Manual, Rev. 8
704 Freescale Semiconductor
If during a Modify Operation a reset occurs, the operation is suddenly terminated and the Macrocell is reset
to Read Mode. The data integrity of the flash memory section where the Modify Operation has been
terminated is not guaranteed: the interrupted flash memory Modify Operation must be repeated.
In general each modify operation is started through a sequence of three steps:
1. The first instruction is used to select the desired operation by setting its corresponding selection bit
in MCR (PGM or ERS) or UT0 (MRE or EIE).
2. The second step is the definition of the operands: the Address and the Data for programming or the
Sectors for erase or margin read.
3. The third instruction is used to start the modify operation, by setting MCR[EHV] or UT0[AIE].
Once selected, but not yet started, one operation can be canceled by resetting the operation selection bit.
A summary of the available flash memory modify operations is shown in Table 27-54.
Once the MCR[EHV] bit (or UT0[AIE]) is set, all the operands can no more be modified until the
MCR[DONE] bit (or UT0[AID]) is high.
In general each modify operation is completed through a sequence of four steps:
1. Wait for operation completion: wait for the MCR[DONE] bit (or UT0[AID]) to go high.
2. Check operation result: check the MCR[PEG] bit (or compare UMISR0-4 with expected value).
3. Switch off FPEC by resetting the MCR[EHV] bit (or UT0[AIE]).
4. Deselect current operation by clearing the MCR[PGM] / MCR[ERS] fields (or UT0[MRE]
/UT0[EIE]).
If the device embeds more than one flash memory module and a modify operation is on-going on one of
them, then it is forbidden to start any other modify operation on the other flash memory modules.
In the following all the possible modify operations are described and some examples of the sequences
needed to activate them are presented.
27.6.2 Double word program
A flash memory Program sequence operates on any Double Word within the flash memory core.
Up to two words within the Double Word may be altered in a single Program operation.
Table 27-54. Flash memory modify operations
Operation Select bit Operands Start bit
Double word program MCR[PGM] Address and data by interlock writes MCR[EHV]
Sector erase MCR[ERS] LMS MCR[EHV]
Array integrity check None LMS UT0[AIE]
Margin read UT0[MRE] UT0[MRV] + LMS UT0[AIE]
ECC Logic Check UT0[EIE] UT0[DSI], UT1, UT2 UT0[AIE]