R01UH0136EJ0210 Rev.2.10
Page 674 of 800
Jul 31, 2012
M16C/64A 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
To use the interrupt, allocate a variable vector table in an area other than the flash memory.
•
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
Содержание M16C/60 Series
Страница 853: ...M16C 64A Group R01UH0136EJ0210...