In this article I evaluate the RX111 Starter Kit (thanks to André Oliveira from Renesas) and also give you an overview of the Renesas RX100 product line. For those of you who don’t know the RX100 line, it is a microcontroller line based on the successful Renesas RX line. This product line is based on a 32-bit CPU running a very efficient CISC instruction set (from 82 up to 109 instructions and most of them run in a single clock cycle thanks to a 5-stage pipeline and an “out-of-order” execution unit). The higher-end RX230, RX231, RX23T, RX24T, RX600 and RX700 lines also include a FPU (Floating Point Unit) while the RX100 and other RX200 devices do not. One very interesting feature is that all devices include DSP instructions, allowing digital signal processing even for the simplest RX110 device! RX devices range from 36-pin, 8KB devices (RX100) up to 176-pin, 4MB devices (RX700).
The RX100 CPU
As I said, the RX100 devices pack a 32-bit RX CPU, running up to 32MHz. This CPU has a set of 16 32-bit general purpose registers (R0-R15), one 64-bit accumulator (for DSP instructions), along with some 32-bit control registers (PC – program counter, BPC – backup program counter, PSW – program status word, BPSW – backup program status word, ISP – interrupt stack pointer, USP – user stack pointer, INTB – interrupt table register and FINTV – fast interrupt vector register). While R0 to R15 are considered general purpose registers, R0 is also used as a stack pointer (SP), according to the U bit (PSW register) the SP is the ISP (U=0) or USP (U=1). The backup registers (BPC and BPSW) are used with fast interrupts, thus avoiding stacking and unstacking them.
The RX CPU has an 82-instruction set (73 basic instructions and 9 DSP instructions) and as a CISC machine the instructions have variable length (VLIW), ranging from one to eight bytes in size (most instructions are 3-4 bytes long), allowing a very good code density (it would be nice to compare the RX CPU to a Cortex-M3 or M4 CPU). The 5-stage pipeline ensures that most instructions run in a single clock cycle (including DSP instructions such as the 16×16 Multiply-And-Accumulate MACHI and MACLO instructions). There are 10 addressing modes and instructions to manipulate several data types (bit, signed/unsigned byte, signed/unsigned word, signed/unsigned long word and strings), the RX230, RX231, RX23T, RX24T, RX600 and RX700 devices also include 32-bit IEEE754 floating point data.
The addressing space is 4GB with RAM placed at the lower addresses (starting from address 0) and code flash memory placed at the top (the last flash address is 0xFFFFFFFF).
For further information regarding RX instruction and programming model, check the RX Software Manual.
There are three low-power modes: Sleep, Deep Sleep and Standby (the lowest power consumption mode). The sleep mode stops the CPU while all other peripherals continue to work (except the watchdog if properly configured), the deep sleep further reduces power consumption by also disabling DTC, RAM and ROM(flash) clocks (all content is preserved) and the standby mode does all this and also stops clocks and oscillators (except sub-clock, RTC and USB clocks). The manufacturer claims that the power consumption is as low as 110µA/MHz at high-speed mode and 440nA at standby mode. Resuming execution from standby mode takes only 4.8µs.
RX devices also include an embedded debugging circuitry which uses a single wire (MD/FINED pin) for data communication along with the reset pin (RES).
The RX100 Family
The Renesas RX100 family comprises four sub-families:
- RX110 (simpler devices for general use with lower pin-count, smaller memory and less peripherals);
- RX111 (devices with a full USB 2.0 interface);
- RX113 (the higher-end RX100 devices focused on consumer products, they include the same USB interface of the RX111 and also an LCD controller (up to 160 segments) and a 12-channel capacitive touch interface);
- RX130 (devices focused on consumer products, they do not include USB or LCD controller, but include a 36-channel capacitive touch interface).
Code flash memory ranges from 16 up to 512KB (0-wait state at 32MHz), SRAM from 8 up to 64KB. All devices (except RX110 ones) also include 8KB of data flash along with code flash and RAM memory.
The peripheral list includes a good set of analog and digital peripherals such as:
- USB 2.0 interface: able to operate as a host, device or OTG, the USB module includes battery charging detection circuitry (BC revision 1.2), supports control, bulk, interrupt and isochronous transfers and has 10 pipes (64-byte single buffer for pipes 0, 6, 7, 8 and 9, 64-byte double buffer pipes for pipes 1, 2, 3, 4 and 5, pipes 1 and 2 can also work with a 256-byte double buffer for isochronous transfers). This interface is available only on RX111 and RX113 devices;
- LCD controller: for driving LCD glasses up to 160 segments (40 segments and 4 planes), available only on RX113 devices;
- Capacitive Touch Interface: 12-channels (RX113) or 36-channel (RX130) capacitive touch interface;
- I/O ports (with configurable internal pull-up and configurable open-drain mode). Most pins can sink up to 8mA (max 60mA for all pins) and source up to 4mA (max of 40mA for all pins). There are also limits for some pin groups, check the datasheet for further detail. A lot of I/O pins are also 5V-tolerant;
- Serial Interface: up to 8 channels of asynchronous SCI (on the RX113 line, 3 channels on the RX110 and RX111), one I2C channel (up to 400kbps), one SPI channel (up to 16Mbps) and one SSI (Serial Sound Interface) channel (only on the RX113 line);
- MTU2 16-bit timer: 4 channels (RX110) or 6 channels (RX111, RX113 and RX130). The 6-channel MTU2 unit can be used to drive a 3-phase motor (the chip includes a multiple fault detection circuitry (POE) that can turn off the timer outputs on faults and errors);
- CMT 16-bit timer: 2 channels (RX110 and RX111) or 4 channels (RX113 and RX130);
- TMR 8-bit timer: 2 channels (RX130) or 4 channels (RX113);
- Low-power 16-bit timer LPT (only on the RX113);
- Real-time clock/calendar with interrupt and alarm;
- Independent watchdog (with with a dedicated low-power clock and a 14-bit counter with window function);
- 12-bit 1Msps ADC converter (with an internal temperature sensor and internal voltage reference), 12-bit DAC (2 channels and available only on the RX113 line), 8-bit DAC (2 channels and available only on RX111 and RX130 lines) and a 2-channel analog comparator (only on RX113 and RX130);
- Clocking circuitry: three internal oscillators (32MHz HOCO, 4MHz LOCO and a 15kHz IWDT), 1 to 20MHz external clock, 32,768Hz sub-clock oscillator, internal 1x, 2x or 4x PLL and oscillator stop detecting that can automatically switch to 4MHz LOCO when the main clock stops (it also triggers an interrupt);
- Low Voltage Detector with reset and interrupt;
Along with these peripherals, the RX100 line also includes some other very interesting peripherals such as:
- Multi-function Pin Controller (MPC): this is a multiplexer hardware that can route signals to different pins, for board and routing efficiency. Most internal signals can be routed to a selectable external pin (there are usually 2 or 3 options for packages of 64 pins or higher);
- Data Transfer Controller (DTC): the DTC is a DMA module that can automate data transfers between a source and a destination address. It can work with bytes, words and long words in single transfer mode or block transfer mode (up to 256 transfers on a single trigger). The DTC can be used to transfer data from the SCI/SPI/I2C buffer to a larger memory buffer, to store reading of the ADC, to feed values to the DAC, etc. The RX devices include bus arbitration circuitry and multiple internal buses that allow simultaneous operation of DTC and CPU (when they are not accessing the same resources), so, when the CPU is reading from flash memory or reading/writing to RAM, the DTC is allowed to access peripheral registers at the same time. If the transfer involves RAM area that is also targeted by the CPU, then the CPU is halted until the transfer completes;
- Event Link Controller (ELC): the ELC can automate tasks and interaction between internal peripherals. The ELC can link timers (MTU and CMT), SCI, I2C, SPI, ADC, DAC, POE, DOC, I/O ports, DTC, etc. With the ELC you can, for instance, start a A/D or D/A conversion on a compare match of a MTU channel, increment the CMT on a SCI error, start a DTC transfer on an ADC or DAC conversion, etc;
- Data Operation Circuit (DOC): which can add, subtract and compare operands, specially useful when used with the CRC and ELC modules;
- Clock Accuracy Circuit (CAC): compares any internal clock source to another internal or external clock source and allow detecting out-of-range operation of any clock source;
- CRC calculation: RX111, RX113 and RX130 devices include a CRC calculation circuitry that can handle 3 polynomials: one CRC8 and two CRC16;
The RX100 family is positioned at the lower-end 32-bit market and its main rival is probably the Cortex-M0+ but, in my humble opinion, the RX100 (and RX200 as well) can compete and probably surpass even Cortex-M3 and Cortex-M4 devices (considering the performance per MHz).
The RX100 product selector page is here.
The chip found on the RX111 RSK is the R5F51115ADFM, an RX111 device packed with 128KB of flash, 16KB of RAM, 8KB of data flash in a 64-pin LQFP package. Regarding the documentation, Renesas usually uses the datasheet more like a device overview. Deeper information about the hardware is found on the hardware manual and if you want to understand about the RX assembly instructions, you better read the software manual! The kit includes an Renesas E1 emulator and a serial LCD display module which can be attached to the kit board.
The kit PCB includes two USB connectors (one mini B and one standard A) wired to the RX111 device and a third mini B USB connector wired to an RL78/G1C pre-programmed as a serial USB comm port (CDC device). The RL78/G1C RXD and TXD pins are wired to SCI1 pins of the RX111. There is also an 16KB I2C serial memory from Renesas (R1EX24016), a LIN driver (TJA1020), a trimpot (connected to P40/AN0), four user LEDs (LED0 connected to PB7/PC1/MTIOC3B, LED1 connected to PA0/MTIOC4A, LED2 connected to P54/MTIOC4B and LED3 connected to PB6/PC0/MTIOC3D) and three user switches (SW1 connected to P30/IRQ0, SW2 connected to P31/IRQ1 and SW3 connected to PE4/IRQ4). There are several unpopulated headers exposing most MCU signals, making it easy to connect your own piece of hardware to the RX111 RSK.
The DVD in the package includes the E2 Studio IDE, the CCRX C compiler, a lot of documentation and several examples for almost all peripherals. The tutorial application blinks all user LEDs on a pace set according to the trimpot position and also writes some text on the LCD display. There are some interesting examples of USB usage, including host mode, a host for MSC (mass storage such as an USB stick), a CDC device and an HID device.
The following pictures show the CDC example running on the RSK RX111. Once the project is compiled on E2 Studio, all you need to do is select the debug configuration (USB_PCDC) and click on the debug button. The IDE will start a debug session and download the code into the MCU flash memory.
Once completed, detach the RSK from the E1, set J6 jumper to 2-3 position (power from USB bus), J9 and J12 jumpers to position 2-3, then connect a USB cable between your computer and the mini B USB0_2 connector on the board. Windows will detect the new device and try to install a driver without success. Go to the device manager and you will find a new device (CDC USB Demonstration) with an exclamation indicating it is not working.
Select the device and select the install driver option, the driver (in fact it is just an inf file) can be found inside the cdc_inf folder, within the project folder. There will be a warning about the unsigned driver, just proceed and install it anyway.
Once installed, a new COM port will be created (mine was COM27). Open a terminal program (I use Termite). The board will keep transmitting a message until you send anything, then it will start to echo anything you send to it.
Thats all for now! I will get back to the RX111 in the near future to further explore its peripherals and programming! See you next time!