![](http://datasheet.mmic.net.cn/110000/M32186F8VFP_datasheet_3496152/M32186F8VFP_167.png)
6
INTERNAL MEMORY
6-25
32185/32186 Group Hardware Manual
Rev.1.10 REJ09B0235-0110 May 15, 07
6.6 Programming Internal Flash Memory
6.6.1 Outline of Internal Flash Memory Programming
To program or erase the internal flash memory, there are following two methods to choose depending on
the situation:
(1) When the flash write/erase program does not exist in the internal flash memory
(2) When the flash write/erase program already exists in the internal flash memory
For (1), set the FP pin = "H," MOD0 = "H" and MOD1 = "L" to enter boot mode. In this case, the CPU starts
running the boot program upon exiting the reset state.
The boot program transfers the flash write/erase program into the internal RAM. After the transfer, jump to
a location in the internal RAM and use the internal RAM-resident program to set the Flash Control Register
1 (FCNT1) FENTRY bit to "1" to make the internal flash memory ready for programming/erase operation
(i.e., placed in boot mode + flash E/W enable mode).
When the above is done, use the flash write/erase program that has been transferred into the internal RAM
to program or erase the internal flash memory.
For (2), set the FP pin = "H," MOD0 = "L" and MOD1 = "L" to enter single-chip mode. Transfer the flash
write/erase program from the internal flash memory in which it has been prepared into the internal RAM.
After the transfer, jump to the internal RAM and use the program transferred into the internal RAM to set
the Flash Control Register 1 (FCNT1) FENTRY bit to "1" to make the internal flash memory ready for
programming/erase operation (i.e., placed in single-chip mode + flash E/W enable mode).
When the above is done, use the flash write/erase program that has been transferred into the internal RAM
to program or erase the internal flash memory. Or flash E/W enable mode can be entered from external
extension mode by setting the FP pin = "H," MOD0 = "L" and MOD1 = "H."
During flash E/W enable mode (FP pin = "H," FENTRY = "1"), the EIT vector entry for External Interrupt (EI)
is relocated to the start address (H’0080 4000) of the internal RAM. During normal mode (except for Flash
E/W enable mode), it is located in the flash area (H’0000 0080).
To use an external interrupt (EI) in flash E/W enable mode, write at the beginning of the internal RAM an
instruction for branching to the external interrupt (EI) handler that has been transferred into the internal
RAM. Furthermore, because the IVECT register which is read out in the external interrupt (EI) handler has
stored in it the flash memory address of the ICU vector table, make sure the ICU vector table to be used
during flash E/W enable mode is prepared in the internal RAM so that the value of the IVECT register will
be converted into the internal RAM address of the ICU vector table (for example, by adding an offset)
before performing branch processing.
When started by boot mode, internal RAM value is indefinite after started by boot mode in order to "Flash
writing/ Erase program" is transferd to internal RAM.