1.. _arduino_uno_r4:
2
3Arduino UNO R4
4##############
5
6Overview
7********
8
9The Arduino UNO R4 Minima/WiFi is a development board featuring the Renesas RA4M1 SoC
10in the Arduino form factor and is compatible with traditional Arduino.
11
12Hardware
13********
14
15- Renesas RA4MA1 Processor (ARM Cortex-M4 at 48 MHz)
16- 256 KiB flash memory and 32 KiB of RAM
17- One user LEDs
18- One reset button
19- One WiFi Transceiver (Arduino UNO R4 WiFi only)
20- One 12x8 LED Matrix (Arduino UNO R4 WiFi only)
21- Built-in CMSIS-DAP debug adapter (Arduino UNO R4 WiFi only)
22
23Supported Features
24==================
25
26The Arduino UNO R4 Minima/Wifi  board configuration supports the following
27hardware features:
28
29+-----------+------------+------------------------------------------+
30| Interface | Controller | Driver/Component                         |
31+===========+============+==========================================+
32| GPIO      | on-chip    | I/O ports                                |
33+-----------+------------+------------------------------------------+
34| UART      | on-chip    | Serial ports                             |
35+-----------+------------+------------------------------------------+
36
37Programming and debugging
38*************************
39
40Debug adapter
41=============
42
43A debug adapter is required to flash and debug programs.
44Arduino UNO R4 WiFi has a built-in debug adapter that
45you can use for flashing and debugging.
46
47In the Arduino UNO R4 Minima case, You need to prepare
48debug adapter separately. A 5V-compatible CMSIS-DAP adapter
49adapts to this board.
50
51
52Building & Flashing
53===================
54
55You can build and flash with ``west flash`` command (See
56:ref:`build_an_application` and
57:ref:`application_run` for more details).
58
59Here is an example for building and flashing the :zephyr:code-sample:`blinky` application.
60
61.. zephyr-app-commands::
62   :zephyr-app: samples/basic/blinky
63   :board: arduino_uno_r4_minima
64   :goals: build flash
65
66.. zephyr-app-commands::
67   :zephyr-app: samples/basic/blinky
68   :board: arduino_uno_r4_wifi
69   :goals: build flash
70
71Debugging
72=========
73
74Debugging can be done with ``west debug`` command.
75The following command is debugging the :zephyr:code-sample:`blinky` application.
76Also, see the instructions specific to the debug server that you use.
77
78.. zephyr-app-commands::
79   :zephyr-app: samples/basic/blinky
80   :board: arduino_uno_r4_minima
81   :maybe-skip-config:
82   :goals: debug
83
84.. zephyr-app-commands::
85   :zephyr-app: samples/basic/blinky
86   :board: arduino_uno_r4_wifi
87   :maybe-skip-config:
88   :goals: debug
89
90
91Using pyOCD
92-----------
93
94Various debug adapters, including cmsis-dap probes, can debug the Arduino UNO R4 with pyOCD.
95The default configuration uses the pyOCD for debugging.
96You must install CMSIS-Pack when flashing or debugging Arduino UNO R4 Minima with pyOCD.
97If not installed yet, execute the following command to install CMSIS-Pack for Arduino UNO R4.
98
99.. code-block:: console
100
101   pyocd pack install r7fa4m1ab
102
103
104Restoring Arduino Bootloader
105============================
106
107If you corrupt the Arduino bootloader, you can restore it with the following command.
108
109.. code-block:: console
110
111   wget https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/bootloaders/UNO_R4/dfu_minima.hex
112   pyocd flash -e sector -a 0x0 -t r7fa4m1ab dfu_minima.hex
113
114.. code-block:: console
115
116   wget https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/bootloaders/UNO_R4/dfu_wifi.hex
117   pyocd flash -e sector -a 0x0 -t r7fa4m1ab dfu_wifi.hex
118