R01UH0092EJ0110 Rev.1.10
Page 680 of 807
Jul 31, 2012
M16C/64C Group
30. Flash Memory
30.8.2
EW1 Mode
EW1 mode is selected by setting the FMR60 bit in the FMR6 register to 1 after setting the FMR01 bit in
the FMR0 register to 1. Figure 30.10 shows Setting and Resetting of EW1 Mode.
When a program or erase operation is initiated, the CPU halts all program execution until the operation
is completed.
Figure 30.10 Setting and Resetting of EW1 Mode
The following are interrupts which can be used in EW1 mode and operations when the interrupts occur
during auto-erase operation or auto-program operation:
• Maskable interrupt (suspend function enabled)
Auto-erase operation or auto-program operation suspends after td(SR-SUS) elapses and the
interrupt process is executed. Auto-erase operation or auto-program operation restarts by setting
the FMR31 bit in the FMR3 register to 0 (command restart) after the interrupt process is completed.
• Maskable interrupt (suspend function disabled)
Auto-erase operation or auto-program operation has a higher priority level and the interrupt
request has to wait. The interrupt process is executed after auto-erase operation or auto-program
operation is completed.
•
NMI
, watchdog timer, oscillator stop/restart detect, voltage detect 1, and voltage detect 2 interrupts
Auto-erase operation or auto-program operation forcibly stops 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 stops its counting during auto-erase or auto-programming. Do not use EW1 mode
while the CSPRO bit in the CSPR register is 1 (count source protection mode enabled). Use EW0
mode. However, counts does not stop during erase suspend or program suspend. As the interrupt
request may be generated, initialize the watchdog timer regularly using the suspend function.
Program in ROM
Procedure to Enter EW1 Mode
Write 0 and then 1 (CPU rewrite mode enabled) to the FMR01
bit. Set the FMR11 bit to 1 (FMR6 register rewrite enabled),
then set the FMR6 register to 03h (EW1 mode), and then set
the FMR11 bit to 0 (FMR6 register rewrite disabled).
Single-chip mode
Execute the software commands
Set the FMR01 bit to 0
(CPU rewrite mode disabled)
Start
End
Set registers CM0, CM1, and PM1
(Set the CPU clock 10 MHz or lower with one wait)
Содержание M16C Series
Страница 846: ...M16C 64C Group R01UH0092EJ0110...