The line between a demonstration kit and a development system has gotten pretty hard to define when the former includes a fast, low-power MCU with plenty of memory; enough peripherals to handle just about any type of application; a 1-1/4 inch LCD screen; a full suite of development tools; a built-in debugger; a dozen example programs, with a framework for building your own; a code generation tool; and finally schematics and Gerber files. If something is missing, it is not obvious.
Figure 1: RL78/G13 demonstration board.
The Renesas Demonstration Kit (RDK) for the RL78/G13 MCU (see Figure 1) provides a multifunction platform for evaluating the ultra-low-power Renesas RL78/G13 MCU. Numerous peripherals include a speaker, microphone, infrared emitter, infrared detector, LCD screen, 3-axis accelerometer, temperature sensor, and ambient light sensor, all of which can be exercised by the sample code included with the kit. The RDK includes IAR KickStart tools and an integrated Renesas TK debugger.
The RDK is built around the Renesas 16-bit, 32 MHz RL78/G13 – a general purpose, ultra-low-power CISC MCU intended for a wide range of consumer and industrial applications. The G13 is currently available in fourteen different packages ranging from the R5F101FAAFP#V0 with 16 KB of flash memory to the R5F100MLAFB#V0 with 512 KB of flash and 32 KB of RAM. The RL78 includes an on-chip 32 MHz oscillator, but the chip can quickly switch to the 32 kHz subsystem clock for ultra-low-speed operation. Also included on-chip is single power supply flash memory, a debug function, multiplier and divider/accumulator, interrupt function, four timers, an 8/10-bit ADC, 16 to 120 I/O ports, and considerably more. Renesas was good enough to put one of the larger chips in the RDK.
Getting started with the kit is straightforward. The installation disk automatically installs all the Renesas software and drivers, as well as IAR Embedded Workbench® for RL78, KickStart edition, which you will have to register as you install. The IAR compiler is limited to 16 KB, so if you are going to get serious, you will need to either upgrade your license or switch to other tools. The code for the ten example programs is portable and well commented, so porting is certainly possible. The code is neatly packaged and debugged to run on the IAR tools, which with this license will certainly kick start development. One of the example programs is a detailed framework for constructing your own program from scratch.
Once you have installed all the software, put the board into debug mode (SW5-2 off) and connect it to your PC via the USB cable. If required, tell Windows where to find the drivers and this step should proceed quickly.
To verify installation, click SW5-2 back on again (RUN) and press the board’s Reset button, which starts a program called “Theramin” (though I think it should be called “angry bees”). A crosshair appears on the LCD screen, along with a dot that changes position as you tilt the screen. Pressing S3 starts the “angry bees” sound, which changes in volume and/or tone depending on which way you tilt the board. This is a good demonstration of the board’s ADXL345BCCZ-RL7 3–axis accelerometer by Analog Devices, but it is less annoying with the sound turned off.
Analog Devices’ accelerometer is not the only non-Renesas component on the board (see Figure 2). In fact, Renesas has populated it with a lot of other peripherals from its ecosystem partners, including, but not limited to, National Semiconductor’s LM4808 and LM4889 audio power amplifiers, Analog Devices’ ADMP401 silicon microphone and SSM2167 low-voltage microphone preamplifier, Vishay’s TSKS5400S infrared emitter, and third-party LDC screen, speaker, temperature sensor, LEDs, crystal, EPROM, and more.
To control a low-power AC load, Renesas includes its own BCR3AS-12A TRIAC, which can turn a load ON and OFF, but is not intended for dimming or proportional (phase) control. Instead a Renesas N-channel power-switching MOSFET can exercise PWM control over small motors (up to 60 volts, two amps).
Figure 2: The RL78/G13 demo board component layout (Courtesy of Renesas).
Getting down to business
Once you are set up, start the IAR Embedded Workbench® and click your way to the example program code (steps 10 to 17 in the Getting Started Guide). The example programs exercise numerous key features of the RL78/G13, including ADC_OneShot, ADC_Repeat, Async_Serial, DMAC, IIC_Master (requires a second board), LVD, RTC, Timer, and WDT. There is also a tutorial program, as well as one named Application, that is a framework for developing your own program – though obviously you can build on one of the examples or cut and paste code into Application from other programs if you prefer to start from scratch.
If you do decide to use the RDK to develop your own programs, one included tool you will find useful is Applilet3, which generates device drivers for different MCU peripheral functions (clocks, timers, serial interfaces, A/D converters, DMA controllers, etc.) based on settings you enter into the program’s GUI. Driver functions are provided as APIs and are not limited to initialization of peripheral functions.
To compile, download, and run a program, select a program, right click on it, and select “Set as Active.” Then:
- Under the Workspace window, click on the project to see just that code associated with it.
- From the Project menu, select Rebuild All.
- If you have not already done so, connect the board to your PC by the USB cable and set SW5-2 to the debug position (OFF).
- Select Project/Download and Debug. The project downloads to the RL78 and the Workbench switches into Debug mode. If all went well to this point, your screen should resemble the one in Figure 3.
- Click on the Reset icon and then the Go button.
The LCD screen will now show a welcome message and give instructions on what to do next, all of which varies with the program you have just downloaded.
Figure 3: IAR debug screen.
Since the RL78/G13 was designed with low-power battery-operated applications in mind, I was particularly interested in the low-voltage detector (LVD) program. The RL78 has a low-voltage detection circuit that guarantees the voltage range of the CPU and sets the device into stop mode when the supply voltage drops below a certain level as illustrated in Figure 4.
Figure 4: RL78 Low-voltage detection circuit actions (Courtesy of Renesas).
I built, downloaded, and started the program according to the instructions in the Description.txt file that accompanies each example program. Next, I put the board into Run mode (SW5-2 ON), disconnected the USB cable, and connected a five volt power supply to J4. Turning on the supply started the program running and the bank of lights to the left of the LCD screen flashing.
Connecting a DVM to the output of the power supply and a scope to the RTC, I slowly reduced the voltage, watching the LCD screen quickly start to fade. At 3.2 volts, the red LEDs blinked out and the remaining green LEDs ceased blinking, but remained on. At approximately 1.8 volts, the green LEDs blinked out as everything but the RTC shut down, which it did at approximately 1.5 volts.
I turned the voltage back up and the LEDs came back to life at approximately 1.9 volts, as promised. Just to make sure that was not a fluke (the residual voltage at J4 with the supply turned all the way down was still 24 mV), I disconnected the supply altogether, counted to ten, and slowly brought the voltage back up – the same results. Power-on Reset works as promised.
The RL78 has two power-down modes in addition to Stop mode. One of the unique features of the RL78 is the Snooze mode, which enables an RL78/G13 MCU to achieve over 30 percent average system power reduction compared to an implementation without this mode.
The RL78/G13 has three power management modes: Halt, Snooze, and Stop (see Figure 5):
- In Halt mode, the CPU clock is disabled but all peripheral devices are still operating.
- In Snooze mode, the clocks to the peripherals are disabled except for the ADC, UART, and CSI when so configured.
- In Stop mode, the high-speed system clock and internal high-speed oscillator are disabled, stopping the whole system; however, subsystem clock settings are retained.
Figure 5: RL78 power management modes (Courtesy of Renesas).
To enter Halt or Stop modes from Run mode, you just enter a Halt or Stop instruction, respectively. Returning to Run mode requires either an unmasked-interrupt request or a reset signal. Since the high-speed clock is still running in Halt mode, the return only requires a normal interrupt service delay. Halt mode is recommended when it is important to restart CPU operation immediately upon interrupt request generation.
Since the clock is stopped in Stop mode, the return to Run mode requires additional time for clock stabilization. Stop mode is best used when the response time required is longer than the wake-up time, which can be as long as 20 µs.
If Snooze mode is enabled, the high-speed internal clock is running along with just those peripherals needed to perform the task at hand. These may include the RTC, interval timer, watchdog timer, power-on reset, low-voltage detector, external interrupt, and key interrupt.
In Snooze mode, there is no need to wait for the CPU to wake up in order to receive serial data. The ADC, for example, can receive data and check to see if it is within a predefined range. If the data is within the “safe range”, the RL78 transitions from Snooze mode to Stop mode. If it is not, the CPU returns to Run mode to process the data.
Utilizing Snooze mode can result in considerably longer battery life in portable applications, as can Halting or Stopping the MCU whenever possible. Table 1 shows typical operating currents for an RL78/G13 with 96 KB of flash operating at three volts and running at 32 MHz. Note that Run, Halt, and Stop modes do not include ADC or LVD currents, so if those functions are used during a mode their currents must be added in.
|Power during Run
||4.7 mA (at 32 MHz, 30. V, typ.)
|Power during Halt
||6.21 mA (at 32 MHz, 3.0 V, typ.)
|Power during Stop
||0.23 µA (at -40°C to +70°C, no WDT, typ.)
|Power during Snooze
||Stop current plus the active function
|RTC Operating Current
||0.02 µA (at 3.0 V, 32 kHz, typ.)
|RTC +32 kHz Oscillation Current
||0.54 µA (at 3.0 V, 32 kHz, typ.)
|WDT Operating Current
||0.22 µA (at 3.0 V, 15 kHz, typ.)
|ADC Operating Current
||0.5 mA (low-voltage mode, 3V, typ.)
||75 µA (3.0 V typ.)
|LVD Operating Current
||0.08 µA (3.0 V typ.)
Table 1: RL78/G13 operating current (FIH, 32 MHz, three volts, 96 KB, typical) (Courtesy of Renesas).
So how do the numbers in Table 1 relate to a real world design? Table 2 shows the power profile using an RL78/G13 to measure temperature using the sensor on the RDK without using Snooze mode – in which case the CPU needs to wake up to do the processing – in contrast to Table 3, which shows the results using Snooze mode.
||Operation - No Snooze
|Wait for Event
||(0.5 s - 50.8 µs
Table 2: Average current estimate – without Snooze (Courtesy of Renesas).
||Operation - Snooze
|Wait for Event
||(0.5 s - 50.8 µs
Table 3: Average current estimate – with Snooze (Courtesy of Renesas).
Comparing these numbers to Table 2 and 3, the use of Snooze mode reduces the current for the temperature measurement function from approximately 0.2 mA to 1.12 mA, a reduction of 79 percent. In addition, the operating power during the entire cycle is reduced from 1.14 Amp-Sec to 3.95E-07 Amp-Sec, a power saving of about 31 percent.
The RL78/G13 targets low-power consumer and industrial applications, with its Snooze mode making it particularly well-suited for battery-powered devices. The Renesas Demonstration Kit for the RL78/G13 lets users experiment with a wide range of peripherals using their general purpose, ultra-low-power MCU. This ‘demo kit’ provides a good launch pad for developing more complex programs, aided by example source code, schematics, Gerbers, and detailed hardware and software manuals.
- “Snooze Mode Dramatically Reduces Power Consumption in 16-bit MCUs”