Renesas RL78 Series User Manual page 807

16-bit single-chip microcontrollers
Hide thumbs Also See for RL78 Series:
Table of Contents

Advertisement

RL78/G1D
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):
● LS (Low speed main):
● LV (Low voltage main):
<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 initialized, the data flash memory can be read by using a CPU instruction or can be read/written by using a data
flash library.
If the DMA controller operates when the data flash memory is accessed, however, follow one of these procedures:
(A) Suspending/forcibly terminating DMA transfer
Before reading the data flash memory, suspend DMA transfer of all the channels used.
After setting the DWAITn bit to 1, however, wait at least for the duration of three clocks (f
flash memory. After reading the data flash memory, lift the suspension of transfer by clearing the DWAITn bit to 0.
Or, forcibly terminate DMA transfer in accordance with the procedure in 15.5.5 Forced termination by software
before reading the data flash memory. Resume DMA transfer after the data flash memory has been read.
(B) Access the data flash memory
Access the data flash memory by using the newest data flash library.
(C) Insertion of NOP
Insert an NOP instruction immediately before the instruction that reads the data flash memory.
<Example>
MOVW
HL,!addr16
NOP
MOV
A,[DE]
If a high-level language such as C is used, however, the compiler may generate two instructions for one code. In this
case, the NOP instruction is not inserted immediately before the data flash memory read instruction. Therefore, read the
data flash memory by (A) or (B) above.
Remarks 1. n: DMA channel number (n = 0, 1)
2. f
: CPU/peripheral hardware clock frequency
CLK
R01UH0515EJ0120 Rev.1.20
Dec 16, 2016
5 µs
720 ns
10 µs
; Reads RAM.
; Insert NOP instruction before reading data flash memory.
; Read data flash memory.
CHAPTER 26 FLASH MEMORY
) before reading the data
CLK
786

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rl78/g1dR5f11aggR5f11aghR5f11agj

Table of Contents