
Section 19 Flash Memory (0.18-
m F-ZTAT Version)
Rev. 1.00 Mar. 02, 2006 Page 623 of 798
REJ09B0255-0100
R0L is a return value of the FPFR parameter.
Since the stack area is used in the initialization program, a 128-byte stack area at the
maximum must be allocated in RAM.
Interrupts can be accepted during the execution of the initialization program. Note however
that the program storage area and stack area in the on-chip RAM, and register values must
not be rewritten.
(h) The return value in the initialization program, FPFR (general register R0L) is determined.
(i) All interrupts and the use of a bus master other than the CPU are prohibited.
The stipulated voltage is applied for the stipulated time when programming or erasing. If
interrupts occur or a bus master other than the CPU gets the bus during this period, a voltage
pulse exceeding the regulation may be applied, thus damaging flash memory. Accordingly,
interrupts must be disabled and a bus master other than the CPU must not be allowed.
To disable interrupts, bit 7 (I) in the condition code register (CCR) of the CPU should be set to
B'1 in interrupt control mode 0, or bits 7 and 6 (I and UI) in the condition code register (CCR)
of the CPU should be set to B'11 in interrupt control mode 1. This enables interrupts other than
NMI to be held and not executed.
The NMI interrupt must be masked within the user system.
The interrupts that are held must be executed after all programming processings.
When a bus master other than the CPU acquires the bus, the error-protection state is entered.
Therefore, the acquisition of a bus by a bus master other than the CPU should be prohibited in
addition to interrupts.
(j) Set H'5A in FKEY and prepare the user MAT for programming.
(k) Set the parameters required for programming.
The start address of the programming destination of the user MAT (FMPAR) is set to general
register ER1, and the start address of the program data area (FMPDR) is set to general register
ER0.
Example of FMPAR setting
FMPAR specifies the programming destination address. When an address other than one in
the user MAT area is specified, even if the programming program is executed,
programming is not executed and an error is returned to the return value parameter FPFR.
Since the programming unit is 128 bytes, the lower eight bits of the address must be at the
128-byte boundary of H'00 or H'80.
Example of FMPDR setting
When the storage destination of the program data is flash memory, even if the
programming execution routine is executed, programming is not executed and an error is
returned to the FPFR parameter. In this case, the program data must be transferred to the
on-chip RAM before programming is executed.