Flash Memory
MPC5606S Microcontroller Reference Manual, Rev. 7
Freescale Semiconductor 623
During a flash memory modify operation, any attempt to read any flash memory location will output
invalid data and bit RWE of MCR will be automatically set. This means that the flash module is not
fetchable when a Modify Operation is active: The Modify Operation commands must be executed from
another Memory (internal Ram or external Memory).
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 3 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 EHV in MCR or AIE in UT0.
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 are shown in the following Table 17-36.
In general each Modify Operation is completed through a sequence of four steps:
1. Wait for operation completion: wait for bit MCR.DONE (or UT0.AID) to go high.
2. Check operation result: check bit MCR.PEG (or compare UMISR0-4 with expected value).
3. Switch-Off FPEC by resetting MCR.EHV (or UT0.AIE).
4. Deselect current operation by clearing MCR.PGM/ERS (or UT0.MRE/EIE).
If the device embeds more than one flash memory macrocell 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 macrocells.
In the following, all the possible Modify operations are described and some examples of the sequences
needed to activate them are presented.
17.3.7.2 Double Word program
A flash memory program sequence operates on any double word within the flash core.
As many as two words within the Double word may be altered in a single program operation.
Table 17-59. Flash 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, HBS MCR.EHV
Array Integrity Check None LMS, HBS UT0.AIE
Margin Read UT0.MRE UT0.MRV + LMS, HBS UT0.AIE
ECC Logic Check UT0.EIE UT0.DSI, UT1, UT2 UT0.AIE