Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: arm: Add initial support for Renesas EK-RA2A1 #71174

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions boards/renesas/ek_ra2a1/Kconfig.ek_ra2a1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

config BOARD_EK_RA2A1
select SOC_R7FA2A1AB3CFM
9 changes: 9 additions & 0 deletions boards/renesas/ek_ra2a1/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=R7FA2A1AB")

board_runner_args(pyocd "--target=r7fa2a1ab")

include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
5 changes: 5 additions & 0 deletions boards/renesas/ek_ra2a1/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
board:
name: ek_ra2a1
vendor: renesas
socs:
- name: r7fa2a1ab3cfm
105 changes: 105 additions & 0 deletions boards/renesas/ek_ra2a1/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.. _ek_ra2a1:

RA2A1 Evaluation Kit
####################

Overview
********

The EK-RA2A1 is an evaluation kit for Renesas RA2A1 Microcontroller Group.

Renesas RA2A1 Microcontroller Group has following features

- 48MHz, Arm Cortex-M23 core
- 256kB Code Flash, 8kB Data Flash, 32kB SRAM
- USB 2.0 Full-Sppeed
- SCI x 3
- SPI x 2
- I2C x 2
- CAN x 1
- 16-bit A/D Converter
- 24-bit Sigma-Delta A/D Converter
- 12-bit D/A Converter
- 8-bit D/A Converter x 2
- High-Speed Analog Comparator
- Low-Power Analog Comparator
- OPAMP x 3
- Temperature Sensor
- General PWM Timer 32-bit x 1
- General PWM Timer 16-bit x 6
- Low Power Asynchronous General-Purpose Timer x 2
- Watchdog Timer
- 49 Input/Output pins

Hardware
********

EK-RA2A1 has following features.

- Native pin access through 4x 40-pin male headers
- MCU current measurement points
- SEGGER J-Link on-board programmer and debugger
- Two Digilent Pmod (SPI and UART)
- User LED
- Mechanical user button
- Capacitive user button

Supported Features
==================

The Renesas EK-RA2A1 board configuration supports the following
hardware features:

+-----------+------------+-------------------------------+
| Interface | Controller | Driver/components |
+===========+============+===============================+
| PINCTRL | on-chip | pinctrl |
+-----------+------------+-------------------------------+
| CLOCK | on-chip | clock_control |
+-----------+------------+-------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------+
| UART | on-chip | uart |
+-----------+------------+-------------------------------+

The default configuration can be found in
:zephyr_file:`boards/renesas/ek_ra2a1/ek_ra2a1_defconfig`


Programming and debugging
*************************

Building & Flashing
===================

You can build and flash an application with onboard J-Link debug adapter.
:ref:`build_an_application` and
:ref:`application_run` for more details).

Here is an example for building and flashing the :zephyr:code-sample:`blinky` application.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: ek_ra2a1
:goals: build flash


Debugging
=========

Debugging also can be done with onboard J-Link debug adapter.
The following command is debugging the :zephyr:code-sample:`blinky` application.
Also, see the instructions specific to the debug server that you use.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: ek_ra2a1
:maybe-skip-config:
:goals: debug


References
**********

.. EK-RA2A1 Web site:
https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra2a1-evaluation-kit-ra2a1-mcu-group
19 changes: 19 additions & 0 deletions boards/renesas/ek_ra2a1/ek_ra2a1-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
sci0_default: sci0_default {
group1 {
/* rx */
psels = <RA_PSEL(RA_PSEL_SCI_0, 3, 1)>;
};
group2 {
/* tx */
psels = <RA_PSEL(RA_PSEL_SCI_0, 3, 2)>;
drive-strength = "medium";
};
};
};
60 changes: 60 additions & 0 deletions boards/renesas/ek_ra2a1/ek_ra2a1.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <renesas/ra/ra2/r7fa2a1ab3cfm.dtsi>
#include <zephyr/dt-bindings/gpio/gpio.h>

#include "ek_ra2a1-pinctrl.dtsi"

/ {
model = "Renesas EK-RA2A1";
compatible = "renesas,ra2a1", "renesas,ra2";

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};

leds {
compatible = "gpio-leds";
led1: led1 {
gpios = <&ioport2 5 GPIO_ACTIVE_HIGH>;
label = "LED1";
};
};

aliases {
led0 = &led1;
};
};

&xtal {
clock-frequency = <DT_FREQ_M(12)>;
mosel = <0>;
#clock-cells = <0>;
status = "okay";
};

&subclk {
status = "okay";
};

&ioport2 {
status = "okay";
};

&sci0 {
pinctrl-0 = <&sci0_default>;
pinctrl-names = "default";
status = "okay";
uart0: uart {
current-speed = <115200>;
status = "okay";
};
};
12 changes: 12 additions & 0 deletions boards/renesas/ek_ra2a1/ek_ra2a1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
identifier: ek_ra2a1
name: Renesas EK-RA2A1
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
supported:
- gpio
- uart
18 changes: 18 additions & 0 deletions boards/renesas/ek_ra2a1/ek_ra2a1_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000

# Enable GPIO
CONFIG_GPIO=y
CONFIG_PINCTRL=y

# Enable Console
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE=y

CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_BUILD_NO_GAP_FILL=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this config if you want to use the clock_control
CONFIG_CLOCK_CONTROL=y

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it.

CONFIG_CLOCK_CONTROL=y
22 changes: 22 additions & 0 deletions dts/arm/renesas/ra/ra2/r7fa2a1ab3cfm.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <arm/renesas/ra/ra2/r7fa2a1xh.dtsi>

/ {
soc {
flash-controller@407e0000 {
flash0: flash@0 {
compatible = "soc-nv-flash";
reg = <0x00000000 DT_SIZE_K(256)>;
};
flash1: flash@40100000 {
compatible = "soc-nv-flash";
reg = <0x40100000 DT_SIZE_K(8)>;
};
};
};
};
105 changes: 105 additions & 0 deletions dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <arm/renesas/ra/ra2/ra2xx.dtsi>
#include <zephyr/dt-bindings/clock/ra_clock.h>

/delete-node/ &sci2;
/delete-node/ &sci3;
/delete-node/ &ioport6;
/delete-node/ &ioport7;
/delete-node/ &ioport8;

/ {
soc {
sram0: memory@20000000 {
compatible = "mmio-sram";
reg = <0x20000000 DT_SIZE_K(32)>;
};
};

clocks: clocks {
xtal: clock-xtal {
compatible = "renesas,ra-cgc-external-clock";
clock-frequency = <DT_FREQ_M(12)>;
#clock-cells = <0>;
status = "disabled";
};

hoco: clock-hoco {
compatible = "fixed-clock";
clock-frequency = <DT_FREQ_M(48)>;
#clock-cells = <0>;
};

moco: clock-moco {
compatible = "fixed-clock";
clock-frequency = <DT_FREQ_M(8)>;
#clock-cells = <0>;
};

loco: clock-loco {
compatible = "fixed-clock";
clock-frequency = <32768>;
#clock-cells = <0>;
};

subclk: clock-subclk {
compatible = "renesas,ra-cgc-subclk";
clock-frequency = <32768>;
#clock-cells = <0>;
status = "disabled";
};

pclkblock: pclkblock {
compatible = "renesas,ra-cgc-pclk-block";
#clock-cells = <0>;
sysclock-src = <RA_CLOCK_SOURCE_HOCO>;
status = "okay";

iclk: iclk {
compatible = "renesas,ra-cgc-pclk";
clk_div = <RA_SYS_CLOCK_DIV_1>;
#clock-cells = <2>;
status = "okay";
};

pclkb: pclkb {
compatible = "renesas,ra-cgc-pclk";
clk_div = <RA_SYS_CLOCK_DIV_2>;
#clock-cells = <2>;
status = "okay";
};

pclkd: pclkd {
compatible = "renesas,ra-cgc-pclk";
clk_div = <RA_SYS_CLOCK_DIV_1>;
#clock-cells = <2>;
status = "okay";
};

fclk: fclk {
compatible = "renesas,ra-cgc-pclk";
clk_div = <RA_SYS_CLOCK_DIV_1>;
#clock-cells = <2>;
status = "okay";
};

clkout: clkout {
compatible = "renesas,ra-cgc-pclk";
#clock-cells = <2>;
status = "disabled";
};


sdadcclk: sdadcclk {
compatible = "renesas,ra-cgc-pclk";
#clock-cells = <2>;
status = "disabled";
};
};
};
};
Loading
Loading