Datasheet

RL78/L12 CHAPTER 26 FLASH MEMORY
R01UH0330EJ0200 Rev.2.00 826
Dec 13, 2013
26.8.3 Procedure for accessing data flash memory
The data flash memory is stopped after a reset ends. To access the data flash, make initial settings according to the
following procedure.
<1> Set bit 0 (DFLEN) of the data flash control register (DFLCTL) to 1.
<2> Wait for the setup to finish for software timer, etc.
The time setup takes differs for each flash operation mode for the main clock.
<Setup time for each flash operation mode>
HS (High speed main): 5
μ
s
LS (Low speed main): 720 ns
LV (Low voltage main): 10
μ
s
<3> After the wait, the data flash memory can be accessed.
Cautions 1. Accessing the data flash memory is not possible during the setup time.
2. Transition to the STOP mode is not possible during the setup time. To enter the STOP mode
during the setup time, clear DFLEN to 0 and then execute the STOP instruction.
3. The high-speed on-chip oscillator should be kept operating during data flash rewrite. If it is
kept stopping, the high-speed on-chip oscillator clock should be operated (HIOSTOP = 0). The
flash data library should be executed after 30
μ
s have elapsed.
After initial setting, the data flash can be read through CPU instructions and can be read or rewritten to by using the
data flash library.
Follow one of the procedures below when the DMA controller operates during access to the data flash memory.
(A) Hold DMA transfer pending or forcibly terminate it
Before reading the data flash memory, hold the DMA transfer pending in all the channels which are in use. The
data flash memory should be read 3 clocks (f
CLK) or more after the DWAITn bit is set to 1. After reading the data
flash memory, set the DWAITn bit to 0 and then cancel the pending status.
Or, before reading the data flash memory, forcibly terminate the DMA transfer in accordance with the process
described in 16.5.5 Forced termination by software. Resume the DMA transfer after reading the data flash
memory.
(B) Access the data flash memory by using the library
Access the data flash memory by using the latest data flash library.
(C) Insert the NOP instruction
Insert the NOP instruction immediately before the data flash read instruction.
<Example>
MOVW HL, !addr16 ; Read RAM
NOP ; Insert the NOP instruction before reading the data flash memory
MOV A,[DE] ; Read the data flash memory
If high-level language like C language is used, the compiler may generate two instructions per code. At that time,
the NOP instruction is not inserted immediately before the data flash read instruction. Read the data flash memory
by following procedure (A) or (B).
Remarks 1. n: DMA channel number (n = 0, 1)
2. f
CLK: CPU/peripheral hardware clock frequency
<R>