Advertisement

Quick Links

RL78/G11
UART Reception in STOP Mode Using
Middle-speed On-chip Oscillator IAR
Introduction
This application note explains how to receive data in UART communication during STOP mode using the RL78/G11
middle-speed on-chip oscillator. STOP mode is released when the INTP (external interrupt) pin detects the start bit.
Operations return from STOP mode and UART data is received simultaneously.
The middle-speed on-chip oscillator does not provide frequency accurate enough for UART communications and
baud rate corrections are necessary. A detailed description on how to correct the baud rate is provided in the following
document: "RL78/G11 UART communication with middle speed on chip oscillator IAR (R01AN3621EJ)."
Target Device
RL78/G11
When applying this application note to other microcomputers, please change it according to the corresponding
specification and evaluate thoroughly before using.
R01AN3634EJ0100 Rev.1.00
Feb. 15, 2017
APPLICATION NOTE
R01AN3634EJ0100
Rev.1.00
Feb. 15, 2017
Page 1 of 85

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RL78 and is the answer not in the manual?

Questions and answers

Summary of Contents for Renesas RL78

  • Page 1 Middle-speed On-chip Oscillator IAR Introduction This application note explains how to receive data in UART communication during STOP mode using the RL78/G11 middle-speed on-chip oscillator. STOP mode is released when the INTP (external interrupt) pin detects the start bit. Operations return from STOP mode and UART data is received simultaneously.
  • Page 2: Table Of Contents

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Contents Specification ............................3 Conditions for Confirming Operations ....................4 Related Application Notes ......................... 4 Hardware Explanation ........................5 Hardware Structure Example ......................5 Pin List ............................6 Software Explanation ........................7 Operation Outline ..........................
  • Page 3: Specification

    UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Specification The RL78/G11 middle-speed on-chip oscillator can be used to receive data in UART communications during STOP mode. When the INTP (external interrupt) pin detects the start bit during STOP mode, STOP mode is released.
  • Page 4: Conditions For Confirming Operations

    Applications notes related to this document are shown below.  RL78/G13 Initialization CC-RL (R01AN2575EJ)  RL78/G11 Serial Array Unit (UART Communication) IAR (R01AN3646EJ)  RL78/G11 UART communication with middle speed on chip oscillator IAR (R01AN3621EJ) R01AN3634EJ0100 Rev.1.00 Page 4 of 85...
  • Page 5: Hardware Explanation

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Hardware Explanation Hardware Structure Example Figure 4.1shows the hardware used in this application note. RESET LED1 RL78/G11 LED2 REGC External P55/RxD0/INTP11 target device P30/TO01 P00/TI03 P40/TOOL0 For on-chip debugging Figure 4.1 Hardware Configuration...
  • Page 6: Pin List

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Pin List Table 4.1 provides a list of the pins used in application note and their functions. Table 4.1 List of Pins and Functions Pin Name Input/Output Function Output...
  • Page 7: Software Explanation

    The middle-speed on-chip oscillator does not provide frequency accurate enough for UART communications and baud rate corrections are necessary. A detailed description on how to correct the baud rate is provided in the following document: “RL78/G11 UART communication with middle speed on chip oscillator IAR (R01AN3621EJ).”...
  • Page 8 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU initialization <Channel 1 setting conditions>  Operating clock: middle-speed on-chip oscillator (MOCO) 4MHz  Use 16-bit timers  Software trigger start  MOCO valid edge: falling edge ...
  • Page 9 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR main processing initialization <Setting conditions>  UART0 reception status initialization  Set variable g_status to “0” (OK).  Set variable g_uart0_rx_count to “0” (receive count value = 0).  Set variable g_uart0_rx_length to “1” (receive data number = 1).
  • Page 10 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR  Stop TAU0 channel 1 after HALT mode release  Set TT0 register TT01 bit “1” (operation stop (stop trigger generated)).  Set TOE0 register TOE01 bit to “0” (timer output disabled).
  • Page 11 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR When reception data is abnormal  Framing error: set P31 to Low output/High output, LED1 blinks.  Parity error: set P33 to Low output/High output, LED2 blinks.  Overrun error: set P31 and P33 to Low output/High output, LED1/LED2 both blink.
  • Page 12 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Figure 5.1 Timing Chart R01AN3634EJ0100 Rev.1.00 Page 12 of 85 Feb. 15, 2017...
  • Page 13: Correction Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Correction Processing The following provides a detailed explanation of correction processing. Generating waveforms for measurement As shown in Figure 5.2, the middle-speed on-chip oscillator (MOCO) frequency is divided by N to generate a waveform for measurement.
  • Page 14 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Table 5.2 Measurement Results of MOCO Waveform Divided by N MOCO (4 MHz±12%) min: 3.52 MHz Typ: 4.00 MHz Max: 4.42 MHz HOCO Max: 24.24 MHz (24.24 / 3.52) N = (24.24 / 4.00) N =...
  • Page 15 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Baud rate correction In this application, UART is MOCO driven, with the frequency set to: f = 4MHz or f = CK00 = f / 2 = 2MHz. The target baud rate is 9600bps; the values for the upper 7 bits of the SDR register (SDR[15:9]) are calculated by the following expressions.
  • Page 16: Uart How To Receive Uart Data In Stop Mode

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART How to Receive UART Data in STOP Mode Generally, when MOCO (middle-speed on-chip oscillator) is selected as the system clock, the UART receive operation is disabled if the program is stopped due to SNOOZE mode.
  • Page 17: Constants

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Constants Table 5.4 lists the constants used in the sample program. Table 5.4 Constants Constant Name Setting Description WAIT_MAX 240000 MAX wait value for LED blinking Global Variables Table 5.5 lists the global variables used in the sample program.
  • Page 18: Functions

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Functions Table 5.6 shows the list of functions used in the sample code. Table 5.6 Functions Function Name Outline hdwinit Initialization function R_Systeminit Peripheral function initialization function R_PORT_Create Port initialization function...
  • Page 19: Function Specifications

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function Specifications The following shows function specifications for the sample code. Function name: hdwinit Outline Initialization function Header intrinsics.h Declaration void hdwinit(void) Description Initial setup of peripheral functions. Argument...
  • Page 20 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function name: R_SAU0_Create Outline SAU0 initialization function Header r_cg_sau.h,intrinsics.h Declaration void R_ SAU0_Create(void) Description Initial setup of SAU0. Argument None Return value None Additional notes None Function name: R_UART0_Create...
  • Page 21 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function name: R_UART0_Receive Outline UART0 reception status initialization function Header r_cg_sau.h Declaration MD_STATUS R_UART0_Receive(uint8_t * const rx_buf, uint16_t rx_num) Description Initial setup of UART0 reception status Argument uint8_t* const rx_buf...
  • Page 22 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function name: R_TAU0_Channel3_Start Outline TAU0 channel 3 operation start function Header r_cg_tau.h Declaration void R_TAU0_Channel3_Start (void) Description Sets TAU0 channel 3 to operation enabled state. Argument None Return value...
  • Page 23 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function name: r_tau0_channel3_interrupt Outline TAU0 channel 3 count complete interrupt function Header r_cg_tau.h Declaration __interrupt void r_tau0_channel3_interrupt(void) Description Stores result of pulse width measured by TAU0 channel 3 in global variable.
  • Page 24 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Function name: r_uart0_interrupt_error Outline UART0 error interrupt function Header r_cg_sau.h Declaration __interrupt void r_uart0_interrupt_error(void) Description Stores reception data in RAM, responds based on error detected in r_uart0_callback_error function. Argument...
  • Page 25: Flowcharts

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Flowcharts Figure5.1 shows the entire flow of the sample code. Figure 5.1 Entire Flow R01AN3634EJ0100 Rev.1.00 Page 25 of 85 Feb. 15, 2017...
  • Page 26: Main Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.1 Main processing Figure5.2 shows the flowchart for main processing (1/2). main Initialization setting function hdwinit() main initialization R_MAIN_UserInit() Shift to STOP mode Return to normal mode in INTP11 interrupt...
  • Page 27 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Figure5.3 shows the flowchart for main processing (2/2). Figure 5.3 Main Processing (2/2) R01AN3634EJ0100 Rev.1.00 Page 27 of 85 Feb. 15, 2017...
  • Page 28: Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.2 Initialization Figure5.4Figure 5. shows the flowchart of the initialization process. hdwinit Disable maskable interrupts IE ← 0 Peripheral function initialization Port initialization CPU clock initialization R_Systeminit() TAU0 initialization...
  • Page 29: Port Initialization

    Figure5.6 shows the flowchart for port initialization. Figure 5.6 Port Initialization Note Refer to the initialization flowchart in the RL78/G13 Initialization (R01AN2575EJ) Application Note for details on how to set unused ports. Note When designing circuits, always make sure unused ports are properly processed and all electrical characteristics are met.
  • Page 30: Tau0 Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.5 TAU0 initialization Figure5.8 shows the flowchart for TAU0 initialization (1/2). Figure 5.8 TAU0 Initialization (1/2) R01AN3634EJ0100 Rev.1.00 Page 30 of 85 Feb. 15, 2017...
  • Page 31 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Figure5.9 shows the flowchart for TAU0 initialization (2/2). Figure 5.9 TAU0 Initialization (2/2) R01AN3634EJ0100 Rev.1.00 Page 31 of 85 Feb. 15, 2017...
  • Page 32 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Reset Release ・Peripheral reset control register 0 (PRR0) Release TAU from the reset state. Symbol: PRR0 IICA1RES ADCRES IICA0RES SAU0RES TAU0RES Bit 0 TAU0RES Reset control of timer array unit 0 Reset control of timer array unit 0 Reset state of timer array unit 0.
  • Page 33 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Operation Clock Selection ・Timer clock selection register 0 (TPS0) Set CK00 / CK01 = f Symbol: TPS0 Bit 7- 0 (n = 0, 1) Operation Clock (CK01/CK00) Selection...
  • Page 34 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 All Channel Operation Stop ・Timer channel stop register 0 (TT0) Set all TAU0 channels to operation stop state. Symbol: TT0 Bit 11 Trigger to stop operations of higher 8-bit timer when channel 3 is in 8-bit timer mode No trigger operation TEHm3 bit is cleared to 0 and the count operation is stopped.
  • Page 35 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 All Interrupts Disable ・Interrupt request flag register (MK0H/MK1L) Disable all TAU0 interrupts. ・Interrupt request flag register (IF0H/IF1L) Clear TAU interrupt request flags. Symbol: MK0H STMK1 SRMK0 STMK0 CSIMK10...
  • Page 36 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Interrupt Priority Level Setting ・Priority level flag registers (PR11L, PR01L) Set channels 1 and 3 to level 2. Symbol: PR11L SRPR11 TMPR103 TMPR102 TMPR101 TMPR103H TMPR101H IICAPR10 SREPR11...
  • Page 37 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Initialization ・Timer mode register 01 (TMR01) Set TAU0 channel 1 as follows: ・Operation clock: CK00(24MHz) ・Operate as 16-bit timer ・Software trigger start ・TI01 pin valid edge: falling ・Interval timer mode...
  • Page 38 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Bit 7 – 6 Selection of Tlmn pin input valid edge Falling edge Rising edge Both edges (when low-level width is measured) Both edges (when high-level width is measured) Bit 3 –...
  • Page 39 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Compare Value Setting ・Timer data register 01 (TDR01) Set TAU0 channel 1 compare value to 1295H. Symbol: TDR01 TAU0 Channel 1 Output Mode Setting ・Timer output mode register 0 (TOM0) Set the master channel mode output mode.
  • Page 40 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Timer Output Setting ・Timer output register 0 (TO0) Set timer output value to 0. Symbol: TO0 Bit 1 Timer output of channel n Timer output value is 0.
  • Page 41 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 3 Initialization ・Timer mode register 03 (TMR03) Set TAU0 channel 3 as follows: ・Operation clock: CK00(24MHz) ・Single channel operations ・TI03 pin valid edge used as start trigger and capture trigger ・TI03 pin valid edge: rising...
  • Page 42 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Bit 7 – 6 Selection of Tlmn pin input valid edge Falling edge Rising edge Both edges (when low-level width is measured) Both edges (when high-level width is measured) Bit 3 –...
  • Page 43 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 3 Output Mode Setting ・Timer output mode register 0 (TOM0) Set master channel mode output mode. Symbol: TOM0 Bit 3 Control of channel n timer output mode...
  • Page 44 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 3 Timer Output Setting ・Timer output register 0 (TO0) Set timer output value to 0. Symbol: TO0 Bit 3 Timer output of channel n Timer output value is 0.
  • Page 45 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 TI03 Pin Noise Filter Disable ・Noise filter enable register 1 (NFEN1) Set noise filter to OFF. Symbol: NFEN1 TNFEN03 TNFEN02 TNFEN01 TNFEN00 Bit 3 TNFEN03 Enable/disable use of noise filter for TI03 pin input signal...
  • Page 46 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Symbol: PMC3 PMC33 PMC32 PMC31 PMC30 Bit 0 PMC30 Selection of Pmn pin digital input/output or analog input (m = 0-3; n = 0-7) Digital input/output (alternate function other than analog input)
  • Page 47: Sau0 Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.6 SAU0 initialization Figure5.10 shows the flowchart for SAU0 initialization. R_SAU0_Create PRR0 register SAU0 reset release SAU0RES bit ← 1 : SAU0 is in reset state SAU0RES bit ← 0...
  • Page 48 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR SAU0 Reset Release ・Peripheral reset control register 0 (PRR0) Release SAU0 from reset state. Symbol: PRR0 IICA1RES ADCRES IICA0RES SAU0RES TAU0RES Bit 2 SAU0RES Control of serial array unit reset release...
  • Page 49 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR SAU0 Operation Clock Selection ・Serial clock selection register 0 (TPS0) Set to 12MHz. Symbol: SPS0 - - - - - - - - Bit 3 - 0 Operation Clock (CK00) Selection...
  • Page 50: Uart0 Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.7 UART0 initialization Figure5.11 shows the flowchart for UART0 initialization. Figure 5.11 UART0 Initialization R01AN3634EJ0100 Rev.1.00 Page 50 of 85 Feb. 15, 2017...
  • Page 51 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Communication Operation Stop ・Serial channel stop register 0 (ST0) Set UART0 to communication operation stop. Symbol: ST0 Bit 1 Trigger to start operations of channel n No trigger operation SEmn bit is cleared to 0 and the communication operation is stopped.
  • Page 52 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Transmission Completion Interrupt/Reception Error Interrupt ・Interrupt request flag register (MK0H) Disable UART0 transmission completion interrupt/reception error interrupt. ・Interrupt request flag register (IF0H) Clear UART0 transmission completion interrupt/reception error interrupt flag.
  • Page 53 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Interrupt Priority Level Settings ・Priority level flag registers (PR10L, PR00L) Set reception/reception error interrupt to level 3 (lowest priority level). Symbol: PR00H STPR01 SRPR00 STPR00 CSIPR010 TMPR000 SREPR00...
  • Page 54 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Channel 1 Error Flag Setting ・Serial flag clear trigger register 01 (SIR01) Clear all error flags. Symbol: SIR01 FECT PECT OVCT - - - - - - -...
  • Page 55 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Channel 1 Initialization ・Serial mode register 01 (SMR01) Set UART0 channel 1 as follows: ・Operation clock: CK00 ・Transfer clock: CK00 divided clock (divided-by-2) ・RxD0 pin valid edge ・Start bit detection: falling edge ・UART mode...
  • Page 56 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Channel 1 Serial Communication Operation Settings ・Serial communication operation setting register 01 (SCR01) Set UART0 channel 1 as follows: ・Operation mode: reception only ・Clock phase: type 1 ・Data transmission order: LSB first ・Data length: 8-bit data...
  • Page 57 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Bit 7 DIR01 Setting of data transfer order in CSI and UART modes Inputs/outputs data with MSB first. Inputs/outputs data with LSB first. Bit 5 - 4 SLC011 SLC010...
  • Page 58 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Channel 1 Baud Rate Setting ・ Serial data register 01 (SDR01) Set transfer clock to 9600bps. (9600bps = f ÷ 208 = 2MHz ÷ 208) Symbol: SDR01 Bit 15-9...
  • Page 59: Intp Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.8 INTP initialization Figure5.12 shows the INTP initialization flowchart. R_INTC_Create MK0L register PMK5 – PMK0 bit ← 111111B :Interrupt processing disabled Disable all INTP interrupts MK1H register PMK11 – PMK9 bit ← 111B...
  • Page 60 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR All Interrupts Disable INTP ・Interrupt request flag register (MK0L/MK1H) Disable all INTP interrupts. ・Interrupt request flag register (IF0L/IF1H) Clear all INTP interrupt request flags. Symbol: MK0L PMK5 PMK4 PMK3...
  • Page 61 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR INTP Interrupt Priority Level 3 (lowest priority level) ・Priority level flag registers (PR11H, PR01H) Set interrupt to level 3 (lowest priority level) Symbol: PR11H PPR111 PPR110 PPR19 PPR18 PPR17...
  • Page 62 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR PM55 Input Mode Setting ・Port mode register (PM5) Set P55 to input mode. Symbol: PM5 PM56 PM55 PM54 PM53 PM52 PM51 Bit 5 PM55 I/O mode selection for Pmn pin...
  • Page 63: Main Initialization

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.9 Main initialization Figure5.13 shows the flowchart for main initialization. Figure 5.13 Main Initialization 5.9.10 UART0 reception status initialization Figure5.14 shows the flowchart for UART0 reception status initialization. R_UART0_Receive status ←...
  • Page 64: Uart0 Operation Start Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.11 UART0 operation start function Figure5.15 shows the flowchart for the UART0 operation start function. R_UART0_Start SS0 register Enable UART0 operation SS01 bit ← 1 : Shift to communication wait state...
  • Page 65 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR UART0 Reception Complete/Reception Error Interrupt Enable ・Interrupt request flag register (MK0H) Enable UART0 interrupts. ・Interrupt request flag register (IF0H) Clear all UART0 interrupt request flags. Symbol: IF0H ST1IF SRIF0...
  • Page 66: Tau0 Baud Rate Setting

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.12 TAU0 baud rate setting Figure5.16 shows the flowchart for TAU0 baud rate setting (1/2). Figure 5.16 TAU0 Baud Rate Setting (1/2) R01AN3634EJ0100 Rev.1.00 Page 66 of 85 Feb. 15, 2017...
  • Page 67 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Figure5.17 shows the flowchart for TAU0 baud rate setting (2/2). Figure 5.17 TAU0 Baud Rate Setting (2/2) R01AN3634EJ0100 Rev.1.00 Page 67 of 85 Feb. 15, 2017...
  • Page 68 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR CPU Clock Change Setting ・System clock control register (CKC) Change setting from high-speed to middle-speed on-chip oscillator clock. Symbol: CKC MCM0 MCS1 MCM1 Bit 0 MCM1 Operation control of main on-chip oscillator clock (f...
  • Page 69 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Count Clock Setting ・Timer mode register 01 (TMR01) Set to valid edge of input signal. Symbol: TMR01 SPLIT Bit 12 CCS01 Selection of count clock (f...
  • Page 70: Intp11 Operation Start Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.13 INTP11 operation start function Figure5.18 shows the flowchart for INTP11 operation start function. Figure 5.18 INTP11 Operation Start Function INTP11 Interrupt Enable ・Interrupt request flag register (IF1H) Clear interrupt request flag.
  • Page 71: Tau0 Channel 3 Operation Start Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.14 TAU0 channel 3 operation start function Figure5.19 shows the flowchart for TAU0 channel 3 operation start function. Figure 5.19 TAU0 Channel 3 Operation Start Function TAU0 Channel 3 Interrupt Enable ・Interrupt request flag register (IF1L)
  • Page 72 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 3 Count Operation Enable ・Timer channel start register 0 (TS0) Set to count enabled state. Symbol: TS0 TS03 TS02 TS01 TS00 Bit 3 TS03 Operation enable (start) trigger for channel n No trigger operation TEmn bit is set to 1, goes to count operation enabled state.
  • Page 73: Tau0 Channel 1 Operation Start Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.15 TAU0 channel 1 operation start function Figure5.20 shows the flowchart for the TAU0 channel 1 operation start function. Figure 5.20 TAU0 Channel 1 Operation Start Function TAU0 Channel 1 Interrupt Enable ・Interrupt request flag register (IF1L)
  • Page 74 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Timer Output Enable ・Timer output enable register 0 (TOE0) Set to timer output enabled. Symbol: TOE0 TOE0 TOE0 TOE0 TOE0 Bit 1 TOE0 Timer output enable/disable of channel n...
  • Page 75: Tau0 Channel 1 Operation Stop Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.16 TAU0 channel 1 operation stop function Figure5.21 shows the flowchart for the TAU0 channel 1 operation stop function. R_TAU0_Channel1_Stop TT0 register Stop TAU0 channel 1 operation TT01 bit ← 1...
  • Page 76 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 1 Timer Output Disable ・Time output enable register 0 (TOE0) Set timer output to disabled. Symbol: TOE0 TOE0 TOE0 TOE0 TOE0 Bit 1 TOE0 Timer output enable/disable of channel n...
  • Page 77: Tau0 Channel 3 Operation Stop Function

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.17 TAU0 channel 3 operation stop function Figure5.22 shows the flowchart for TAU0 channel 3 operation stop function. Figure 5.22 TAU0 Channel 3 Operation Stop Function TAU0 Channel 3 Operation Disable ・Timer channel stop register 0 (TT0)
  • Page 78 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR TAU0 Channel 3 Interrupt Disable ・Interrupt request flag register (MK1L) Set to interrupt disabled. ・Interrupt request flag register (IF1L) Clear interrupt request flag. Symbol: MK1L SRMK1 TMMK03 TMMK02 TMMK01...
  • Page 79: Wait Function For Led Blinking

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.18 Wait function for LED blinking Figure5.24 shows the flowchart for the wait function for LED blinking. r_processing_pause Initialize LED wait count to 0 g_wait_count ← 0 LED wait count update...
  • Page 80: Intp11 Interrupt Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.20 INTP11 interrupt processing Figure5.26 shows the flowchart for INTP11 interrupt processing. Figure 5.26 INTP11 Interrupt Processing INTP11 Interrupt Disable ・Interrupt request flag register (MK1H) Set INTP interrupt to disabled.
  • Page 81: Uart0 Reception Complete Interrupt Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.21 UART0 reception complete interrupt processing Figure5.27 shows the flowchart for UART0 reception complete interrupt processing. r_uart0_interrupt_receive rx_data ← RXD0 Read reception data and set to variable Within specified number of data? UART0 reception data number overrun *gp_uart0_rx_address ←...
  • Page 82: Uart0 Reception Complete Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.23 UART0 reception complete processing Figure5.29 shows the flowchart for UART0 reception complete processing. r_uart0_callback_receiveend Clear UART0 reception error flag g_uart0rxerr ← 0 Uart0 reception complete g_uart0rxend ← 1...
  • Page 83: Uart0 Reception Error Processing

    RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR 5.9.25 UART0 reception error processing Figure5.31 shows the flowchart for UART0 reception error processing. Figure 5.31 UART0 Reception Error Processing R01AN3634EJ0100 Rev.1.00 Page 83 of 85 Feb. 15, 2017...
  • Page 84: Sample Code

    Download the sample code from the Renesas Electronics homepage. Reference Documents RL78/G11 User's Manual: Hardware (R01UH0637E) RL78 family User's Manual: Software (R01US0015E) (Please make sure you obtain the latest version from the Renesas Electronics homepage.) Technical Updates Obtain the latest information from the Renesas Electronics homepage. R01AN3634EJ0100 Rev.1.00 Page 84 of 85 Feb.
  • Page 85 RL78/G11 UART Reception in STOP Mode Using Middle-speed On-chip Oscillator IAR Website and Support Renesas Electronics Website http://www.renesas.com/ Inquiries http://www.renesas.com/contact/ All trademarks and registered trademarks are the property of their respective owners. R01AN3634EJ0100 Rev.1.00 Page 85 of 85 Feb. 15, 2017...
  • Page 86 Revision History Description Rev. Date Page Summary 1.00 Feb. 15, 2017 First edition issued...
  • Page 87 General Precautions in the Handling of Microprocessing Unit and Microcontroller Unit Products The following usage notes are applicable to all Microprocessing unit and Microcontroller unit products from Renesas. For detailed usage notes on the products covered by this document, refer to the relevant sections of the document as well as any technical updates that have been issued for the products.
  • Page 88 10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products.

This manual is also suitable for:

G11

Table of Contents