
Section 18 ROM
Rev. 4.00 Jan 26, 2006 page 634 of 938
REJ09B0276-0400
Start
End of programming
Set SWE bit in FLMCR
Wait (x)
s
Consecutively write 32-byte data in
reprogram data area in RAM to flash memory
Programming operation counter n
← 1
Set PSU bit in FLMCR
Wait (y)
s
Set P bit in FLMCR
Wait (z)
s
Clear P bit in FLMCR
Wait (
α) s
Clear PSU bit in FLMCR
Wait (
β) s
Set PV bit in FLMCR
Wait (
γ) s
Store 32-byte write data in write data area
and reprogram data area
Enable WDT
Start of programming
NG
No
OK
*
6
*
6
*
5
*
4
*
6
*
3
*
6
*
6
*
6
*
1
*
2
*
6
*
6*7
End of programming
*
6
Disable WDT
Set verify start address
Programming end flag
← 0
H'FF dummy write to verify address
Wait (
ε) s
Read verify data
Transfer computation result to reprogram
data area
Increment verify address
Reprogram data computation
Clear PV bit in FLMCR
Wait (
η) s
Clear SWE bit in FLMCR
Programming end
flag
← 1 (unfinished)
Programming OK?
32-byte
data verification completed?
Programming end flag = 0?
Programming failure
Yes
Clear SWE bit in FLMCR
n
> N?
n
← n + 1
Notes: 1. Programming should be performed in the erased state.
(Perform 32-byte programming on memory after all 32 bytes
have been erased.)
2. Data transfer is performed by byte transfer (word transfer is not
possible), with the write start address at a 32-byte boundary.
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. 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.
3. Verify data is read in 16-bit (word) units. (Byte-unit reading is
also possible.)
4. Reprogram data is determined by the computation shown in the
table below (comparison of data stored in the program data
area with verify data). Programming of reprogram data 0 bits is
executed in the next programming loop. Therefore, even bits for
which programming has been completed will be programmed
again if the result of the subsequent verify operation is NG.
5. An area for storing write data (32 bytes) and an area for storing
reprogram data (32 bytes) must be provided in RAM. The
contents of the latter are rewritten in accordance with the
reprogramming data computation.
6. The values of x, y, z,
α, β, γ, ε, η, and N are shown in section
21.2.6, Flash Memory Characteristics.
7. The value of z depends on the number of reprogramming loops
(n). Details are given in section 21.2.6, Flash Memory
Characteristics.
No
Write
Verify
Reprogram
Data
Comments
0
1
Programming completed
0
1
0
Programming incomplete; reprogram
1
0
1
1
Still in erased state; no action
RAM
Program data storage
area (32 bytes)
Reprogram data storage
area (32 bytes)
No
Reprogram
Figure 18.11 Program/Program-Verify Flowchart