Rev.1.02 Jul 01, 2005 page 250 of 314
REJ09B0126-0102
M16C/6N Group (M16C/6NL, M16C/6NN) 20. Flash Memory Version
Under development
This document is under development and its contents are subject to change.
20.3.5.6 Erase All Unlocked Block
The erase all unlocked block command erases all blocks except the block A.
By writing “xxA7h” in the first bus cycle and “xxD0h” in the second bus cycle, an auto erase (erase and
verify) operation will run continuously in all blocks except the block A.
The FMR00 bit in the FMR0 register indicates whether an auto erase operation has been completed.
After the completion of an auto erase operation, the FMR07 bit in the FMR0 register indicates whether
or not the auto erase operation has been completed as expected.
The lock bit can protect each block from being programmed inadvertently. (Refer to 20.3.6 Data Protect
Function.)
In EW1 mode, do not execute this command when the lock bit for any block storing the rewrite control
program is set to “1” (unlocked) or when the FMR02 bit in the FMR0 register is set to “1” (lock bit
disabled).
In EW0 mode, the microcomputer enters read status register mode as soon as an auto erase operation
starts. The status register can be read. The SR7 bit in the status register is set to “0” (busy) at the same
time an auto erase operation starts. It is set to “1” (ready) when an auto erase operation is completed.
The microcomputer remains in read status register mode until the read array command or read lock bit
status command is written.
Only blocks 0 to 12 can be erased by the erase all unlocked block command. The block A cannot be
erased. Use the block erase command to erase the block A.
20.3.5.7 Lock Bit Program Command
The lock bit program command sets the lock bit for a specified block to “0” (locked).
By writing “xx77h” in the first bus cycle and “xxD0h” to the highest-order even address of a block in the
second bus cycle, the lock bit for the specified block is set to “0”. The address value specified in the first bus
cycle must be the same highest-order even address of a block specified in the second bus cycle.
Figure 20.10 shows a flow chart of the lock bit program command programming. Execute read lock bit
status command to read lock bit state (lock bit data).
The FMR00 bit in the FMR0 register indicates whether a lock bit program operation is completed.
Refer to 20.3.6 Data Protect Function for details on lock bit functions and how to set it to “1” (unlocked).
Start
YES
NO
FMR00=1?
Full status check
Write "xxD0h" to the highest-order
block address
Write command code "xx77h" to
the highest-order block address
Lock bit program operation
is completed
NOTE:
1.Write the command code and data to even addresses.
Figure 20.10 Lock Bit Program Command