English
Language : 

PXD10RM Datasheet, PDF (591/1332 Pages) Freescale Semiconductor, Inc – PXD10 Microcontroller
The Erase operation consists of the following sequence of events:
1. Change the value in the MCR.ERS bit from 0 to 1.
2. Select the block(s) to be erased by writing ‘1’s to the appropriate register(s) in LMS or HBS
registers.
If the shadow block is to be erased, this step may be skipped, and LMS and HBS are ignored.
Note that Lock and Select are independent. If a block is selected and locked, no erase will occur.
3. Write to any address in Flash. This is referred to as an erase interlock write.
4. Write a logic 1 to the MCR.EHV bit to start the internal erase sequence or skip to step 9 to
terminate.
5. Wait until the MCR.DONE bit goes high.
6. Confirm MCR.PEG=1.
7. Write a logic 0 to the MCR.EHV bit.
8. If more blocks are to be erased, return to step 2.
9. Write a logic 0 to the MCR.ERS bit to terminate the erase operation.
After setting MCR.ERS, one write, referred to as an interlock write, must be performed before MCR.EHV
can be set to 1. Data words written during erase sequence interlock writes are ignored.
The user may terminate the erase sequence by clearing ERS before setting EHV.
An erase operation may be aborted by clearing MCR.EHV assuming MCR.DONE is low, MCR.EHV is
high and MCR.ESUS is low.
An erase abort forces the Module to step 8 of the erase sequence.
An aborted erase will result in MCR.PEG being set low, indicating a failed operation. MCR.DONE must
be checked to know when the aborting command has completed.
The block(s) being operated on before the abort contain indeterminate data. This may be recovered by
executing an erase on the affected blocks.
The user may not abort an erase sequence while in erase suspend.
Example 17-2. Erase of sectors B0F1 and B0F2.
MCR
= 0x00000004;
LMS
= 0x00000006;
(0x000000)
= 0xFFFFFFFF;
MCR
= 0x00000005;
do
{ tmp
= MCR;
} while ( !(tmp & 0x00000400) );
status
= MCR & 0x00000200;
MCR
= 0x00000004;
MCR
= 0x00000000;
/* Set ERS in MCR: Select Operation */
/* Set LSL2-1 in LMS: Select Sectors to erase */
/* Latch a Flash Address with any data */
/* Set EHV in MCR: Operation Start */
/* Loop to wait for DONE=1 */
/* Read MCR */
/* Check PEG flag */
/* Reset EHV in MCR: Operation End */
/* Reset ERS in MCR: Deselect Operation */
Freescale Semiconductor
PXD10 Microcontroller Reference Manual, Rev. 1
Preliminary—Subject to Change Without Notice
17-41