diff --git a/boards/arduino/nano_matter/Kconfig.arduino_nano_matter b/boards/arduino/nano_matter/Kconfig.arduino_nano_matter new file mode 100644 index 00000000000..27e56654131 --- /dev/null +++ b/boards/arduino/nano_matter/Kconfig.arduino_nano_matter @@ -0,0 +1,8 @@ +# Copyright (c) 2020 Piotr Mienkowski +# Copyright (c) 2020 TriaGnoSys GmbH +# Copyright (c) 2025 Pete Johanson +# Copyright (c) 2025 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ARDUINO_NANO_MATTER + select SOC_PART_NUMBER_MGM240SD22VNA diff --git a/boards/arduino/nano_matter/Kconfig.defconfig b/boards/arduino/nano_matter/Kconfig.defconfig new file mode 100644 index 00000000000..fac9aba27b5 --- /dev/null +++ b/boards/arduino/nano_matter/Kconfig.defconfig @@ -0,0 +1,34 @@ +# Copyright (c) 2020 Piotr Mienkowski +# Copyright (c) 2020 TriaGnoSys GmbH +# Copyright (c) 2025 Pete Johanson +# Copyright (c) 2025 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_ARDUINO_NANO_MATTER + +config LOG_BACKEND_SWO_FREQ_HZ + default 875000 + depends on LOG_BACKEND_SWO + +if SOC_GECKO_USE_RAIL + +config FPU + default y + +endif # SOC_GECKO_USE_RAIL + +if BT + +config FPU + default y + +config COMMON_LIBC_MALLOC_ARENA_SIZE + default 8192 + +config MAIN_STACK_SIZE + default 3072 if PM + default 2304 + +endif # BT + +endif # BOARD_ARDUINO_NANO_MATTER diff --git a/boards/arduino/nano_matter/arduino_nano_matter-pinctrl.dtsi b/boards/arduino/nano_matter/arduino_nano_matter-pinctrl.dtsi new file mode 100644 index 00000000000..0a30f97c95e --- /dev/null +++ b/boards/arduino/nano_matter/arduino_nano_matter-pinctrl.dtsi @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2025 Pete Johanson + * Copyright (c) 2025 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + eusart0_default: eusart0_default { + group0 { + pins = ; + drive-push-pull; + output-high; + }; + + group1 { + pins = ; + input-enable; + silabs,input-filter; + }; + }; + + eusart1_default: eusart1_default { + group0 { + pins = , ; + drive-push-pull; + output-high; + }; + + group1 { + pins = ; + input-enable; + silabs,input-filter; + }; + }; + + i2c0_default: i2c0_default { + group0 { + pins = , ; + drive-open-drain; + bias-pull-up; + }; + }; + + usart0_default: usart0_default { + group0 { + pins = ; + drive-push-pull; + output-high; + }; + + group1 { + pins = ; + input-enable; + silabs,input-filter; + }; + }; +}; diff --git a/boards/arduino/nano_matter/arduino_nano_matter.dts b/boards/arduino/nano_matter/arduino_nano_matter.dts new file mode 100644 index 00000000000..fc2fa63a611 --- /dev/null +++ b/boards/arduino/nano_matter/arduino_nano_matter.dts @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2025 Pete Johanson + * Copyright (c) 2025 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include "arduino_nano_matter-pinctrl.dtsi" +#include "arduino_nano_matter_connector.dtsi" + +/ { + model = "Arduino Nano Matter"; + compatible = "arduino,arduino_nano_matter", "silabs,mgm240sd22vna"; + + chosen { + zephyr,bt-hci = &bt_hci_silabs; + zephyr,code-partition = &slot0_partition; + zephyr,console = &usart0; + zephyr,flash = &flash0; + zephyr,shell-uart = &usart0; + zephyr,sram = &sram0; + zephyr,uart-pipe = &usart0; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + sw0 = &button0; + watchdog0 = &wdog0; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpioc 1 GPIO_ACTIVE_LOW>; + label = "LED 0"; + }; + + led1: led_1 { + gpios = <&gpioc 2 GPIO_ACTIVE_LOW>; + label = "LED 1"; + }; + + led2: led_2 { + gpios = <&gpioc 3 GPIO_ACTIVE_LOW>; + label = "LED 2"; + }; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; + zephyr,code = ; + }; + }; +}; + +&cpu0 { + clock-frequency = <78000000>; +}; + +&pstate_em3 { + status = "disabled"; +}; + +&hfxo { + ctune = <95>; + precision = <50>; + status = "okay"; +}; + +&lfxo { + ctune = <44>; + precision = <50>; + status = "okay"; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-autorecover; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-m = <1919>; + dpll-n = <3839>; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&sysrtcclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + +&wdog1clk { + clocks = <&lfxo>; +}; + +&usart0 { + current-speed = <115200>; + pinctrl-0 = <&usart0_default>; + pinctrl-names = "default"; + status = "okay"; +}; + +&eusart0 { + compatible = "silabs,eusart-uart"; + current-speed = <115200>; + pinctrl-0 = <&eusart0_default>; + pinctrl-names = "default"; +}; + +&eusart1 { + compatible = "silabs,eusart-spi"; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <4000000>; + cs-gpios = <&gpioc 7 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&eusart1_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&gpio { + location-swo = <0>; + status = "okay"; +}; + +&gpioa { + status = "okay"; +}; + +&gpiob { + status = "okay"; +}; + +&gpioc { + status = "okay"; +}; + +&gpiod { + status = "okay"; +}; + +&wdog0 { + status = "okay"; +}; + +&sysrtc0 { + status = "okay"; +}; + +&se { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Reserve 48 kB for the bootloader */ + boot_partition: partition@0 { + reg = <0x0 DT_SIZE_K(48)>; + label = "mcuboot"; + read-only; + }; + + /* Reserve 736 kB for the application in slot 0 */ + slot0_partition: partition@c000 { + reg = <0x0000c000 0x000B8000>; + label = "image-0"; + }; + + /* Reserve 736 kB for the application in slot 1 */ + slot1_partition: partition@C4000 { + reg = <0x000C4000 0x000B8000>; + label = "image-1"; + }; + + /* Set 16 kB of storage at the end of the 1536 kB of flash */ + storage_partition: partition@17c000 { + reg = <0x0017c000 DT_SIZE_K(16)>; + label = "storage"; + }; + }; +}; + +&bt_hci_silabs { + status = "okay"; +}; diff --git a/boards/arduino/nano_matter/arduino_nano_matter.yaml b/boards/arduino/nano_matter/arduino_nano_matter.yaml new file mode 100644 index 00000000000..01140066db9 --- /dev/null +++ b/boards/arduino/nano_matter/arduino_nano_matter.yaml @@ -0,0 +1,20 @@ +identifier: arduino_nano_matter +name: Arduino Nano Matter +type: mcu +arch: arm +ram: 256 +flash: 1536 +toolchain: + - zephyr + - gnuarmemb +supported: + - bluetooth + - gpio + - uart + - dma + - watchdog + - comparator +testing: + ignore_tags: + - pm +vendor: arduino diff --git a/boards/arduino/nano_matter/arduino_nano_matter_connector.dtsi b/boards/arduino/nano_matter/arduino_nano_matter_connector.dtsi new file mode 100644 index 00000000000..8641ba473a8 --- /dev/null +++ b/boards/arduino/nano_matter/arduino_nano_matter_connector.dtsi @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Peter Johanson + * Copyright (c) 2025 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + arduino_nano_matter_d: connector { + compatible = "arduino,arduino_nano_matter-gpio"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpioa 4 0>, /* D0 */ + <1 0 &gpioa 5 0>, /* D1 */ + <2 0 &gpioa 3 0>, /* D2 */ + <3 0 &gpioc 6 0>, /* D3 */ + <4 0 &gpioc 7 0>, /* D4 */ + <5 0 &gpioc 8 0>, /* D5 */ + <6 0 &gpioc 9 0>, /* D6 */ + <7 0 &gpiod 2 0>, /* D7 */ + <8 0 &gpiod 3 0>, /* D8 */ + <9 0 &gpiod 4 0>, /* D9 */ + <10 0 &gpiod 5 0>, /* D10 */ + <11 0 &gpioa 9 0>, /* D11 */ + <12 0 &gpioa 8 0>, /* D12 */ + <13 0 &gpiob 4 0>, /* D13 */ + <14 0 &gpiob 0 0>, /* A0 */ + <15 0 &gpiob 2 0>, /* A1 */ + <16 0 &gpiob 5 0>, /* A2 */ + <17 0 &gpioc 0 0>, /* A3 */ + <18 0 &gpioa 6 0>, /* A4 */ + <19 0 &gpioa 7 0>, /* A5 */ + <20 0 &gpiob 1 0>, /* A6 */ + <21 0 &gpiob 3 0>; /* A7 */ + }; +}; + +arduino_nano_matter_spi: &eusart1 {}; + +arduino_nano_matter_serial: &eusart0 {}; + +arduino_nano_matter_i2c: &i2c0 {}; diff --git a/boards/arduino/nano_matter/arduino_nano_matter_defconfig b/boards/arduino/nano_matter/arduino_nano_matter_defconfig new file mode 100644 index 00000000000..e70f8f5c519 --- /dev/null +++ b/boards/arduino/nano_matter/arduino_nano_matter_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_MPU=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_GPIO=y diff --git a/boards/arduino/nano_matter/board.cmake b/boards/arduino/nano_matter/board.cmake new file mode 100644 index 00000000000..83a839991dd --- /dev/null +++ b/boards/arduino/nano_matter/board.cmake @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(openocd) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +board_runner_args(jlink "--device=MGM240SD22VNA") +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arduino/nano_matter/board.yml b/boards/arduino/nano_matter/board.yml new file mode 100644 index 00000000000..cabd42d4f61 --- /dev/null +++ b/boards/arduino/nano_matter/board.yml @@ -0,0 +1,6 @@ +board: + name: arduino_nano_matter + full_name: Arduino Nano Matter + vendor: arduino + socs: + - name: mgm240sd22vna diff --git a/boards/arduino/nano_matter/doc/index.rst b/boards/arduino/nano_matter/doc/index.rst new file mode 100644 index 00000000000..7b065609de5 --- /dev/null +++ b/boards/arduino/nano_matter/doc/index.rst @@ -0,0 +1,121 @@ +.. zephyr:board:: arduino_nano_matter + +Overview +******** + +The Nano Matter merges the well-known Arduino way of making complex technology more accessible with the +powerful MGM240S from Silicon Labs, to bring Matter closer to the maker world, in one of the +smallest form factors in the market. + +It enables 802.15.4 (Thread®) and Bluetooth® Low Energy connectivity, to interact with Matter-compatible devices +with a user-friendly software layer ready for quick prototyping. + +The Nano Matter features a compact and efficient architecture powered by the +MGM240S (32-bit Arm® Cortex®-M33) from Silicon Labs, a high-performance wireless module optimized for +the needs of battery and line-powered IoT devices for 2.4 GHz mesh networks. + +Hardware +******** + +- MGM240SD22VNA2 Mighty Gecko SiP +- CPU core: ARM Cortex®-M33 with FPU +- Flash memory: 1536 kB +- RAM: 256 kB +- Transmit power: up to +20 dBm +- Operation frequency: 2.4 GHz +- Crystals for LFXO (32.768 kHz) and HFXO (39 MHz). +- User RGB LED +- User button + +For more information about the EFR32MG24 SoC and the Arduino Nano Matter, refer to these +documents: + +- `MGM240S Website`_ +- `EFR32MG24 Datasheet`_ +- `EFR32xG24 Reference Manual`_ +- `Nano Matter User Manual`_ + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Connections and IOs +=================== + +In the following table, the column **Name** contains Pin names. For example, PA2 +means Pin number 2 on PORTA, as used in the board's datasheets and manuals. + ++-------+-------------+------------------+ +| Name | Function | Usage | ++=======+=============+==================+ +| PC1 | GPIO | LED0 | ++-------+-------------+------------------+ +| PC2 | GPIO | LED1 | ++-------+-------------+------------------+ +| PC3 | GPIO | LED2 | ++-------+-------------+------------------+ +| PA0 | GPIO | Button | ++-------+-------------+------------------+ +| PC4 | USART0_TX | UART Console TX | ++-------+-------------+------------------+ +| PC5 | USART0_RX | UART Console RX | ++-------+-------------+------------------+ + +System Clock +============ + +The MGM240S SiP is configured to run at 78 MHz using DPLL and the 39 MHz internal oscillator. + +Serial Port +=========== + +The MGM240S SiP has one USART and two EUSARTs. +USART0 is connected to the board controller and is used for the console. + +Programming and Debugging +************************* + +The Arduino Nano Matter contains an SAMD11 with CMSIS-DAP, allowing flashing, debugging, logging, etc. over +the USB port. Doing so requires a version of OpenOCD that includes support for the flash on the MG24 +MCU. Until those changes are included in stock OpenOCD, the version bundled with Arduino can be +used, or can be installed from the `OpenOCD Arduino Fork`_. When flashing, debugging, etc. you may +need to include ``--openocd=/usr/local/bin/openocd +--openocd-search=/usr/local/share/openocd/scripts/`` options to the command. + +Flashing +======== + +Connect the Arduino Nano Matter board to your host computer using the USB port. A USB CDC ACM serial port +should appear on the host, that can be used to view logs from the flashed application. + +Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: arduino_nano_matter + :goals: flash + +Open a serial terminal (minicom, putty, etc.) connecting to the UCB CDC ACM serial port. + +Reset the board and you should see the following message in the terminal: + +.. code-block:: console + + Hello World! arduino_nano_matter + + +.. _Nano Matter User Manual: + https://docs.arduino.cc/tutorials/nano-matter/user-manual/ + +.. _MGM240S Website: + https://www.silabs.com/wireless/zigbee/efr32mg24-series-2-modules/device.mgm240sd22vna + +.. _EFR32MG24 Datasheet: + https://www.silabs.com/documents/public/data-sheets/efr32mg24-datasheet.pdf + +.. _EFR32xG24 Reference Manual: + https://www.silabs.com/documents/public/reference-manuals/brd4187c-rm.pdf + +.. _OpenOCD Arduino Fork: + https://github.com/facchinm/OpenOCD/tree/arduino-0.12.0-rtx5 diff --git a/boards/arduino/nano_matter/doc/nano_matter.webp b/boards/arduino/nano_matter/doc/nano_matter.webp new file mode 100644 index 00000000000..1ea99f86dab Binary files /dev/null and b/boards/arduino/nano_matter/doc/nano_matter.webp differ diff --git a/boards/arduino/nano_matter/pre_dt_board.cmake b/boards/arduino/nano_matter/pre_dt_board.cmake new file mode 100644 index 00000000000..8ac3805f61e --- /dev/null +++ b/boards/arduino/nano_matter/pre_dt_board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2021 Linaro Limited +# Copyright (c) 2025 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +# SPI is implemented via usart so node name isn't spi@... +list(APPEND EXTRA_DTC_FLAGS "-Wno-spi_bus_bridge") diff --git a/boards/arduino/nano_matter/support/openocd.cfg b/boards/arduino/nano_matter/support/openocd.cfg new file mode 100644 index 00000000000..eed46c1687d --- /dev/null +++ b/boards/arduino/nano_matter/support/openocd.cfg @@ -0,0 +1,25 @@ +if {[info exists env(OPENOCD_INTERFACE)]} { + set INTERFACE $env(OPENOCD_INTERFACE) +} else { + # By default connect over Debug USB port using the CMSIS-DAP interface + set INTERFACE "cmsis-dap" +} + +source [find interface/$INTERFACE.cfg] + +transport select swd + +set CHIPNAME efr32 + +source [find target/efm32s2_g23.cfg] + +$_TARGETNAME configure -event gdb-attach { + echo "Debugger attaching: halting execution" + reset halt + gdb_breakpoint_override hard +} + +$_TARGETNAME configure -event gdb-detach { + echo "Debugger detaching: resuming execution" + resume +}