Skip to content

Commit

Permalink
boards: nuvoton: add support for numaker m2l31ki
Browse files Browse the repository at this point in the history
Add new development board numaker_m2l31ki for m2l31x series.

Signed-off-by: cyliang tw <[email protected]>
  • Loading branch information
cyliangtw authored and fabiobaltieri committed Mar 21, 2024
1 parent 9813221 commit 62665ea
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
#
# Nuvoton NuMaker M2L31KI board configuration
#
# Copyright (c) 2024 Nuvoton Technology Corporation.

config BOARD_NUMAKER_M2L31KI
select SOC_FLASH_NUMAKER_RMC
8 changes: 8 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/Kconfig.numaker_m2l31ki
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
#
# Nuvoton NuMaker M2L31KI board configuration
#
# Copyright (c) 2024 Nuvoton Technology Corporation.

config BOARD_NUMAKER_M2L31KI
select SOC_M2L31XXX
6 changes: 6 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

board_runner_args(pyocd "--target=m2l31kidae")

include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
5 changes: 5 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
board:
name: numaker_m2l31ki
vendor: nuvoton
socs:
- name: m2l31xxx
95 changes: 95 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.. _nuvoton_m2l31ki:

NUVOTON NUMAKER M2L31KI
########################

Overview
********

The NuMaker M2L31KI is an Internet of Things (IoT) application focused platform
specially developed by Nuvoton. The NuMaker-M2L31KI is based on the NuMicro® M2L31
series MCU with ARM® -Cortex®-M23 core.

.. image:: ./m2l31ki.webp
:align: center
:alt: M2L31KI

Features:
=========
- 32-bit Arm Cortex®-M23 M2L31KIDAE MCU
- Core clock up to 72 MHz
- 512 KB embedded Dual Bank Flash and 168 KB SRAM
- USB 2.0 Full-Speed OTG / Device
- USB 1.1 Host
- Arduino UNO compatible interface
- One push-button is for reset
- Two LEDs: one is for power indication and the other is for user-defined
- On-board NU-Link2 ICE debugger/programmer with SWD connector

More information about the board can be found at the `NuMaker M2L31KI User Manual`_.

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

* The on-board 12-MHz crystal allows the device to run at its maximum operating speed of 72MHz.

The development board configuration supports the following hardware features:

+-----------+------------+-----------------------+
| Interface | Controller | Driver/Component |
+===========+============+=======================+
| NVIC | on-chip | nested vectored |
| | | interrupt controller |
+-----------+------------+-----------------------+
| SYSTICK | on-chip | system clock |
+-----------+------------+-----------------------+
| UART | on-chip | serial port |
+-----------+------------+-----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-----------------------+

Other hardware features are not yet supported on Zephyr porting.

More details about the supported peripherals are available in `M2L31 TRM`_
Other hardware features are not currently supported by the Zephyr kernel.

Building and Flashing
*********************
Flashing
========

Here is an example for the :ref:`hello_world` application.

On board debugger Nu-link2 can emulate UART0 as a virtual COM port over usb,
To enable this, set ISW1 DIP switch 1-3 (TXD RXD VOM) to ON.
Connect the NuMaker-M2L31KI to your host computer using the USB port, then
run a serial host program to connect with your board. For example:

.. code-block:: console
$ minicom -D /dev/ttyACM0
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: numaker_m2l31ki
:goals: flash

Debugging
=========

Here is an example for the :ref:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: numaker_m2l31ki
:goals: debug

Step through the application in your debugger.

References
**********

.. _NuMaker M2L31KI User Manual:
https://www.nuvoton.com/products/microcontrollers/arm-cortex-m23-mcus/m2l31-series/
.. _M2L31 TRM:
https://www.nuvoton.com/products/microcontrollers/arm-cortex-m23-mcus/m2l31-series/
Binary file added boards/nuvoton/numaker_m2l31ki/doc/m2l31ki.webp
Binary file not shown.
27 changes: 27 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "pinctrl/m2l31ki-pinctrl.h"

&pinctrl {
uart0_default: uart0_default {
group0 {
pinmux = <PB12MFP_UART0_RXD>,
<PB13MFP_UART0_TXD>;
};
};

/* TX/RX/RTS/CTS/RST --> D1/D0/A2/A3/D2 --> PB3/PB2/PB8/PB9/PC9 */
uart1_default: uart1_default {
group0 {
pinmux = <PB9MFP_UART1_nCTS>,
<PB8MFP_UART1_nRTS>,
<PB2MFP_UART1_RXD>,
<PB3MFP_UART1_TXD>,
<PC9MFP_GPIO>;
};
};
};
82 changes: 82 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2024 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <nuvoton/m2l31kid.dtsi>
#include "numaker_m2l31ki-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
model = "Nuvoton NuMaker M2L31KI board";
compatible = "nuvoton,numaker-m2l31ki";

aliases {
led0 = &red_led;
};

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

leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpioc 14 GPIO_ACTIVE_LOW>;
label = "User LD1";
};
};
};

&scc {
/* For USB 1.1 Host/Device/OTG, configure to 192MHz, which can generate necessary 48MHz. */
/* For USB 2.0 Host/Device/OTG or no USB application, comment out to use default. */
core-clock = <DT_FREQ_M(192)>;
};

&gpioc {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x00008000>;
};
slot0_partition: partition@8000 {
label = "image-0";
reg = <0x00008000 0x00038000>;
};
slot1_partition: partition@40000 {
label = "image-1";
reg = <0x00040000 0x00038000>;
};
storage_partition: partition@78000 {
label = "storage";
reg = <0x00078000 0x00008000>;
};
};
};

&sram0 {
reg = <0x20000000 DT_SIZE_K(168)>;
};

&uart0 {
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
status = "okay";
};
16 changes: 16 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2024 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0

identifier: numaker_m2l31ki
name: NUVOTON NUMAKER-M2L31KI Kit
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 168
flash: 512
supported:
- gpio
vendor: nuvoton
23 changes: 23 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_PINCTRL=y
CONFIG_GPIO=y

# Enable system clock controller driver
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NUMAKER_SCC=y

# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000

# Enable UART driver
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable RMC
CONFIG_FLASH=y
2 changes: 2 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source [find interface/nulink.cfg]
source [find target/numicro.cfg]

0 comments on commit 62665ea

Please sign in to comment.