The flash memory cannot be read while being programmed or erased, so the update program must
either be stored in external memory, or transferred temporarily to the RAM area and executed in
RAM.
User Program Mode Execution Procedure:
Figure 18-13 shows the procedure for user program
mode execution in RAM.
Figure 18-13 User Program Mode Operation (Example)
Transfer on-board update
program into RAM
Store user application programs
Set MD
to MD
to 101, 110, or 111
Apply 0 to 5 V to MD
2
V
= 12 V
(user program mode)
Wait 5 to 10
μ
s
Update flash memory
Execute user application program
Execute on-board update
program in RAM
1
2
Set V
PP
E bit
4
3
5
Procedure
1. The user stores application programs in
flash memory. One of these is an on-
board update program that will execute
steps 3 to 5 below.
2. Pin inputs are set up for user program
mode.
3. A reset starts the CPU, which transfers
the on-board update program into RAM.
4. Following a branch to the program in
RAM, the on-board update program is
executed.
V
PP
E bit in FLMCR is set to update
flash memory.
Wait 5 to 10μs to stabilize internal
power supply.
Update program is executed.
5. After the on-board update ends, clear
the V
PP
E bit then a branch is made to
the updated user application program
and this program is executed.
After clearing the V
PP
E bit, before the
flash memory program executes, flash
memory read setup time (t
PRS
) is
needed.
588
Note:
To prevent microcontroller errors caused by accidental programming or erasing, apply 12 V to VPP
only when the flash memory is programmed or erased, or when flash memory is emulated by RAM;
do not apply 12 V to the VPPpin during normal operation. While 12 V is applied, the watchdog
timer should be running and enabled to halt runaway program execution, so that program runaway
will not lead to overprogramming or overerasing. For further information about turning VPPon and
off, see section 18-10, Flash Memory Programming and Erasing Precautions.