boards: sparkfun: Add support for Sparkfun Thing Plus Matter board

Added support for the  Sparkfun Thing Plus Matter MGM240P board.
For more information about this board please check:
https://www.sparkfun.com/products/20270

Signed-off-by: Teresa Zepeda Ventura <teresa.zvent@gmail.com>
This commit is contained in:
Teresa Zepeda Ventura 2024-07-12 07:27:14 -06:00 committed by Carles Cufí
commit 75023042e8
15 changed files with 551 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# Copyright (c) 2021 Sateesh Kotapati
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_UART_GECKO)
zephyr_library()
zephyr_library_sources(board.c)
endif()

View file

@ -0,0 +1,9 @@
# SPARKFUN THING PLUS MGM240P board
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
# Copyright (c) 2022, Silicon Labs
# SPDX-License-Identifier: Apache-2.0
module = BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
module-str = Board Control
source "subsys/logging/Kconfig.template.log_config"

View file

@ -0,0 +1,45 @@
# SPARKFUN THING PLUS MGM240P board
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
# Copyright (c) 2021, Sateesh Kotapati
# SPDX-License-Identifier: Apache-2.0
if BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
config CMU_HFXO_FREQ
default 40000000
config CMU_LFXO_FREQ
default 32768
config FLASH_BASE_ADDRESS
hex
default 0x08000000
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 2304
if SHELL
config SHELL_STACK_SIZE
default 4096
endif # SHELL
endif # BT
endif # BOARD_SPARKFUN_THING_PLUS_MGM240P

View file

@ -0,0 +1,7 @@
# EFR32XG24 MGM240P board
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
# SPDX-License-Identifier: Apache-2.0
config BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
select SOC_PART_NUMBER_EFR32MG24B020F1536IM40

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
* Copyright (c) 2021 Sateesh Kotapati
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/sys/printk.h>
#include <zephyr/logging/log.h>
#ifdef CONFIG_SOC_GECKO_DEV_INIT
#include "em_cmu.h"
#endif
LOG_MODULE_REGISTER(sparkfun_thing_plus_mgm240p,
CONFIG_BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P_LOG_LEVEL);
static int sparkfun_thing_plus_mgm240p_init_clocks(void);
static int sparkfun_thing_plus_mgm240p_init(void)
{
int ret;
#ifdef CONFIG_SOC_GECKO_DEV_INIT
sparkfun_thing_plus_mgm240p_init_clocks();
#endif
static struct gpio_dt_spec wake_up_gpio_dev =
GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios);
if (!gpio_is_ready_dt(&wake_up_gpio_dev)) {
LOG_ERR("Wake-up GPIO device was not found!\n");
return -ENODEV;
}
ret = gpio_pin_configure_dt(&wake_up_gpio_dev, GPIO_OUTPUT_ACTIVE);
if (ret < 0)
return ret;
return 0;
}
#ifdef CONFIG_SOC_GECKO_DEV_INIT
static int sparkfun_thing_plus_mgm240p_init_clocks(void)
{
CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL);
#if defined(_CMU_EM01GRPACLKCTRL_MASK)
CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL);
#endif
#if defined(_CMU_EM01GRPBCLKCTRL_MASK)
CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL);
#endif
CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO);
CMU_ClockSelectSet(cmuClock_EM4GRPACLK, cmuSelect_LFRCO);
#if defined(RTCC_PRESENT)
CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO);
#endif
#if defined(SYSRTC_PRESENT)
CMU_ClockSelectSet(cmuClock_SYSRTC, cmuSelect_LFRCO);
#endif
CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO);
#if WDOG_COUNT > 1
CMU_ClockSelectSet(cmuClock_WDOG1, cmuSelect_LFRCO);
#endif
return 0;
}
#endif
/* needs to be done after GPIO driver init */
SYS_INIT(sparkfun_thing_plus_mgm240p_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

View file

@ -0,0 +1,7 @@
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
# SPDX-License-Identifier: Apache-2.0
#
board_runner_args(jlink "--device=EFR32MG24BxxxF1536")
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

View file

@ -0,0 +1,5 @@
board:
name: sparkfun_thing_plus_matter_mgm240p
vendor: sparkfun
socs:
- name: efr32mg24b020f1536im40

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View file

@ -0,0 +1,168 @@
.. _sparkfun_thing_plus_mgm240p:
SPARKFUN THING PLUS MATTER
###########################
Overview
********
The MGM240P Mighty Sparkfun Think Plus Matter contains
a Wireless System-On-Chip from the EFR32MG24 family built on an
ARM Cortex®-M33F processor with excellent low power capabilities.
.. figure:: ./img/MGM240P_Thing_Plus.jpg
:height: 260px
:align: center
:alt: MGM240P Sparkfun Think Plus Matter
xG24-MGM240P (image courtesy of Sparkfun)
Hardware
********
- Based on the Series 2 EFR32MG24 SoC
- CPU core: 32-bit ARM® Cortex®-M33 core at 39 MHz
- Flash memory: 1536 kB
- RAM: 256 kB
- Supports Multiple 802.15.4 Wireless Protocols (Zigbee and OpenThread)
- Bluetooth Low Energy 5.3
- Crystals for LFXO (32 kHz) and HFXO (39 MHz).
For more information about the EFR32MG24 SoC and BRD2601B board, refer to these
documents:
- `EFR32MG24 Website`_
- `EFR32MG24 Datasheet`_
- `EFR32xG24 Reference Manual`_
- `MGM240P Datasheet`_
- `MGM240P Schematics`_
Supported Features
==================
The board configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| COUNTER | on-chip | stimer |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | flash memory |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial |
+-----------+------------+-------------------------------------+
| TRNG | on-chip | semailbox |
+-----------+------------+-------------------------------------+
| WATCHDOG | on-chip | watchdog |
+-----------+------------+-------------------------------------+
| I2C(M/S) | on-chip | i2c |
+-----------+------------+-------------------------------------+
| RADIO | on-chip | bluetooth |
+-----------+------------+-------------------------------------+
Other hardware features are currently not supported by the port.
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 |
+=======+=============+=====================================+
| PA8 | GPIO | LED0 |
+-------+-------------+-------------------------------------+
| PA5 | USART0_TX | UART Console EFM_BC_TX US0_TX |
+-------+-------------+-------------------------------------+
| PA6 | USART0_RX | UART Console EFM_BC_RX US0_RX |
+-------+-------------+-------------------------------------+
The default configuration can be found in
:zephyr_file:`boards/silabs/sparkfun_thing_plus_mgm240p/sparkfun_thing_plus_mgm240p_defconfig`
System Clock
============
The EFR32MG24 SoC is configured to use the 39 MHz external oscillator on the
board.
Serial Port
===========
The EFR32MG24 SoC has one USART and two EUSARTs.
USART0 is connected to the board controller and is used for the console.
Programming and Debugging
*************************
.. note::
Before using the kit the first time, you should update the J-Link firmware
from `J-Link-Downloads`_
Flashing
========
The sample application :ref:`hello_world` is used for this example.
Build the Zephyr kernel and application:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: sparkfun_thing_plus_mgm240p
:goals: build
Connect the sparkfun_thing_plus_mgm240p to your host computer using the USB port and you
should see a USB connection.
Open a serial terminal (minicom, putty, etc.) with the following settings:
- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1
Reset the board and you'll see the following message on the corresponding serial port
terminal session:
.. code-block:: console
Hello World! _sparkfun_thing_plus_mgm240p
Bluetooth
=========
To use the BLE function, run the command below to retrieve necessary binary
blobs from the SiLabs HAL repository.
.. code-block:: console
west blobs fetch silabs
Then build the Zephyr kernel and a Bluetooth sample with the following
command. The :ref:`bluetooth-observer-sample` sample application is used in
this example.
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/observer
:board: sparkfun_thing_plus_mgm240p
:goals: build
.. _EFR32MG24 Website:
https://www.silabs.com/wireless/zigbee/efr32mg24-series-2-socs#
.. _EFR32MG24 Datasheet:
https://www.silabs.com/documents/public/data-sheets/efr32mg24-datasheet.pdf
.. _EFR32xG24 Reference Manual:
https://www.silabs.com/documents/public/reference-manuals/efr32xg24-rm.pdf
.. _MGM240P Datasheet:
https://cdn.sparkfun.com/assets/1/4/5/e/5/MGM240P-Datasheet.pdf
.. _MGM240P Schematics:
https://cdn.sparkfun.com/assets/0/f/8/4/9/Thing_Plus_MGM240P.pdf
.. _J-Link-Downloads:
https://www.segger.com/downloads/jlink

View file

@ -0,0 +1,15 @@
# Copyright (c) 2022, Antmicro
# SPDX-License-Identifier: Apache-2.0
description: GPIO Wake Up Trigger for EFR32MG24
compatible: "silabs,gecko-wake-up-trigger"
include: base.yaml
properties:
gpios:
type: phandle-array
required: true
description: |
GPIO used as wake up trigger from EM4 sleep

View file

@ -0,0 +1,5 @@
# Copyright (c) 2021 Linaro Limited
# 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")

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2022 Silicon Labs
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <dt-bindings/pinctrl/gecko-pinctrl.h>
&pinctrl {
/* configuration for uart0 device, default state */
usart0_default: usart0_default {
group1 {
/* configure PA.6 as UART_RX and PA.5 as UART_TX */
psels = <GECKO_PSEL(UART_TX, A, 5)>,
<GECKO_PSEL(UART_RX, A, 6)>,
<GECKO_LOC(UART, 0)>;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <GECKO_PSEL(I2C_SDA, B, 3)>,
<GECKO_PSEL(I2C_SCL, B, 4)>,
<GECKO_LOC(I2C_SDA, 5)>,
<GECKO_LOC(I2C_SCL, 5)>;
};
};
};

View file

@ -0,0 +1,140 @@
/*
* Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
* Copyright (c) 2020 TriaGnoSys GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <silabs/efr32mg24b020f1536im40.dtsi>
#include "sparkfun_thing_plus_matter_mgm240p-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
model = "Sparkfun MGM240P (Sparkfun Thing Plus Matter)";
compatible = "sparkfun,sparkfun_thing_plus_mgm240p", "silabs,efr32mg24";
chosen {
zephyr,console = &usart0;
zephyr,shell-uart = &usart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,bt-hci = &bt_hci_silabs;
};
aliases {
led0 = &blue_led;
watchdog0 = &wdog0;
};
leds {
compatible = "gpio-leds";
blue_led: led_1 {
gpios = <&gpioa GECKO_PIN(8) GPIO_ACTIVE_LOW>;
};
};
wake_up_trigger: gpio-wake-up {
compatible = "silabs,gecko-wake-up-trigger";
gpios = <&gpioa GECKO_PIN(5) GPIO_ACTIVE_LOW>;
};
};
&cpu0 {
clock-frequency = <78000000>;
};
&usart0 {
current-speed = <115200>;
pinctrl-0 = <&usart0_default>;
pinctrl-names = "default";
status = "okay";
};
&i2c0 {
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
status = "okay";
};
&gpio {
status = "okay";
};
&gpioa {
status = "okay";
};
&gpiob {
status = "okay";
};
&gpioc {
status = "okay";
};
&gpiod {
status = "okay";
};
&wdog0 {
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 {
label = "mcuboot";
reg = <0x0 0x0000c000>;
read-only;
};
/* Reserve 464 kB for the application in slot 0 */
slot0_partition: partition@c000 {
label = "storage";
reg = <0x0000c000 0x00074000>;
};
/* Reserve 464 kB for the application in slot 1 */
slot1_partition: partition@80000 {
label = "image-0";
reg = <0x00080000 0x00074000>;
};
/* Reserve 32 kB for the scratch partition */
scratch_partition: partition@f4000 {
label = "image-1";
reg = <0x000f4000 0x00008000>;
};
/* Set 528Kb of storage at the end of the 1024Kb of flash */
storage_partition: partition@fc000 {
label = "image-scratch";
reg = <0x000fc000 0x00084000>;
};
};
};
&adc0 {
status = "okay";
};
&stimer0 {
status = "okay";
};
&bt_hci_silabs {
status = "okay";
};

View file

@ -0,0 +1,23 @@
identifier: sparkfun_thing_plus_matter_mgm240p
name: MGM240P
type: mcu
arch: arm
ram: 256
flash: 1536
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- counter
- gpio
- uart
- spi
- watchdog
testing:
ignore_tags:
- net
- bluetooth
- pm
- hwinfo
vendor: sparkfun

View file

@ -0,0 +1,18 @@
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
# Copyright (c) 2022 Silicon Labs
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARM_MPU=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_GPIO=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000
CONFIG_CMU_HFCLK_HFXO=y
CONFIG_SOC_GECKO_EMU_DCDC=y
CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y
CONFIG_CMU_HFCLK_LFXO=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_PINCTRL=y
CONFIG_REGULATOR=y