Renesas rl78 User Manual

Page of 1004
 
RL78/G1A 
CHAPTER  25   FLASH  MEMORY 
25.6  Self-Programming 
<R> 
 
The RL78 microcontroller supports a self-programming function that can be used to rewrite the code flash memory via 
a user program.  Because this function allows a user application to rewrite the code flash memory by using the flash self-
programming library, it can be used to upgrade the program in the field. 
 
Cautions  1.  The self-programming function cannot be used when the CPU operates with the subsystem clock. 
 
2.  To prohibit an interrupt during self-programming, in the same way as in the normal operation 
mode, execute the flash self-programming library in the state where the IE flag is cleared (0) by 
the DI instruction.  To enable an interrupt, clear (0) the interrupt mask flag to accept in the state 
where the IE flag is set (1) by the EI instruction, and then execute the flash self-programming 
library. 
 
3.  The high-speed on-chip oscillator should be kept operating during self-programming.  If it is kept 
stopping, the high-speed on-chip oscillator clock should be operated (HIOSTOP = 0).  The flash 
self-programming library should be executed after 30 
μ
s have elapsed. 
 
Remarks 1.  For details of the self-programming function, refer to the RL78 Microcontroller Flash Self Programming 
Library Type01 User’s Manual (R01AN0350).  
 
2.  For details of the time required to execute self-programming, see the notes on use that accompany the 
flash self-programming library tool. 
 
The self-programming function has two flash memory programming modes; wide voltage mode and full speed mode. 
 
Specify the mode that corresponds to the flash operation mode specified in bits CMODE1 and CMODE0 in option byte 
000C2H. 
Specify the full speed mode when the HS (high speed main) mode is specified.  Specify the wide voltage mode when 
the LS (low speed main) mode or LV (low voltage main) mode is specified. 
If the argument fsl_flash_voltage_u08 is 00H when the FSL_Init function of the flash self-programming library provided 
by Renesas Electronics is executed, full speed mode is specified.  If the argument is other than 00H, the wide voltage 
mode is specified. 
 
Remark  Using both the wide voltage mode and full speed mode imposes no restrictions on writing, erasing, or 
verification. 
 
R01UH0305EJ0200  Rev.2.00 
 
 
815  
Jul 04, 2013