Arduino Nano R4
Overview
The Arduino NANO R4 is a development board featuring the Renesas RA4M1 SoC in the Arduino Nano form factor and is compatible with traditional Arduino Nano.
Hardware
Renesas RA4MA1 Processor (ARM Cortex-M4 at 48 MHz)
256 KiB flash memory and 32 KiB of RAM
One user LEDs
One set of PWM RGB LEDs
One reset button
Supported Features
The arduino_nano_r4 board supports the hardware features listed below.
- on-chip / on-board
- Feature integrated in the SoC / present on the board.
- 2 / 2
-
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files. -
vnd,foo -
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.
arduino_nano_r4/r7fa4m1ab3cfm target
On-target memory for this board target: 32 KiB of RAM, 256 KiB of Flash.
Type |
Location |
Description |
Compatible |
|---|---|---|---|
CPU |
on-chip |
ARM Cortex-M4 CPU1 |
|
ADC |
on-chip |
Renesas RA 12-bit resolution ADC (ADC12)1 |
|
Clock control |
on-chip |
Renesas RA Clock Generation Circuit external clock configuration1 |
|
on-chip |
Generic fixed-rate clock provider3 |
||
on-chip |
Renesas RA Sub-Clock1 |
||
on-chip |
Renesas RA Clock Generation Circuit PLL Clock1 |
||
on-chip |
Renesas RA Clock Control node pclk block1 |
||
on-chip |
|||
Counter |
on-chip |
Renesas RA AGT as Counter2 |
|
CRC |
on-chip |
Renesas RA CRC device1 |
|
DAC |
on-chip |
Renesas RA DAC Controller Global1 |
|
on-chip |
Renesas RA DAC Controller1 |
||
DMA |
on-chip |
Renesas RA DMA Controller1 |
|
Flash controller |
on-chip |
Renesas RA Flash Control Block1 |
|
on-chip |
Renesas RA family flash low-power controller2 |
||
GPIO & Headers |
on-chip |
||
on-board |
GPIO pins exposed on Arduino Nano headers1 |
||
I2C |
on-chip |
Renesas RA SCI I2C controller4 |
|
on-chip |
|||
Input |
on-chip |
Renesas RA Capacitive Sensing Unit1 |
|
Interrupt controller |
on-chip |
ARMv7-M NVIC (Nested Vectored Interrupt Controller)1 |
|
LED |
on-board |
Group of GPIO-controlled LEDs1 |
|
on-board |
Group of PWM-controlled LEDs1 |
||
Miscellaneous |
on-chip |
Renesas RA Event Link Controller1 |
|
on-chip |
|||
on-chip |
Renesas RA AGT2 |
||
on-chip |
|||
MMU / MPU |
on-chip |
ARMv7-M Memory Protection Unit (MPU)1 |
|
MTD |
on-chip |
Flash node2 |
|
PHY |
on-chip |
This binding is to be used by all the usb transceivers which are built-in with USB IP1 |
|
Pin control |
on-chip |
Renesas RA Pin Controller1 |
|
PWM |
on-chip |
||
on-board |
PWM channels exposed on Arduino headers1 |
||
Reserved memory |
on-chip |
Renesas Option-Setting Memory3 |
|
RNG |
on-chip |
Renesas RA SCE5 TRNG1 |
|
Serial controller |
on-chip |
||
SPI |
on-chip |
Renesas RA SCI SPI controller4 |
|
on-chip |
|||
SRAM |
on-chip |
Generic on-chip SRAM1 |
|
Timer |
on-chip |
ARMv7-M System Tick1 |
|
USB |
on-chip |
Renesas RA USB full-speed controller1 |
|
on-chip |
Renesas RA USB device controller1 |
||
Watchdog |
on-chip |
Renesas RA Watchdog (wdt)1 |
Programming and debugging
The arduino_nano_r4 board supports the runners and associated west commands listed below.
| flash | debug | rtt | debugserver | reset | attach | |
|---|---|---|---|---|---|---|
| pyocd | ✅ (default) | ✅ (default) | ✅ | ✅ | ✅ | ✅ |
Debug adapter
A debug adapter is required to flash and debug programs.
You need to prepare debug adapter separately. A 5V-compatible CMSIS-DAP adapter adapts to this board.
Alternatively you can use [Renesas Flash Programming Tool](https://www.renesas.com/en/software-tool/renesas-flash-programmer-programming-gui#overview). Although it is a propriatory software and requiers creating a user account to download it. This tool however, lets you flash over USB Type-C.
Building & Flashing
You can build and flash with west flash command (See
Building an Application and
Run an Application for more details).
Here is an example for building and flashing the Blinky application.
# From the root of the zephyr repository
west build -b arduino_nano_r4 samples/basic/blinky
west flash
To flash over USB Type-C using the Renesas Flash Programmer:
First, you need to put your Nano R4 board into bootloader programming mode.
Locate the BOOT and GND pins on your Nano R4 board.
These are clearly labeled on the bottom side of the board.
Use a jumper wire or tweezers to create a connection between the BOOT and GND pins.
This connection must remain in place during the initial connection to your computer.
While maintaining the BOOT-GND connection, connect your Nano R4 board to your computer using
the USB-C cable. Once connected, press the RESET button on the board once. The onboard orange
LED should turn OFF, and only the green Power LED should remain ON.
Then you can flash using the cli:
./rfp-cli -device RA --port /dev/ttyACM0 -p build/zephyr/zephyr.hex
Make sure not to use the -e or -a options which will erase the arduino bootloader.
Debugging
Debugging can be done with west debug command.
The following command is debugging the Blinky application.
Also, see the instructions specific to the debug server that you use.
# From the root of the zephyr repository
west build -b arduino_nano_r4 samples/basic/blinky
west debug
Using pyOCD
Various debug adapters, including cmsis-dap probes, can debug the Arduino Nano R4 with pyOCD. The default configuration uses the pyOCD for debugging. You must install CMSIS-Pack when flashing or debugging Arduino Nano R4 with pyOCD. If not installed yet, execute the following command to install CMSIS-Pack for Arduino Nano R4.
pyocd pack install r7fa4m1ab
Restoring Arduino Bootloader
If you corrupt the Arduino bootloader, you can restore it with the following command.
wget https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/bootloaders/NANOR4/dfu_nano.hex
pyocd flash -e sector -a 0x0 -t r7fa4m1ab dfu_nano.hex
Or to recover over USB Type-C using the Renesas Flash Programmer, follow the official [Arduino Guide](https://docs.arduino.cc/tutorials/nano-r4/bootloader-flashing/).