R8C/38T-A Group
26. Flash Memory
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0241EJ0010 Rev.0.10
Page 645 of 730
Aug 05, 2011
26.5.6
Data Protect Function
Each block in the flash memory has a nonvolatile lock bit. The lock bit is enabled by setting the FMR13 bit in
the FMR1 register to 0 (lock bit enabled). The lock bit can be used to disable (lock) programming or erasing
each block. This prevents data from being written or erased inadvertently. The block status changes according
to the lock bit as follows:
When the lock bit data is set to 0: locked (the block cannot be programmed or erased)
When the lock bit data is set to 1: not locked (the block can be programmed and erased)
The lock bit data is set to 0 (locked) by executing the lock bit program command and to 1 (not locked) by
erasing the block. There are no commands that can be used to set only the lock bit data to 1.
The lock bit data can be read using the read lock bit status command.
When the FMR13 bit is set to 1 (lock bit disabled), the lock bit function is disabled and no blocks are locked
(each lock bit data remains unchanged). The lock bit function is enabled by setting the FMR13 bit to 0 (the lock
bit data is retained).
When the block erase command is executed while the FMR13 bit is 1, the target block is erased regardless of
the lock bit status. The lock bit of the erase target block is set to 1 after erasure completes.
The FMR13 bit is set to 0 after auto-erasure completes. This bit is also set to 0 if one of the following conditions
is met. To erase or program a different locked block, set the FMR 13 bit to 1 again and execute the block erase
or program command.
If the FST7 bit in the FST register is changed from 0 (busy) to 1 (ready).
If a command sequence error occurs.
If the FMR01 bit in the FMR0 register is set to 0 (CPU mode disabled).
If the FMSTP bit in the FM0 register is set to 1 (flash memory stops).
If the CMDRST bit in the FMR0 register is set to 1 (erasure/writing stops).
Figure 26.7
FMR13 Bit Operation Timing
Erase start
Erase completion
Operation
FST7 bit
(Ready/busy status flag)
0 is set at the rising edge of
the FST7 bit
FMR13 bit
(Lock bit disable select bit)
Set to 1 by a program
Lock bit enabled
Erase
FST7: Bit in FST register
FMR13: Bit in FMR1 register