Skip to content

Commit 7502304

Browse files
Terezventcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 403d0d6 commit 7502304

15 files changed

+551
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2021 Sateesh Kotapati
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(CONFIG_UART_GECKO)
5+
zephyr_library()
6+
zephyr_library_sources(board.c)
7+
endif()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPARKFUN THING PLUS MGM240P board
2+
3+
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
4+
# Copyright (c) 2022, Silicon Labs
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
module = BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
8+
module-str = Board Control
9+
source "subsys/logging/Kconfig.template.log_config"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPARKFUN THING PLUS MGM240P board
2+
3+
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
4+
# Copyright (c) 2021, Sateesh Kotapati
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
if BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
8+
9+
config CMU_HFXO_FREQ
10+
default 40000000
11+
12+
config CMU_LFXO_FREQ
13+
default 32768
14+
15+
config FLASH_BASE_ADDRESS
16+
hex
17+
default 0x08000000
18+
19+
if SOC_GECKO_USE_RAIL
20+
21+
config FPU
22+
default y
23+
24+
endif # SOC_GECKO_USE_RAIL
25+
26+
if BT
27+
28+
config FPU
29+
default y
30+
31+
config COMMON_LIBC_MALLOC_ARENA_SIZE
32+
default 8192
33+
34+
config MAIN_STACK_SIZE
35+
default 2304
36+
37+
if SHELL
38+
39+
config SHELL_STACK_SIZE
40+
default 4096
41+
42+
endif # SHELL
43+
44+
endif # BT
45+
endif # BOARD_SPARKFUN_THING_PLUS_MGM240P
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# EFR32XG24 MGM240P board
2+
3+
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P
7+
select SOC_PART_NUMBER_EFR32MG24B020F1536IM40
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
3+
* Copyright (c) 2021 Sateesh Kotapati
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <zephyr/init.h>
9+
#include <zephyr/drivers/gpio.h>
10+
#include <zephyr/sys/printk.h>
11+
#include <zephyr/logging/log.h>
12+
13+
#ifdef CONFIG_SOC_GECKO_DEV_INIT
14+
#include "em_cmu.h"
15+
#endif
16+
17+
LOG_MODULE_REGISTER(sparkfun_thing_plus_mgm240p,
18+
CONFIG_BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P_LOG_LEVEL);
19+
20+
static int sparkfun_thing_plus_mgm240p_init_clocks(void);
21+
22+
static int sparkfun_thing_plus_mgm240p_init(void)
23+
{
24+
int ret;
25+
26+
#ifdef CONFIG_SOC_GECKO_DEV_INIT
27+
sparkfun_thing_plus_mgm240p_init_clocks();
28+
#endif
29+
static struct gpio_dt_spec wake_up_gpio_dev =
30+
GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios);
31+
32+
33+
if (!gpio_is_ready_dt(&wake_up_gpio_dev)) {
34+
LOG_ERR("Wake-up GPIO device was not found!\n");
35+
return -ENODEV;
36+
}
37+
ret = gpio_pin_configure_dt(&wake_up_gpio_dev, GPIO_OUTPUT_ACTIVE);
38+
if (ret < 0)
39+
return ret;
40+
41+
return 0;
42+
}
43+
44+
#ifdef CONFIG_SOC_GECKO_DEV_INIT
45+
static int sparkfun_thing_plus_mgm240p_init_clocks(void)
46+
{
47+
CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL);
48+
#if defined(_CMU_EM01GRPACLKCTRL_MASK)
49+
CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL);
50+
#endif
51+
#if defined(_CMU_EM01GRPBCLKCTRL_MASK)
52+
CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL);
53+
#endif
54+
CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO);
55+
CMU_ClockSelectSet(cmuClock_EM4GRPACLK, cmuSelect_LFRCO);
56+
#if defined(RTCC_PRESENT)
57+
CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO);
58+
#endif
59+
#if defined(SYSRTC_PRESENT)
60+
CMU_ClockSelectSet(cmuClock_SYSRTC, cmuSelect_LFRCO);
61+
#endif
62+
CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO);
63+
#if WDOG_COUNT > 1
64+
CMU_ClockSelectSet(cmuClock_WDOG1, cmuSelect_LFRCO);
65+
#endif
66+
67+
return 0;
68+
}
69+
#endif
70+
71+
/* needs to be done after GPIO driver init */
72+
SYS_INIT(sparkfun_thing_plus_mgm240p_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
2+
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
board_runner_args(jlink "--device=EFR32MG24BxxxF1536")
7+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: sparkfun_thing_plus_matter_mgm240p
3+
vendor: sparkfun
4+
socs:
5+
- name: efr32mg24b020f1536im40
47.1 KB
Loading
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
.. _sparkfun_thing_plus_mgm240p:
2+
3+
SPARKFUN THING PLUS MATTER
4+
###########################
5+
6+
Overview
7+
********
8+
9+
The MGM240P Mighty Sparkfun Think Plus Matter contains
10+
a Wireless System-On-Chip from the EFR32MG24 family built on an
11+
ARM Cortex®-M33F processor with excellent low power capabilities.
12+
13+
.. figure:: ./img/MGM240P_Thing_Plus.jpg
14+
:height: 260px
15+
:align: center
16+
:alt: MGM240P Sparkfun Think Plus Matter
17+
18+
xG24-MGM240P (image courtesy of Sparkfun)
19+
20+
Hardware
21+
********
22+
23+
- Based on the Series 2 EFR32MG24 SoC
24+
- CPU core: 32-bit ARM® Cortex®-M33 core at 39 MHz
25+
- Flash memory: 1536 kB
26+
- RAM: 256 kB
27+
- Supports Multiple 802.15.4 Wireless Protocols (Zigbee and OpenThread)
28+
- Bluetooth Low Energy 5.3
29+
- Crystals for LFXO (32 kHz) and HFXO (39 MHz).
30+
31+
For more information about the EFR32MG24 SoC and BRD2601B board, refer to these
32+
documents:
33+
34+
- `EFR32MG24 Website`_
35+
- `EFR32MG24 Datasheet`_
36+
- `EFR32xG24 Reference Manual`_
37+
- `MGM240P Datasheet`_
38+
- `MGM240P Schematics`_
39+
40+
Supported Features
41+
==================
42+
43+
The board configuration supports the following hardware features:
44+
45+
+-----------+------------+-------------------------------------+
46+
| Interface | Controller | Driver/Component |
47+
+===========+============+=====================================+
48+
| COUNTER | on-chip | stimer |
49+
+-----------+------------+-------------------------------------+
50+
| FLASH | on-chip | flash memory |
51+
+-----------+------------+-------------------------------------+
52+
| GPIO | on-chip | gpio |
53+
+-----------+------------+-------------------------------------+
54+
| UART | on-chip | serial |
55+
+-----------+------------+-------------------------------------+
56+
| TRNG | on-chip | semailbox |
57+
+-----------+------------+-------------------------------------+
58+
| WATCHDOG | on-chip | watchdog |
59+
+-----------+------------+-------------------------------------+
60+
| I2C(M/S) | on-chip | i2c |
61+
+-----------+------------+-------------------------------------+
62+
| RADIO | on-chip | bluetooth |
63+
+-----------+------------+-------------------------------------+
64+
65+
Other hardware features are currently not supported by the port.
66+
67+
Connections and IOs
68+
===================
69+
70+
In the following table, the column **Name** contains Pin names. For example, PA2
71+
means Pin number 2 on PORTA, as used in the board's datasheets and manuals.
72+
73+
+-------+-------------+-------------------------------------+
74+
| Name | Function | Usage |
75+
+=======+=============+=====================================+
76+
| PA8 | GPIO | LED0 |
77+
+-------+-------------+-------------------------------------+
78+
| PA5 | USART0_TX | UART Console EFM_BC_TX US0_TX |
79+
+-------+-------------+-------------------------------------+
80+
| PA6 | USART0_RX | UART Console EFM_BC_RX US0_RX |
81+
+-------+-------------+-------------------------------------+
82+
83+
The default configuration can be found in
84+
:zephyr_file:`boards/silabs/sparkfun_thing_plus_mgm240p/sparkfun_thing_plus_mgm240p_defconfig`
85+
86+
System Clock
87+
============
88+
89+
The EFR32MG24 SoC is configured to use the 39 MHz external oscillator on the
90+
board.
91+
92+
Serial Port
93+
===========
94+
95+
The EFR32MG24 SoC has one USART and two EUSARTs.
96+
USART0 is connected to the board controller and is used for the console.
97+
98+
Programming and Debugging
99+
*************************
100+
101+
.. note::
102+
Before using the kit the first time, you should update the J-Link firmware
103+
from `J-Link-Downloads`_
104+
105+
Flashing
106+
========
107+
108+
The sample application :ref:`hello_world` is used for this example.
109+
Build the Zephyr kernel and application:
110+
111+
.. zephyr-app-commands::
112+
:zephyr-app: samples/hello_world
113+
:board: sparkfun_thing_plus_mgm240p
114+
:goals: build
115+
116+
Connect the sparkfun_thing_plus_mgm240p to your host computer using the USB port and you
117+
should see a USB connection.
118+
119+
Open a serial terminal (minicom, putty, etc.) with the following settings:
120+
121+
- Speed: 115200
122+
- Data: 8 bits
123+
- Parity: None
124+
- Stop bits: 1
125+
126+
Reset the board and you'll see the following message on the corresponding serial port
127+
terminal session:
128+
129+
.. code-block:: console
130+
131+
Hello World! _sparkfun_thing_plus_mgm240p
132+
133+
Bluetooth
134+
=========
135+
136+
To use the BLE function, run the command below to retrieve necessary binary
137+
blobs from the SiLabs HAL repository.
138+
139+
.. code-block:: console
140+
141+
west blobs fetch silabs
142+
143+
Then build the Zephyr kernel and a Bluetooth sample with the following
144+
command. The :ref:`bluetooth-observer-sample` sample application is used in
145+
this example.
146+
147+
.. zephyr-app-commands::
148+
:zephyr-app: samples/bluetooth/observer
149+
:board: sparkfun_thing_plus_mgm240p
150+
:goals: build
151+
152+
.. _EFR32MG24 Website:
153+
https://www.silabs.com/wireless/zigbee/efr32mg24-series-2-socs#
154+
155+
.. _EFR32MG24 Datasheet:
156+
https://www.silabs.com/documents/public/data-sheets/efr32mg24-datasheet.pdf
157+
158+
.. _EFR32xG24 Reference Manual:
159+
https://www.silabs.com/documents/public/reference-manuals/efr32xg24-rm.pdf
160+
161+
.. _MGM240P Datasheet:
162+
https://cdn.sparkfun.com/assets/1/4/5/e/5/MGM240P-Datasheet.pdf
163+
164+
.. _MGM240P Schematics:
165+
https://cdn.sparkfun.com/assets/0/f/8/4/9/Thing_Plus_MGM240P.pdf
166+
167+
.. _J-Link-Downloads:
168+
https://www.segger.com/downloads/jlink
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2022, Antmicro
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: GPIO Wake Up Trigger for EFR32MG24
5+
6+
compatible: "silabs,gecko-wake-up-trigger"
7+
8+
include: base.yaml
9+
10+
properties:
11+
gpios:
12+
type: phandle-array
13+
required: true
14+
description: |
15+
GPIO used as wake up trigger from EM4 sleep

0 commit comments

Comments
 (0)