CHAPTER 18 FLASH MEMORY
User’s Manual U16898EJ3V0UD
277
Figure 18-12. Format of Flash Programming Mode Control Register (FLPMC)
Address: FFA2H After reset: Undefined
Note 1
R/W
Note 2
Symbol
7 6 5 4 3 2 1 0
FLPMC 0 PRSELF4 PRSELF3 PRSELF2 PRSELF1 PRSELF0
0 FLSPM
FLSPM
Selection of operation mode during self programming mode
0
Normal mode
Flash memory instructions can be fetched from all addresses.
1
Self programming mode
Before executing the HALT instruction, set the command, address offset, write
data, and set FLSPM to 1. After setting these items, execute the HALT
instruction; the flash memory mode is then shifted from the normal mode to the
flash memory programming mode.
PRSELF4
PRSELF3 PRSELF2 PRSELF1 PRSELF0 The set value of the protect byte
is read to these bits.
Notes 1.
Bit 0 (FLSPM) is cleared to 0 when reset is released. The set value of the protect
byte is read to bits 2 to 6 (PRSELF0 to PRSELF4) after reset is released.
2.
Bits 2 to 6 (PRSELF0 to PRSELF4) are read-only.
Cautions 1. Cautions in the case of setting the self programming mode, refer to 18.8.2
Cautions on self programming function.
2. When the oscillator or the external clock is selected as the main clock, a
wait time of 16
µ
s is required from setting FLSPM to 1 to execution of the
HALT instruction.
(2) Flash protect command register (PFCMD)
If the application system stops inadvertently due to malfunction caused by noise or program hang-up, an
operation to write the flash programming mode control register (FLPMC) may have a serious effect on the
system. PFCMD is used to protect FLPMC from being written, so that the application system does not stop
inadvertently.
Writing FLPMC is enabled only when a write operation is performed in the following specific sequence.
<1> Write a specific value to PFCMD (A5H)
<2> Write the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is invalid)
<3> Write the inverted value of the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is
invalid)
<4> Write the value to be set to bit 0 (FLSPM) of the FLPMC (writing in this step is valid)
Caution Disable interrupt servicing (by setting MK0 and MK1 to FFH and executing the DI instruction)
while the specific sequence is under execution.
This rewrites the value of the register, so that the register cannot be written illegally.
Occurrence of an illegal store operation can be checked by bit 0 (FPRERR) of the flash status register (PFS).
A5H must be written to PFCMD each time the value of FLPMC is changed.
PFCMD can be set with an 8-bit memory manipulation instruction.
Reset signal generation makes PFCMD undefined.