diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.defconfig b/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.defconfig new file mode 100644 index 0000000000000..f6000ac81b434 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.defconfig @@ -0,0 +1,12 @@ +# Copyright (c) 2025, Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_EFM32TG_STK3300 + +config CMU_HFXO_FREQ + default 32000000 + +config CMU_LFXO_FREQ + default 32768 + +endif # BOARD_EFM32TG_STK3300 diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.efm32tg_stk3300 b/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.efm32tg_stk3300 new file mode 100644 index 0000000000000..6f75cb272dad1 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/Kconfig.efm32tg_stk3300 @@ -0,0 +1,5 @@ +# Copyright (c) 2025, Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_EFM32TG_STK3300 + select SOC_PART_NUMBER_EFM32TG840F32 diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/board.cmake b/boards/silabs/starter_kits/efm32tg_stk3300/board.cmake new file mode 100644 index 0000000000000..8e6a4f4027893 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/board.cmake @@ -0,0 +1,5 @@ +# Copyright (c) 2025, Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=EFM32TG840F32") +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/board.yml b/boards/silabs/starter_kits/efm32tg_stk3300/board.yml new file mode 100644 index 0000000000000..74befd35f1e83 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/board.yml @@ -0,0 +1,6 @@ +board: + name: efm32tg_stk3300 + full_name: EFM32 Tiny Gecko (EFM32TG-STK3300) + vendor: silabs + socs: + - name: efm32tg840f32 diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/doc/efm32tg_stk3300.webp b/boards/silabs/starter_kits/efm32tg_stk3300/doc/efm32tg_stk3300.webp new file mode 100644 index 0000000000000..cd5190bd67ec6 Binary files /dev/null and b/boards/silabs/starter_kits/efm32tg_stk3300/doc/efm32tg_stk3300.webp differ diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/doc/index.rst b/boards/silabs/starter_kits/efm32tg_stk3300/doc/index.rst new file mode 100644 index 0000000000000..f496471c4a8ba --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/doc/index.rst @@ -0,0 +1,142 @@ +.. zephyr:board:: efm32tg_stk3300 + +Overview +******** + +The EFM32 Tiny Gecko Starter Kit EFM32TG-STK3300 contains a MCU from the +EFM32TG family built on ARM® Cortex®-M3 processor with excellent low +power capabilities. + +Hardware +******** + +- EFM32TG840F32 MCU with 32 kB flash and 4 kB RAM +- Advanced Energy Monitoring provides real-time information about the energy + consumption of an application or prototype design. +- 160 segment Energy Micro LCD +- 2 user buttons, 1 LED and a touch slider +- Ambient Light Sensor, Inductive-capacitive metal sensor and touch sensor +- On-board Segger J-Link USB debugger + +For more information about the EFM32TG SoC and EFM32TG-STK3300 board: + +- `EFM32TG Website`_ +- `EFM32TG Datasheet`_ +- `EFM32TG Reference Manual`_ +- `EFM32TG-STK3300 Website`_ +- `EFM32TG-STK3300 User Guide`_ +- `EFM32TG-STK3300 Schematics`_ + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Connections and IOs +=================== + +The EFM32TG SoC has six gpio controllers (PORTA to PORTF), but only three are +currently enabled (PORTB, PORTC and PORTD) for the EFM32TG-STK3300 board. + +In the following table, the column Name contains Pin names. For example, PE2 +means Pin number 2 on PORTE, as used in the board's datasheets and manuals. + ++------+-----------+---------------------------------------+ +| Name | Function | Usage | ++======+===========+=======================================+ +| PD7 | GPIO | LED0 | ++------+-----------+---------------------------------------+ +| PD8 | GPIO | Push Button PB0 | ++------+-----------+---------------------------------------+ +| PB11 | GPIO | Push Button PB1 | ++------+-----------+---------------------------------------+ +| PD0 | USART1_TX | UART Console USART1_TX #1 (EXP Pin 4) | ++------+-----------+---------------------------------------+ +| PD1 | USART1_RX | UART Console USART1_RX #1 (EXP Pin 6) | ++------+-----------+---------------------------------------+ + +System Clock +============ + +The EFM32TG SoC is configured to use the 32 MHz external oscillator on the +board. + +Serial Port +=========== + +The EFM32TG SoC has two USARTs and two Low Energy UARTs (LEUART). +USART1 is used for the console. It is exposed to the EXP Header on the +board (TX: Pin 4, RX: Pin 6). + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +.. note:: + Before using the kit the first time, you should update the J-Link firmware + in Simplicity Studio or with *JLinkConfig*. + +Flashing +======== + +The EFM32TG-STK3300 includes an `J-Link`_ debug adaptor built into the +board. It is used to flash and debug the EFM32TG on the board. + +Flashing an application to EFM32-STK3300 +---------------------------------------- + +The sample application :zephyr:code-sample:`hello_world` is used for this example. +Build the Zephyr kernel and application: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: efm32tg_stk3300 + :goals: build + +Connect the EFM32TG-STK3300 to your host computer using the USB port. +Flash the device: + +.. code-block:: console + + west flash + +Connect the board with +Use a Serial-to-USB cable to connect the host computer with the board. +The serial port is exposed on the EXP Header (TX: Pin 4, RX: Pin 6). + +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 should be able to see on the corresponding Serial Port +the following message: + +.. code-block:: console + + Hello World! efm32tg_stk3300/efm32tg840f32 + + +.. _EFM32TG-STK3300 Website: + https://www.silabs.com/products/development-tools/mcu/32-bit/efm32-tiny-gecko-starter-kit + +.. _EFM32TG-STK3300 User Guide: + https://www.silabs.com/documents/public/user-guides/ug420-efm32tg-stk3300.pdf + +.. _EFM32TG-STK3300 Schematics: + https://www.silabs.com/documents/public/schematic-files/BRD2100A-A04-schematic.pdf + +.. _EFM32TG Website: + https://www.silabs.com/products/mcu/32-bit/efm32-tiny-gecko + +.. _EFM32TG Datasheet: + https://www.silabs.com/documents/public/data-sheets/EFM32TG840.pdf + +.. _EFM32TG Reference Manual: + https://www.silabs.com/documents/public/reference-manuals/EFM32TG-RM.pdf + +.. _J-Link: + https://www.segger.com/jlink-debug-probes.html diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.dts b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.dts new file mode 100644 index 0000000000000..f468d91f13dd4 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.dts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2025 Lukas Woodtli + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "Silicon Labs EFM32TG STK3300 board"; + compatible = "silabs,efm32tg_stk3300", "silabs,efm32tg"; + + chosen { + zephyr,console = &usart1; + zephyr,flash = &flash0; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram0; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + sw0 = &button0; + sw1 = &button1; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpiod 7 0>; + label = "LED 0"; + }; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + /* gpio flags need validation */ + gpios = <&gpiod 8 GPIO_ACTIVE_LOW>; + label = "User Push Button 0"; + zephyr,code = ; + }; + + button1: button_1 { + /* gpio flags need validation */ + gpios = <&gpiob 11 GPIO_ACTIVE_LOW>; + label = "User Push Button 1"; + zephyr,code = ; + }; + }; +}; + +&cpu0 { + clock-frequency = <32000000>; +}; + +&gpiob { + status = "okay"; +}; + +&gpioc { + status = "okay"; +}; + +&gpiod { + status = "okay"; +}; + +&usart1 { + current-speed = <115200>; + location-tx = ; + location-rx = ; + status = "okay"; +}; diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.yaml b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.yaml new file mode 100644 index 0000000000000..2a44e6ab56564 --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300.yaml @@ -0,0 +1,17 @@ +identifier: efm32tg_stk3300 +name: EFM32 Wonder Gecko Starter Kit (EFM32TG-STK3300, BRD2100) +type: mcu +arch: arm +ram: 4 +flash: 32 +toolchain: + - zephyr + - gnuarmemb +supported: + - gpio + - nvs +testing: + ignore_tags: + - net + - bluetooth +vendor: silabs diff --git a/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300_defconfig b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300_defconfig new file mode 100644 index 0000000000000..9565bc01cf24b --- /dev/null +++ b/boards/silabs/starter_kits/efm32tg_stk3300/efm32tg_stk3300_defconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2025, Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_MPU=n +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_GPIO=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 +CONFIG_CMU_HFCLK_HFXO=y diff --git a/dts/arm/silabs/efm32tg.dtsi b/dts/arm/silabs/efm32tg.dtsi new file mode 100644 index 0000000000000..0a699654a3656 --- /dev/null +++ b/dts/arm/silabs/efm32tg.dtsi @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2025 Lukas Woodtli + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include "gpio_gecko.h" + +/ { + chosen { + zephyr,flash-controller = &msc; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "arm,cortex-m3"; + reg = <0>; + }; + }; + + sram0: memory@20000000 { + compatible = "mmio-sram"; + }; + + soc { + msc: flash-controller@400c0000 { + compatible = "silabs,gecko-flash-controller"; + reg = <0x400c0000 0x78>; + interrupts = <21 0>; + + #address-cells = <1>; + #size-cells = <1>; + + flash0: flash@0 { + compatible = "soc-nv-flash"; + write-block-size = <4>; + erase-block-size = <512>; + }; + }; + + usart0: usart@4000c000 { /* USART0 */ + compatible = "silabs,gecko-usart"; + reg = <0x4000c000 0x400>; + interrupts = <3 0>, <4 0>; + interrupt-names = "rx", "tx"; + peripheral-id = <0>; + status = "disabled"; + }; + + usart1: usart@4000c400 { /* USART1 */ + compatible = "silabs,gecko-usart"; + reg = <0x4000c400 0x400>; + interrupts = <15 0>, <16 0>; + interrupt-names = "rx", "tx"; + peripheral-id = <1>; + status = "disabled"; + }; + + + leuart0: leuart@40084000 { /* LEUART0 */ + compatible = "silabs,gecko-leuart"; + reg = <0x40084000 0x400>; + interrupts = <24 0>; + peripheral-id = <0>; + status = "disabled"; + }; + + leuart1: leuart@40084400 { /* LEUART1 */ + compatible = "silabs,gecko-leuart"; + reg = <0x40084400 0x400>; + interrupts = <25 0>; + peripheral-id = <1>; + status = "disabled"; + }; + + i2c0: i2c@4000a000 { + compatible = "silabs,gecko-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4000a000 0x400>; + interrupts = <9 0>; + status = "disabled"; + }; + + gpio@40006100 { + compatible = "silabs,gecko-gpio"; + reg = <0x40006100 0xf00>; + interrupts = <1 2 11 2>; + interrupt-names = "GPIO_EVEN", "GPIO_ODD"; + + ranges; + #address-cells = <1>; + #size-cells = <1>; + + gpioa: gpio@40006000 { + compatible = "silabs,gecko-gpio-port"; + reg = <0x40006000 0x24>; + peripheral-id = <0>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + gpiob: gpio@40006024 { + compatible = "silabs,gecko-gpio-port"; + reg = <0x40006024 0x24>; + peripheral-id = <1>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + gpioc: gpio@40006048 { + compatible = "silabs,gecko-gpio-port"; + reg = <0x40006048 0x24>; + peripheral-id = <2>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + gpiod: gpio@4000606c { + compatible = "silabs,gecko-gpio-port"; + reg = <0x4000606c 0x24>; + peripheral-id = <3>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + gpioe: gpio@40006090 { + compatible = "silabs,gecko-gpio-port"; + reg = <0x40006090 0x24>; + peripheral-id = <4>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + gpiof: gpio@400060b4 { + compatible = "silabs,gecko-gpio-port"; + reg = <0x400060b4 0x24>; + peripheral-id = <5>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + }; + + pinctrl: pin-controller { + /* Pin controller is a "virtual" device since SiLabs SoCs do pin + * control in a distributed way (GPIO registers and PSEL + * registers on each peripheral). + */ + compatible = "silabs,gecko-pinctrl"; + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; diff --git a/dts/arm/silabs/efm32tg840f32.dtsi b/dts/arm/silabs/efm32tg840f32.dtsi new file mode 100644 index 0000000000000..b320342cb1f09 --- /dev/null +++ b/dts/arm/silabs/efm32tg840f32.dtsi @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Lukas Woodtli + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + sram0: memory@20000000 { + reg = <0x20000000 DT_SIZE_K(32)>; + }; + + soc { + compatible = "silabs,efm32tg840f32", "silabs,efm32tg", "silabs,efm32", "simple-bus"; + + flash-controller@400c0000 { + flash0: flash@0 { + reg = <0 DT_SIZE_K(256)>; + }; + }; + }; +}; diff --git a/modules/hal_silabs/gecko/CMakeLists.txt b/modules/hal_silabs/gecko/CMakeLists.txt index acf8ead687d8a..7050322c79b7d 100644 --- a/modules/hal_silabs/gecko/CMakeLists.txt +++ b/modules/hal_silabs/gecko/CMakeLists.txt @@ -102,6 +102,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_t zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32WG ${DEVICE_DIR}/SiliconLabs/EFM32WG/Source/system_efm32wg.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32TG ${DEVICE_DIR}/SiliconLabs/EFM32TG/Source/system_efm32tg.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32BG13P ${DEVICE_DIR}/SiliconLabs/EFR32BG13P/Source/system_efr32bg13p.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG1P ${DEVICE_DIR}/SiliconLabs/EFR32FG1P/Source/system_efr32fg1p.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG13P ${DEVICE_DIR}/SiliconLabs/EFR32FG13P/Source/system_efr32fg13p.c) diff --git a/soc/silabs/silabs_s0/efm32tg/Kconfig b/soc/silabs/silabs_s0/efm32tg/Kconfig new file mode 100644 index 0000000000000..7dcaf7bd02e4c --- /dev/null +++ b/soc/silabs/silabs_s0/efm32tg/Kconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2025 Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_EFM32TG + select ARM + select CPU_CORTEX_M3 + select CPU_CORTEX_M_HAS_DWT + select HAS_SILABS_GECKO + select SOC_GECKO_CMU + select SOC_GECKO_GPIO + select HAS_PM + +config SOC_GECKO_SDID + default 73 if SOC_SERIES_EFM32TG diff --git a/soc/silabs/silabs_s0/efm32tg/Kconfig.defconfig b/soc/silabs/silabs_s0/efm32tg/Kconfig.defconfig new file mode 100644 index 0000000000000..852aba20110b2 --- /dev/null +++ b/soc/silabs/silabs_s0/efm32tg/Kconfig.defconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2025 Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_EFM32TG + +config NUM_IRQS + # must be >= the highest interrupt number used + default 39 + +endif diff --git a/soc/silabs/silabs_s0/efm32tg/Kconfig.soc b/soc/silabs/silabs_s0/efm32tg/Kconfig.soc new file mode 100644 index 0000000000000..c9f81eeb4d67d --- /dev/null +++ b/soc/silabs/silabs_s0/efm32tg/Kconfig.soc @@ -0,0 +1,21 @@ +# Copyright (c) 2025 Lukas Woodtli +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_EFM32TG + bool + select SOC_FAMILY_SILABS_S0 + help + Silicon Labs EFM32TG (Tiny Gecko) Series MCU + +config SOC_PART_NUMBER_EFM32TG840F32 + bool + select SOC_SERIES_EFM32TG + +config SOC_SERIES + default "efm32tg" if SOC_SERIES_EFM32TG + +config SOC + default "efm32tg840f32" if SOC_PART_NUMBER_EFM32TG840F32 + +config SOC_PART_NUMBER + default "EFM32TG840F32" if SOC_PART_NUMBER_EFM32TG840F32 diff --git a/soc/silabs/silabs_s0/efm32tg/soc.h b/soc/silabs/silabs_s0/efm32tg/soc.h new file mode 100644 index 0000000000000..641e7408ac47f --- /dev/null +++ b/soc/silabs/silabs_s0/efm32tg/soc.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Lukas Woodtli + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Board configuration macros for the efm32tg soc + * + */ + +#ifndef _SOC__H_ +#define _SOC__H_ + +#include + +#ifndef _ASMLANGUAGE + +#include +#include + + +#include "soc_pinmap.h" +#include "../common/soc_gpio.h" + +#endif /* !_ASMLANGUAGE */ + +#endif /* _SOC__H_ */ diff --git a/soc/silabs/silabs_s0/efm32tg/soc_pinmap.h b/soc/silabs/silabs_s0/efm32tg/soc_pinmap.h new file mode 100644 index 0000000000000..01800f7674157 --- /dev/null +++ b/soc/silabs/silabs_s0/efm32tg/soc_pinmap.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Lukas Woodtli + * SPDX-License-Identifier: Apache-2.0 + */ + +/** @file + * @brief Silabs EFM32TG MCU pin definitions. + * + * This file contains pin configuration data required by different MCU + * modules to correctly configure GPIO controller. + */ + +#ifndef _SILABS_EFM32TG_SOC_PINMAP_H_ +#define _SILABS_EFM32TG_SOC_PINMAP_H_ + +#include +#include + +#endif /* _SILABS_EFM32TG_SOC_PINMAP_H_ */ diff --git a/soc/silabs/soc.yml b/soc/silabs/soc.yml index 4617f804692d2..48c30aeba7cc4 100644 --- a/soc/silabs/soc.yml +++ b/soc/silabs/soc.yml @@ -7,6 +7,9 @@ family: - name: efm32hg socs: - name: efm32hg322f64 + - name: efm32tg + socs: + - name: efm32tg840f32 - name: silabs_s1 series: - name: efm32pg1b diff --git a/west.yml b/west.yml index 7032362af5ced..09412c604ce19 100644 --- a/west.yml +++ b/west.yml @@ -235,7 +235,7 @@ manifest: groups: - hal - name: hal_silabs - revision: 190a144a16bed9a938a94543ed5bbc70c0552e0f + revision: pull/108/head path: modules/hal/silabs groups: - hal