English
Language : 

HD64F2357F20V Datasheet, PDF (624/1049 Pages) Renesas Technology Corp – Hardware Manual Renesas 16-Bit Single-chip Microcomputer H8S Family / H8S/2300 Series
19.9 Programming/Erasing Flash Memory
In the on-board programming modes, flash memory programming and erasing is performed by software, using the CPU.
There are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode.
Transitions to these modes can be made by setting the PSU and ESU bits in FLMCR2, and the P, E, PV, and EV bits in
FLMCR1.
The flash memory cannot be read while being programmed or erased. Therefore, the program that controls flash memory
programming/erasing (the programming control program) should be located and executed in on-chip RAM or external
memory.
Notes: 1. Operation is not guaranteed if setting/resetting of the SWE, EV, PV, E, and P bits in FLMCR1, and the ESU
and PSU bits in FLMCR2, is executed by a program in flash memory.
2. When programming or erasing, set FWE to 1 (programming/erasing will not be executed if FWE = 0).
3. Perform programming in the erased state. Do not perform additional programming on previously programmed
addresses.
19.9.1 Program Mode
Follow the procedure shown in the program/program-verify flowchart in figure 19-19 to write data or programs to flash
memory. Performing program operations according to this flowchart will enable data or programs to be written to flash
memory without subjecting the device to voltage stress or sacrificing program data reliability. Programming should be
carried out 32 bytes at a time.
The wait times (x, y, z, α, ß, γ, ε, η) after bits are set or cleared in flash memory control registers 1 and 2 (FLMCR1,
FLMCR2) and the maximum number of programming operations (N) are shown in table 22.42 in section 22.7.6, Flash
Memory Characteristics.
Following the elapse of (x) µs or more after the SWE bit is set to 1 in flash memory control register 1 (FLMCR1), 32-byte
program data is stored in the program data area and reprogram data area, and the 32-byte data in the reprogram data area
written consecutively to the write addresses. The lower 8 bits of the first address written to must be H'00, H'20, H'40,
H'60, H'80, H'A0, H'C0, or H'E0. Thirty-two consecutive byte data transfers are performed. The program address and
program data are latched in the flash memory. A 32-byte data transfer must be performed even if writing fewer than 32
bytes; in this case, H'FF data must be written to the extra addresses.
Next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. Set a value greater than
(y + z + α + ß) µs as the WDT overflow period. After this, preparation for program mode (program setup) is carried out by
setting the PSU bit in FLMCR2, and after the elapse of (y) µs or more, the operating mode is switched to program mode
by setting the P bit in FLMCR1. The time during which the P bit is set is the flash memory programming time. Make a
program setting so that the time for one programming operation is within the range of (z) µs.
19.9.2 Program-Verify Mode
In program-verify mode, the data written in program mode is read to check whether it has been correctly written in the
flash memory.
After the elapse of a given programming time, the programming mode is exited (the P bit in FLMCR1 is cleared to 0, then
the PSU bit in FLMCR2 is cleared to 0 at least (α) µs later). Next, the watchdog timer is cleared after the elapse of (β) µs
or more, and the operating mode is switched to program-verify mode by setting the PV bit in FLMCR1. Before reading in
program-verify mode, a dummy write of H'FF data should be made to the addresses to be read. The dummy write should
be executed after the elapse of (γ) µs or more. When the flash memory is read in this state (verify data is read in 16-bit
units), the data at the latched address is read. Wait at least (ε) µs after the dummy write before performing this read
operation. Next, the originally written data is compared with the verify data, and reprogram data is computed (see figure
Rev.6.00 Oct.28.2004 page 594 of 1016
REJ09B0138-0600H