
R01UH0092EJ0110 Rev.1.10
Page 674 of 807
Jul 31, 2012
M16C/64C Group
30. Flash Memory
30.8.1
EW0 Mode
The MCU enters CPU rewrite mode when the FMR01 bit in the FMR0 register is set to 1 (CPU rewrite
mode enabled) and is ready to accept commands. EW0 mode is selected by setting the FMR60 bit in
the FMR6 register to 0. Figure 30.5 shows Setting and Resetting of EW0 Mode
Figure 30.5
Setting and Resetting of EW0 Mode
Do not execute the following instructions in EW0 mode:
UND instruction, INTO instruction, JMPS instruction, JSRS instruction, and BRK instruction.
The following are interrupts which can be used in EW0 mode and operations when the interrupts occur
during auto-erase operation or auto-program operation:
• Maskable interrupt (suspend disabled)
To use the interrupt, allocate a variable vector table in an area other than the flash memory.
• Maskable interrupt (suspend enabled)
To use the interrupt, allocate a variable vector table in an areas other than the flash memory.
When the FMR00 bit in the FMR0 register is checked in the interrupt routine and the result is 0
(being written or erased), auto-erase operation or auto-program operation suspends after td(SR-
SUS) elapses by setting the FMR31 bit in the FMR3 register to 1 (suspend request). Auto-erase
operation or auto-program operation restarts by setting the FMR31 bit to 0 (command restart) at
the completion of the interrupt.
•
NMI
, watchdog timer, oscillator stop/restart detect, voltage detect 1, and voltage detect 2 interrupts
Auto-erase operation or auto-program operation is forcibly stopped as soon as the interrupt occurs,
and then the interrupt process starts.
After the flash memory restart, execute auto-erase operation again and confirm that it is completed
as expected in order to read the correct value.
The watchdog timer operates even in auto erasing or auto programming operation. Refresh the
watchdog timer regularly.
Single-chip mode or memory expansion mode
Jump to the rewrite control program transferred to
an area other than the flash memory. (In the
following steps, use the rewrite control program in
an area other than the flash memory)
Transfer the rewrite control program to an area
other than flash memory
Set registers CM0, CM1, and PM1
(Set the CPU clock 10 MHz or lower with one wait)
Procedure to Enter EW0 Mode
Rewrite control program
Execute the software commands
Set the FMR01 bit to 0
(CPU rewrite mode disabled)
Jump to the desired address in the flash memory
Set the FMR01 bit to 0, and then 1 (CPU rewrite mode
enabled).
Set the FMR11 bit to 1 (FMR6 register write enabled),
then set the FMR6 register to 02h (EW0 mode),
and then set the FMR11 bit to 0 (FMR6 register write
disabled).
Start
End
Execute the read array command
Summary of Contents for M16C Series
Page 846: ...M16C 64C Group R01UH0092EJ0110...