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: renesas: Add support for Renesas EK-RA4M1 #82092

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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_ra4m1/Kconfig.ek_ra4m1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

config BOARD_EK_RA4M1
select SOC_R7FA4M1AB3CFP
6 changes: 6 additions & 0 deletions boards/renesas/ek_ra4m1/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=R7FA4M1AB")

include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
6 changes: 6 additions & 0 deletions boards/renesas/ek_ra4m1/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: ek_ra4m1
full_name: RA4M1 Evaluation Kit
vendor: renesas
socs:
- name: r7fa4m1ab3cfp
Binary file added boards/renesas/ek_ra4m1/doc/ek_ra4m1.webp
Binary file not shown.
164 changes: 164 additions & 0 deletions boards/renesas/ek_ra4m1/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
.. _ek_ra4m1:

RA4M1 Evaluation Kit
####################

Overview
********

The MCU integrates multiple series of software- and pin-compatible Arm®-based 32-bit
cores that share a common set of Renesas peripherals to facilitate design scalability
and efficient platform-based product development.
The MCU provides an optimal combination of low-power, high-performance Arm Cortex®-M4 core
running up to 48 MHz with the following features:

**Renesas RA4M1 Microcontroller Group**
- R7FA4M1AB3CFP
- 100-pin LQFP package
- 48 MHz Arm® Cortex®-M4 core with Floating Point Unit (FPU)
- 32 KB SRAM
- 256 KB code flash memory
- 8 KB data flash memory

**Connectivity**
- A Device USB connector for the Main MCU
- SEGGER J-Link® On-Board (OB) interface for debugging and programming of the RA4M1 MCU. A
10pin JTAG/SWD interface is also provided for connecting optional external debuggers and
programmers.
- Two PMOD connectors, allowing use of appropriate PMOD compliant peripheral plug-in modules for
rapid prototyping
- Pin headers for access to power and signals for the Main MCU

**Multiple clock sources**
- Main MCU oscillator crystals, providing precision 12.000 MHz and 32,768 Hz external reference
clocks
- Additional low-precision clocks are available internal to the Main MCU

**General purpose I/O ports**
- One jumper to allow measuring of Main MCU current
- Copper jumpers on PCB bottom side for configuration and access to selected MCU signals

**Operating voltage**
- External 5 V input through the Debug USB connector supplies the on-board power regulator to power
logic and interfaces on the board. External 5 V or 3.3 V may be also supplied through alternate
locations on the board.

- A two-color board status LED indicating availability of regulated power and connection status of the J-Link
interface.

- A red User LED, controlled by the Main MCU firmware
- A User Push-Button switch, User Capacitive Touch Button sensor, and an optional User Potentiometer,
all of which are controlled by the Main MCU firmware
- MCU reset push-button switch
- MCU boot configuration jumper

**Special Feature Access**

- USB Full Speed Debug and Device (micro-AB connector)

.. figure:: ek_ra4m1.webp
:align: center
:alt: RA4M1 Evaluation Kit

EK-RA4M1 Board Functional Area Definitions (Credit: Renesas Electronics Corporation)

Hardware
********
Detailed hardware feature for the RA4M1 MCU group can be found at `RA4M1 Group User's Manual Hardware`_

.. figure:: ra4m1_block_diagram.webp
:width: 442px
:align: center
:alt: RA4M1 MCU group feature

RA4M1 Block diagram (Credit: Renesas Electronics Corporation)

Detailed hardware feature for the EK-RA4M1 MCU can be found at `EK-RA4M1 - User's Manual`_

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

The below features are currently supported on Zephyr OS for EK-RA4M1 board:

+-----------+------------+----------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================+
| GPIO | on-chip | gpio |
+-----------+------------+----------------------+
| MPU | on-chip | arch/arm |
+-----------+------------+----------------------+
| NVIC | on-chip | arch/arm |
+-----------+------------+----------------------+
| UART | on-chip | serial |
+-----------+------------+----------------------+
| CLOCK | on-chip | clock control |
+-----------+------------+----------------------+
| COUNTER | on-chip | counter |
+-----------+------------+----------------------+
| SPI | on-chip | spi |
+-----------+------------+----------------------+

Other hardware features are currently not supported by the port.

Programming and Debugging
*************************

Applications for the ``ek_ra4m1`` board target configuration can be
built, flashed, and debugged in the usual way. See
:ref:`build_an_application` and :ref:`application_run` for more details on
building and running.

Flashing
========

Program can be flashed to EK-RA4M1 via the on-board SEGGER J-Link debugger.
SEGGER J-link's drivers are avaialbe at https://www.segger.com/downloads/jlink/

To flash the program to board

1. Connect to J-Link OB via USB port to host PC

2. Make sure J-Link OB jumper is in default configuration as describe in `EK-RA4M1 - User's Manual`_

3. Execute west command

.. code-block:: console
west flash -r jlink
Debugging
=========

You can use Segger Ozone (`Segger Ozone Download`_) for a visual debug interface

Once downloaded and installed, open Segger Ozone and configure the debug project
like so:

* Target Device: R7FA4M1AB
* Target Interface: SWD
* Target Interface Speed: 4 MHz
* Host Interface: USB
* Program File: <path/to/your/build/zephyr.elf>

**Note:** It's verified that we can debug OK on Segger Ozone v3.30d so please use this or later
version of Segger Ozone

References
**********
- `EK-RA4M1 Website`_
- `RA4M1 MCU group Website`_

.. _EK-RA4M1 Website:
https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m1-evaluation-kit-ra4m1-mcu-group

.. _RA4M1 MCU group Website:
https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ra4m1-32-bit-microcontrollers-48mhz-arm-cortex-m4-and-lcd-controller-and-cap-touch-hmi

.. _EK-RA4M1 - User's Manual:
https://www.renesas.com/us/en/document/mat/ek-ra4m1-v1-users-manual

.. _RA4M1 Group User's Manual Hardware:
https://www.renesas.com/us/en/document/mah/renesas-ra4m1-group-users-manual-hardware?r=1054146

.. _Segger Ozone Download:
https://www.segger.com/downloads/jlink#Ozone
Binary file not shown.
24 changes: 24 additions & 0 deletions boards/renesas/ek_ra4m1/ek_ra4m1-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 Renesas Electronics Corporation
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
sci1_default: sci1_default {
group1 {
/* tx rx */
psels = <RA_PSEL(RA_PSEL_SCI_1, 4, 1)>,
<RA_PSEL(RA_PSEL_SCI_1, 4, 2)>;
};
};

spi1_default: spi1_default {
group1 {
/* MISO MOSI RSPCK SSL */
psels = <RA_PSEL(RA_PSEL_SPI, 2, 2)>,
<RA_PSEL(RA_PSEL_SPI, 2, 3)>,
<RA_PSEL(RA_PSEL_SPI, 2, 4)>,
<RA_PSEL(RA_PSEL_SPI, 2, 5)>;
};
};
};
80 changes: 80 additions & 0 deletions boards/renesas/ek_ra4m1/ek_ra4m1.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2024 Renesas Electronics Corporation
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <renesas/ra/ra4/r7fa4m1ab3cfp.dtsi>
#include <dt-bindings/gpio/gpio.h>
#include "ek_ra4m1-pinctrl.dtsi"

/ {
model = "Renesas EK-RA4M1";
compatible = "renesas,ra4m1", "renesas,ra";

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

leds {
compatible = "gpio-leds";
led1: led1 {
gpios = <&ioport1 6 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";
};

&pll {
clocks = <&xtal>;
div = <2>;
mul = <8 0>;
status = "okay";
};

&sci1 {
pinctrl-0 = <&sci1_default>;
pinctrl-names = "default";
status = "okay";
uart1: uart {
current-speed = <115200>;
status = "okay";
};
};

&ioport1 {
status = "okay";
};

&ioport2 {
status = "okay";
};

&ioport4 {
status = "okay";
};

&spi1 {
pinctrl-0 = <&spi1_default>;
pinctrl-names = "default";
status = "okay";
};
12 changes: 12 additions & 0 deletions boards/renesas/ek_ra4m1/ek_ra4m1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
identifier: ek_ra4m1
name: Renesas EK-RA4M1
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
supported:
- gpio
- uart
17 changes: 17 additions & 0 deletions boards/renesas/ek_ra4m1/ek_ra4m1_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be set by SoC?


# Enable GPIO
CONFIG_GPIO=y

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

CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_BUILD_NO_GAP_FILL=y
CONFIG_CLOCK_CONTROL=y
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.renesas_ra
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config SPI_RA_DTC
config SPI_USE_HW_SS
bool "RA MCU SPI Hardware Slave Select support"
default y
depends on !SOC_SERIES_RA2A1
depends on !(SOC_SERIES_RA2A1 || SOC_SERIES_RA4M1)
help
Use Slave Select pin instead of software Slave Select.

Expand Down
Loading
Loading