
462
Flowchart for Erasing Multiple Blocks
Start
Write 0 data to all addresses to be
erased (prewrite)*1
n = 1
Set erase block registers
(set bits of block to be erased to 1)
Enable watchdog timer*2
Select erase mode (E bit = 1 in FLMCR)
Wait (x)ms*5
Clear E bit
Disable watchdog timer
Select erase-verify mode
(EV bit = 1 in FLMCR)
Wait (tVS1) s*6
Set top address of block as
verify address
Dummy write to verify address*3
(flash memory latches address)
Erase-verify
next block
Verify*4
(read data = H'FF?)
Last address
in block?
Address + 1
→ Address
Clear EBR bit of erased block
All erased blocks
verified?
Clear EV bit
All blocks erased?
(EBR1 = EBR2 = 0?)
End of erase
n
≥ N?*6
Erase error
n + 1
→ n
Double Erase time
(x
× 2→x)
No
Yes
No
Yes
No
Yes
No go
OK
Erasing ends
All erased blocks
verified?
Erase-verify next block
Yes
No
Yes
Wait (tVS2) s*6
n
≥ 4?
No
Notes: *1 Program all addresses to be
erased by following the prewrite
flowchart.
*2 Set the watchdog timer overflow
interval to the value indicated in
table 20.8.
*3 For the erase-verify dummy
write, write H'FF with a byte
transfer instruction.
*4 Read the data to be verified with
a byte transfer instruction. When
erasing two or more blocks,
clear the bits of erased blocks in
the erase block register, so that
only unerased blocks will be
erased again.
*5 The erase time x is successively
incremented by the initial set
value
× 2n–1 (n = 1, 2, 3, 4). An
initial value of 6.25 ms or less
should be set, and the time for
one erasure should be 50 ms or
less.
*6 tVS1: 4 s or more
tVS2: 2 s or more
N:
602
Figure 20.11 Multiple-Block Erase Flowchart