Chapter 17 Flash Memory
MPC5602P Microcontroller Reference Manual, Rev. 4
368
Freescale Semiconductor
17.3.8
Code Flash programming considerations
17.3.8.1
Modify operation
All the modify operations of the Flash module are managed through the Flash user registers interface.
All the sectors of the Flash module belong to the same partition (Bank), therefore when a Modify operation
is active on some sectors, no read access is possible on any other sector (Read-While-Modify is not
supported).
During a Flash modify operation, any attempt to read any Flash location will output invalid data and the
MCR[RWE] bit will be automatically set. This means that the Flash block is not fetchable when a modify
operation is active and these commands must be executed from another memory (internal RAM or another
Flash block).
If a reset occurs during a modify operation, the operation is interrupted and the block is reset to read mode.
The data integrity of the Flash section where the modify operation has been terminated is not guaranteed.
The interrupted Flash modify operation must be repeated.
In general, each modify operation is started through a sequence of three steps:
1. The first instruction selects the desired operation by setting its corresponding selection bit in MCR
(MCR[PGM] or MCR[ERS]) or UT0 (UT0[MRE] or UT0[EIE]).
2. The second step defines the operands: the address and the data for programming or the sectors for
erase or margin read.
3. The third instruction starts 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 modify operations are shown in
.
Once MCR[EHV] (or UT0[AIE]) is set, the operands cannot be modified until MCR[DONE] (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 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]).
Table 17-36. 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
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]