The Renesas RL78 for Low-Power Applications

Renesas Technology announced in late March he start of a design challenge for engineers around the world: develop an innovative, low-power application using the RL78 MCU and IAR Systems toolchain. To get started, you need to familiarize yourself with the RL78. Clemens Valens, Editor-in-Chief of Elektor online, introduces the RL78 in a comprehensive “The RL78 Microcontroller: An MCU Family for Low-Power Applications” (Circuit Cellar 261, 2012).

I’ve worked with Valens in various occasions, and had the pleasure of meeting him in 2011. He’s truly “an engineer’s engineer”: extremely embedded tech savvy, well-read, and inquisitive. Furthermore, I edited Circuit Cellar articles Valens wrote about diverse design projects, such as a virtual instrument interface and a scrolling LED message board. Thus, it’s clear to me that Valens understands the importance of designing high-quality, energy-efficient, systems—and doing so within budget. I trust you’ll find his introduction to the RL78 insightful and immediately applicable.

The RL78 Microcontroller: An MCU Family for Low-Power Applications

By Clemens Valens (Circuit Cellar 261, 2012)

The low-power 8/16-bit microcontroller (MCU) market is a bit of a warzone with several MCU manufacturers proposing “the industry’s lowest power solution.” In a YouTube video, Texas Instruments boasts a best active figure of 160 μA/MIPS for their MSP430 family. In application note AN1267, Microchip Technology claims 110 μA at “1 MHz Run” for their PIC16LF72X. And Renesas Electronics announced 70 μA at “1-MHz normal operation” on their RL78 product website.[1, 2, 3] The absence of justification on how exactly these figures were obtained makes comparing them rather useless. But then again, you don’t really have to because, as most low-power developers know from experience, if you don’t get the hardware and software design right, you will never attain the promised 20-year battery lifetime no matter how low the MCU’s active, sleep, or standby current may be. In this article, I will take a closer look at Renesas’s quickly expanding RL78 family to see what they offer that may help you create a low-power design.

Photo 1 - The Renesas RL78

THE RL78 FAMILY

The RL78 family of 16-bit MCUs currently has two branches, “generic” and “application specific,” but a third “display” branch is forthcoming. The generic branch contains the subfamilies G12, G13, and G1A, all based on the 78K core, and the G14, which is based on the R8C core. In the application-specific branch there is the 1A and F12. I am not sure about their core origins as these products are still very new and, at the time of writing, documentation is missing. It doesn’t really matter; from now on it is the new RL78 core for all. Since they share the same core, I will concentrate on the G13 for which I have a nice evaluation board (see Photo 1 and “The Renesas Demonstration Kit for RL78” sidebar).

Sidebar: Renesas Demonstration Kit

RL78/G13

This family comes in a large number of variants (I counted 182), with devices having from 20 up to 128 pins (see Figure 1). Note that the parts themselves are labelled R5F10xx. The differences between all these variants are, besides the package type, the amounts of flash memory (program and data) and RAM. Program flash memory starts at 16 KB and currently ends at 512 KB, data flash sizes can be 0, 4, or 8 KB and RAM is 2 KB for the small devices and up to 32 KB for the big ones.

Figure 1 - Diagram of 128-pin RL78/G13 devices

The CPU is 16-bit, but the internal memory architecture is 8 bit. Its 32 general-purpose registers are organized in four banks of eight and can be used as 8- or 16-bit registers. The memory-mapped special function registers (SFRs) that control the on-chip peripherals can be addressed per bit, per byte, or as 16-bit registers, depending on the register. A second set of SFRs, the extended or second SFRs, are available too, but they need longer instructions to be accessed.

For those who need to squeeze the maximum out of MCU performance, it may be interesting to know that the CPU offers a short addressing mode enabling you to access a page of 256 bytes with a minimum amount of code.

The maximum clock frequency of the processor is 32 MHz, but the hardware user’s manual, which is almost 1,100 pages, interestingly also boasts about the ultra-low-speed capabilities of the processor as it can run from a 32.768-kHz clock.

The RL78 core features 15 I/O ports, most of which are 8-bit wide. Port 13 is 2-bit wide and ports 10 and 15 are 7-bit wide. The port pins that are actually available depend on the device. Inputs and outputs are highly configurable. Inputs can be analog, CMOS, or TTL. Outputs can be CMOS or N-channel open drain. Pull-up resistors are available too. The exact configuration possibilities depend on the port pin, so consult the datasheet. Because of the many configuration options, it is possible to use the MCU in multi-voltage systems without level-shifting circuitry except for the occasional external pull-up resistor. The chip can be powered from 1.6 V to 5.5 V, the core itself runs from 1.8 V provided by an internal voltage regulator.

TIME MANAGEMENT

Several options are available for the MCU clock. When clock precision is not too important, the MCU can be run from its internal clock, up to 32 MHz, otherwise it is possible to connect an external crystal, resonator, or oscillator. An internal low-speed clock (15 kHz) is also available, but not for the CPU, only for the watchdog timer (WDT), the real-time clock (RTC), and the interval timer.

The timers of the RL78 are flexible and offer many functions. Depending on the pin size of the device, you can have up to 16 16-bit timers, grouped in two arrays of eight. Each timer (called a “channel”) can function as an interval timer, square-wave generator, event counter, frequency divider, pulse-interval timer, pulse-duration timer, and delay counter. For even more possibilities, timers can be combined to create monostable multivibrators or to do pulse-width modulation (PWM). This way, up to seven PWM signals can be generated from one master timer. If you need more timers but resolution is less important, you can split some 16-bit timers in two 8-bit timers (this is not possible with all timers). Timer 7 of array 0 is extra special as it features local interconnect network (LIN) network support (see below).

Aside from date and time keeping with alarms, the RTC also provides constant period interrupts at 2 Hz and 1 Hz and also every minute, hour, day, or month. A 1-Hz output is available on devices with 40 or more pins. For extra precision, the RTC offers a correction register for fine tuning the 32,768-kHz clock. Unsurprisingly, the RTC continues operation when the MCU is stopped.

Now that I mentioned Stop mode, a special interval timer peripheral enables wakeup from this mode at periodic intervals. This timer is also used for the analog-to-digital converter’s (ADC’s) Snooze mode. More on that later. With a clock frequency of 32,768 Hz, the lowest interval rate is 8 Hz (0.125 ms).

Yet another time-related peripheral on the RL78 is the buzzer controller (not available on 20-pin devices). This is a clock output destined at IR comms carrier generation, to clock other chips in a system or to produce sound from a buzzer. A gate bit enables modulation of this output in such a way that pulses always have the same width.

Finally, a WDT completes the timing peripherals. It has a special Window mode that limits the time frame during which you can reset the watchdog to a fraction of the watchdog interval (50%, 75%, or 100%). Resetting the watchdog counter outside the window results in a reset. The window is open in the second part of the interval. An interrupt can be generated when the WDT reaches 75% of its time-out value, (i.e., when the watchdog reset window is known to be open in all cases). Figure 2 illustrates the mechanism.

Figure 2 - Trying to reset the watchdog counter when the window is closed results in an internal reset signal

ADC

The ADC is of the 10-bit successive approximation type and can have up to 26 inputs. Several triggering options are provided, hardware and software, where hardware triggering means triggering by a timer module (timer channel 1 end of count or capture, interval timer, or RTC). The time it takes to do a conversion depends partly on the triggering mode. When input stabilization is not too much of an issue (i.e., when you don’t switch inputs) you can achieve conversion times of just over 2 μs.

Two registers enable comparing the ADC’s output to maximum and minimum values, producing an interrupt when the new value is either in or out of bounds. This function is also available in Snooze mode. In this mode, the processor itself is stopped and consumes very little power, but ADC conversions continue under control of the hardware trigger. When a conversion triggers an ADC interrupt, the processor can then wake up from Snooze mode and resume normal operation.

COMMUNICATIONS

The RL78 features multifunction serial units. The devices with 25 pins or less have one such unit, the others have two. Only serial unit 2 provides LIN bus support.

A serial unit can function in asynchronous UART mode, in synchronous CSI mode (three-wire bus with clock, data in and data out signals, master and slave mode supported), and in simplified (master-only) I²C mode. Again, depending on the device, you can have up to four UARTs or eight CSI and/or simplified I²C ports. Of course a mix is also possible. Full I²C is possible with the specialized I²C unit.

UART0 and UART2, CSI00 and CSI20 provide Snooze mode functionality similar to the ADC. In Snooze mode, these ports can be made to wake up on the arrival of incoming data without waking up the CPU. If the received data is interesting enough, it is also possible to wake up the CPU.

LIN communications are possible with UART2 together with Timer 7 of Array 0. The LIN bus is an inexpensive alternative to the CAN bus in automotive systems to control simple devices like switches, sensors, and actuators. LIN only uses one wire and is rather low speed (20 Kbps maximum). The timer takes care of the LIN synchronization issues and the UART performs the (de)serialisation of the data.

Full blown I²C communication is possible with the specialized I²C peripheral IICA. The 80-pin and more devices have two channels, the others only one. Communication speeds up to 20 MHz are permitted to enable I²C “fast mode” (3.5 MHz) and “fast mode plus” (10 MHz). This module is capable of waking up the CPU from Stop mode.

MATH ACCELERATORS

Of interest is the hardware multiplier and divider module intended for filtering and FFT functions. This module is capable of 16 × 16 bits signed and unsigned multiplications and divisions producing 32-bit results. It can also do 16 × 16 bit multiply-accumulate. We are talking about a module here, not an instruction, meaning that you have to load the operands yourself in special registers and get the result from yet another. The multiplication itself is done in one clock cycle, a division takes 16. The accumulate operation adds another cycle.

Another special math function is the binary-coded decimals (BCD) correction register that enables you to easily transform binary calculation results into BCD results.

DIRECT MEMORY ACCESS

To speed up data transport without loading the CPU, the RL78 core features direct memory access (DMA), up to four channels. DMA transfers up to 1,024 words of data (8 or 16 bit) to and from SFRs and RAM and they can be started by a range of interrupts (e.g., ADC, serial, timer). Although DMA transfers are done in parallel with normal CPU operation, it does slow down the CPU. For time-critical situations, it is possible to put a DMA transfer on hold for a number of clock cycles and let the CPU finish its job first.

INTERRUPTS

Interrupts are pretty standard on the RL78 and many sources are available. The “key interrupt” function on the other hand is less common. It provides up to eight (depending on the device, you guessed it) key or push button inputs that are ORed together to generate an interrupt on a key press (active low).

OPERATING MODES & SECURITY

Besides the aforementioned Stop and Snooze modes, the RL78 also provides a Halt mode. In this mode, the CPU is stopped but the clocks keep running, making a fast resume possible. In Stop mode, the clocks are stopped too reducing power consumption more than in Halt mode. Snooze mode is like Stop mode, but with one or more peripherals in a snoozing state, ready to wake up when something interesting happens. Interrupts can be used to wake up from Snooze, Stop, or Halt mode. A reset usually works too.

Reset, by the way, can have seven origins, three of which are related to safety functions: illegal instruction, RAM parity, and illegal memory access. Two others involve the power supply: power-on reset (POR) and low-voltage detection (LVD). All these reset options are needed to conform to the International Electrotechnical Commission (IEC) 60730-1 (“Automatic Electrical Controls for Household and Similar Use; Part 1: General Requirements”) and IEC 61508-SER (“Functional Safety of Electrical/Electronic/Programmable Electronic Safety-Related Systems”) safety standards. Since the RL78 is compliant, it also implements flash memory CRC checking, protections to prevent RAM and SFRs to be modified when the CPU stops functioning, an oscillator frequency-detection circuit, and an ADC self-test function.

The hardware used for the flash memory CRC check is also available as a general-purpose CRC module for user programs. It implements the standard CCITT CRC-16 polynomial (X^16 + X^12 + X^5 + 1).

The RAM guard function protects only up to 512 bytes, so be careful where you put your sensitive data.

FLASH & FUSES

Those familiar with the fuse bytes of PIC and AVR processors will be happy to know that the RL78 contains four of them, the option bytes that configure such things as the WDT, low-voltage detection, flash memory modes, clock frequencies, and debugging modes.

Flash memory is divided into two parts, program memory and data memory, and it can be programmed in-circuit over a serial interface. A boot partition is available too. This partition uses a kind of ping-pong mechanism called “boot swapping” to ensure that a valid bootloader is always programmed into the boot partition so that even power failures during bootloader programming will not harm the boot partition. A flash window function protects the memory against unintentionally reprogramming parts of it.

SOUNDING OFF

This concludes our voyage through the Renesas RL78 core. As you have seen, the RL78 offers many interesting peripherals all combined in a flexible low-power optimized design. Thanks to the integrated oscillator and other functions, an RL78 MCU can be used with very little external hardware, enabling inexpensive and compact designs. Once you master its Snooze mode and your low-power design skills, you can use this MCU family in battery-operated metering applications, for instance, but I am sure you can think of something more surprising.

Clemens Valens (c.valens@elektor.fr) is Editor-in-Chief of Elektor Online. He has more than 15 years of experience in embedded systems design. Clemens is currently interested in sound synthesis techniques, rapid prototyping, and the popularization of technology.

REFERENCES

[1] Texas Instruments, Inc., “Ultra-Low Power MSP430 – The World’s Lowest Power MCU,” 201.

[2] Microchip Technology, Inc., “AN1267: nanoWatt and nanoWatt XLP Technologies: An Introduction to Microchip’s Low-Power Devices,” 2009.

[3] Renesas Electronics Corp., “RL78 Family,” www.renesas.com/pr/mcu/rl78/index.html.

RESOURCES

International Electrotechnical Commission (IEC), “60730-1, Automatic Electrical Controls for Household and Similar Use; Part 1: General Requirements,” 2002.

———, “61508-SER, Functional Safety of Electrical/

Electronic/Programmable Electronic Safety-Related Systems,” 2010.

Renesas Electronics Corp., Renesas Rulz, “RL78/G13 Demonstration Kit,” www.renesasrulz.com/community/demoboards/rdkrl78g13.

For more information about the RL78 Family of microcontrollers, visit www.renesas.com.

For information about the 2012 Renesas RL78 Green Energy Challenge (in association with Elektor & Circuit Cellar), go to www.circuitcellar.com/RenesasRL78Challenge.

This article appears in Circuit Cellar 261 (April 2012).

 

 

Tech Highlights from Design West: RL78, AndroPod, Stellaris, mbed, & more

The Embedded Systems Conference has always been a top venue for studying, discussing, and handling the embedded industry’s newest leading-edge technologies. This year in San Jose, CA, I walked the floor looking for the tech Circuit Cellar and Elektor members would love to get their hands on and implement in novel projects. Here I review some of the hundreds of interesting products and systems at Design West 2012.

RENESAS

Renesas launched the RL78 Design Challenge at Design West. The following novel RL78 applications were particularly intriguing.

  • An RL78 L12 MCU powered by a lemon:

    A lemon powers the RL78 (Photo: Circuit Cellar)

  • An RL78 kit used for motor control:

    The RL78 used for motor control (Photo: Circuit Cellar)

  • An RL78 demo for home control applications:

    The RL78 used for home control (Photo: Circuit Cellar)

TEXAS INSTRUMENTS

Circuit Cellar members have used TI products in countless applications. Below are two interesting TI Cortex-based designs

A Cortex-M3 digital guitar (you can see the Android connection):

TI's digital guitar (Photo: Circuit Cellar)

Stellaris fans will be happy to see the Stellaris ARM Cortex -M4F in a small wireless application:

The Stellaris goes wireless (Photo: Circuit Cellar)

NXP mbed

Due to the success of the recent NXP mbed Design Challenge, I stopped at the mbed station to see what exciting technologies our NXP friends were exhibiting. They didn’t disappoint. Check out the mbed-based slingshot developed for playing Angry Birds!

mbed-Based sligshot for going after "Angry Birds" (Photo: Circuit Cellar)

Below is a video of the project on the mbedmicro YouTube page:

FTDI

I was pleased to see the Elektor AndroPod hard at work at the FTDI booth. The design enables users to easily control a robotic arm with Android smartphones and tablets.

FTDI demonstrates robot control with Android (Photo: Circuit Cellar)

As you can imagine, the possible applications are endless.

The AndroPod at work! (Photo: Circuit Cellar)

Renesas RL78 Green Energy Challenge

Up for an international design challenge? It’s time for the Renesas RL78 Green Energy Challenge! Renesas has partnered with IAR Systems to deliver engineers a power-house combo of low-power devices and high-quality software. They’re steering a great, green revolution and are challenging you to transform how the world experiences energy efficiency by developing a unique, low-power application using the RL78 MCU and IAR toolchain. Succeed and win a share of $17,500 in Grand Prizes from Renesas! * The Renesas Grand Prize winner will also win a free trip to Renesas DevCon in October where winners will be announced.

But that’s not all. Earn additional prizes like developments tools, Pmods, Wi-Fi modules, embedded systems books, and more from Contest Partners through weekly prize drawings. Follow Renesas on Twitter and Facebook for weekly challenge questions from official Contest Partners. Weekly Partner Challenges, and the respective winners, will be announced every Monday throughout the competition.

So, do you have a great idea for a remote device that monitors pollution? What about a box collecting data on home power usage or an energy harvesting biometric design? Perhaps your grand plan is for a low power controller scavenging heat from an oven or furnace, a meter reading biomass parameters, or a braking system for a wind turbine? It’s up to you! Send us your best RL78 based ideas to help make the world a better place.

The Challenge starts March 26, 2012 and ends on August 31, 2012. Winners will be announced in October at Renesas’ DevCon 2012.

Hundreds of free RL78/G13 development kits (“RDK”s), loaded with IAR’s Kickstart edition, are being distributed to those who qualify. Click here to see if you qualify for a complimentary RDK!

*Prizes in U.S. dollars.

Circuit Cellar, Inc. and Elektor International Media is the Contest Administrator.

 

Issue 261: Renesas RL78, Cap Touch, Synapse SNAP, & More!

Here’s a sneak peek at the projects and topics slated for the April issue of Circuit Cellar: Linux software development tools, DIY cap-touch, gain-controlled amplifier; color classification reader; start designing with the Renesas RL78 microcontroller; an introduction to sigma-delta modulators; RFI bypassing, with a focus on parallel capacitors; mesh networking simplified with SNAP technology; and more.

 

Clemens Valens introduces the Renesas Electronics RL78:

Click the image to link to the Renesas product page

Jeff Bachiochi takes a close look at Synapse Wireless SNAP technology:

Click the image to link to the Synapse-Wireless Kit webpage

Ed Nisley presents Part 2 of his article series “RFI Bypassing”:

The tracking generator output and spectrum analyzer input connect to adjacent PCB pads on the left of the SMD capacitor. Connecting the spectrum analyzer to the pad on the right side changes the measured self-resonant frequency.

The April issue will hit newsstands in late March.

GPS-Based Vehicle Timing & Tracking Project

The KartTracker’s Renesas kit (Source: Steve Lubbers CC259)

You can design and construct your own vehicle timing system at your workbench. Steve Lubbers did just that, and he describes his project in Circuit Cellar 259 (February 2012). He calls his design the “Kart Tracker,” which he built around a Renesas Electronics Corp. RX62N RDK. In fact, Steve writes that the kit has most of what’s need to bring such a design to fruition:

Most of the pieces of my KartTracker are already built into the Renesas Electronics RX62N development board (see Figure 1). The liquid crystal display (LCD) on the development board operates as the user interface and shows the driver what is happening as he races. The integrated accelerometer can be used to record the G forces experienced while racing. A serial port provides connections to a GPS receiver and a wireless transmitter. Removable flash memory stores all the race data so you can brag to your friends. You now have all of the pieces of my KartTracker.

The following block diagram depicts the relationship between the CPU, base station, flash drive, and other key components:

KartTracker Diagram (Source: Steve Lubbers CC259)

The software for the system is fairly straightforward. Steve writes:

The KartTracker software was built around the UART software sample provided with the RX62N development kit. To provide file system support, the Renesas microSD/Tiny FAT software was added. Finally, my custom GPS KartTracker software was added to the Renesas samples. My software consists of GPS, navigation, waypoints, and display modules. Support software was added to interface to the UART serial port, the file system, and the user display and control on the RX62N circuit board.

Pseudocode for the main processing loop (Source: Steve Lubbers CC259)

Read Steve’s article in the February issue for more details.

If you want to build a similar system, you should get familiar with the Renesas RX62N RDK. In the following video, Dave Jones of EEVBlog provides a quick and useful introduction to the RX62N RDK and its specs (Source: Renesas).

Good luck with this project. Be sure to keep Circuit Cellar posted on your progress!

Click here to purchase Circuit Cellar 259.