
25. Flash Memory
25.3.2
Notes on CPU Rewrite Mode
25.3.2.1
Operating Speed
Set the CPU clock frequency to 10 MHz or lower using bits MCD4 to MCD0 in the MCD register prior to
entering CPU rewrite mode. Also, set the PM12 bit in the PM1 register to 1 (internal memory wait state
inserted), and then enter CPU rewrite mode.
25.3.2.2
Prohibited Instructions
The following instructions cannot be used in CPU rewrite mode because the flash memory is accessed by
executing these instructions: the UND, INTO, JMPS, JSRS, and BRK.
25.3.2.3
Interrupts
To use interrupts having vectors in a relocatable vector table, their vectors must be relocated in the RAM
area.
The NMI and watchdog timer interrupts are available because registers FMR0 and FMR1 are forcibly
initialized when either interrupt occurs. Allocate a destination addresses for individual interrupt routine to
the fixed vector table. Rewrite operation is aborted when the NMI or watchdog timer interrupt occurs.
Execute a rewrite program again after exiting the interrupt routine.
The address match interrupt is not available because the flash memory is accessed to process this interrupt.
25.3.2.4
How to Access
To set the FMR01 or FMR02 bit in the FMR0 register, set to 1 immediately after setting it to 0. Write the value
to the FMR0 register in bytes. Do not generate an interrupt or a DMA or DMACII transfer between setting the
bit to 0 and to 1. Set these bits while a high-level (“H”) signal is applied to the NMI pin.
To change the FMR01 bit from 1 to 0, enter read array mode first, and write into address 0057h in words. Eight
high-order bits must be set to 00h.
25.3.2.5
Rewriting User ROM Area
If the supply voltage drops while rewriting the block where a rewrite control program is stored, it may not be
possible to rewrite the flash memory again, because the rewrite control program is not rewritten successfully. If
this error occurs, use standard serial I/O mode or parallel I/O mode to rewrite the user ROM area.
25.3.2.6
Writing Command and Data
Write command codes and data to even addresses in the user ROM area.
25.3.2.7
Wait Mode
To enter wait mode, set the FMR01 bit in the FMR0 register to 0 (CPU rewrite mode disabled) and then execute
the WAIT instruction.