English
Language : 

SH7052 Datasheet, PDF (785/919 Pages) Renesas Technology Corp – SuperHTM RISC engine
21.7 Programming/Erasing Flash Memory
A software method, using the CPU, is employed to program and erase flash memory in the on-
board programming modes. There are four flash memory operating modes: program mode, erase
mode, program-verify mode, and erase-verify mode. Transitions to these modes are made by
setting the PSU1, ESU1, P1, E1, PV1, and EV1 bits in FLMCR1.
The flash memory cannot be read while it is being written or erased. Install the program to control
flash memory programming and erasing (programming control program) in the on-chip RAM, in
external memory, or in flash memory outside the address area, and execute the program from
there.
Notes: 1. Operation is not guaranteed if bits SWE1, ESU1, PSU1, EV1, PV1, E1, and P1 of
FLMCR1 are set/reset by a program in flash memory in the corresponding address
areas.
2. When programming or erasing, set FWE to 1 (programming/erasing will not be
executed if FWE = 0).
3. Programming should be performed in the erased state. Do not perform additional
programming on previously programmed addresses.
21.7.1 Program Mode
When writing data or programs to flash memory, the program/program-verify flowchart shown in
figures 21.13 and 21.14 should be followed. 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
128 bytes at a time.
Following the elapse of 10 µs or more after the SWE1 bit is set to 1 in flash memory control
register 1 (FLMCR1), 128-byte program data is stored in the program data area and reprogram
data area, and the 128-byte data in the program data area in RAM is written consecutively to the
program address (the lower 8 bits of the first address written to must be H'00 or H'80). 128
consecutive byte data transfers are performed. The program address and program data are latched
in the flash memory. A 128-byte data transfer must be performed even if writing fewer than 128
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 6.6 ms as the WDT overflow period. After this, preparation for program mode (program setup)
is carried out by setting the PSU1 bit in FLMCR1, and after the elapse of tSPSU, the operating mode
is switched to program mode by setting the P1 bit in FLMCR1. The time during which the P1 bit
is set is the flash memory programming time. Follow the table in the programming flowchart for
the write time.
759