diff --git a/boards/silabs/radio_boards/slwrb4180b/Kconfig.defconfig b/boards/silabs/radio_boards/slwrb4180b/Kconfig.defconfig new file mode 100644 index 00000000000..9fa20f62d7c --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/Kconfig.defconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Piotr Mienkowski +# Copyright (c) 2020 TriaGnoSys GmbH +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_SLWRB4180B + +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 + +endif # BOARD_SLWRB4180B diff --git a/boards/silabs/radio_boards/slwrb4180b/Kconfig.slwrb4180b b/boards/silabs/radio_boards/slwrb4180b/Kconfig.slwrb4180b new file mode 100644 index 00000000000..b802cf3ae94 --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/Kconfig.slwrb4180b @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Capgemini +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_SLWRB4180B + select SOC_PART_NUMBER_EFR32MG21A020F1024IM32 diff --git a/boards/silabs/radio_boards/slwrb4180b/board.cmake b/boards/silabs/radio_boards/slwrb4180b/board.cmake new file mode 100644 index 00000000000..9505e42eed4 --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/board.cmake @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=EFR32MG21AxxxF1024") +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) + +board_runner_args(openocd) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +board_runner_args(silabs_commander "--device=EFR32MG21A020F1024IM32") +include(${ZEPHYR_BASE}/boards/common/silabs_commander.board.cmake) diff --git a/boards/silabs/radio_boards/slwrb4180b/board.yml b/boards/silabs/radio_boards/slwrb4180b/board.yml new file mode 100644 index 00000000000..adef398703b --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/board.yml @@ -0,0 +1,6 @@ +board: + name: slwrb4180b + full_name: EFR32xG21 2.4 GHz 20 dBm (SLWRB4180B) + vendor: silabs + socs: + - name: efr32mg21a020f1024im32 diff --git a/boards/silabs/radio_boards/slwrb4180b/doc/efr32mg21-slwrb4180b.webp b/boards/silabs/radio_boards/slwrb4180b/doc/efr32mg21-slwrb4180b.webp new file mode 100644 index 00000000000..cc37a1a5747 Binary files /dev/null and b/boards/silabs/radio_boards/slwrb4180b/doc/efr32mg21-slwrb4180b.webp differ diff --git a/boards/silabs/radio_boards/slwrb4180b/doc/index.rst b/boards/silabs/radio_boards/slwrb4180b/doc/index.rst new file mode 100644 index 00000000000..c0f035cc54d --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/doc/index.rst @@ -0,0 +1,133 @@ +.. zephyr:board:: slwrb4180b + +Overview +******** + +The EFR32MG21 Mighty Gecko Radio Board is one of the two +radio boards delivered with `EFR32-SLWSTK6006A Website`_. It features a +Wireless System-On-Chip (SoC) from the EFR32MG21 family, built on an +ARM Cortex®-M33F processor, offering exceptional low-power performance. + +The SLWRB4180B radio board is designed to connect seamlessly with +the Wireless Starter Kit Mainboards BRD4001A and BRD4002A + +Hardware +******** + +- EFR32MG21A020F1024IM32 Mighty Gecko SoC +- CPU core: ARM Cortex®-M33 with FPU +- Flash memory: 1024 kB +- RAM: 96 kB +- Transmit power: up to +20 dBm +- Operation frequency: 2.4 GHz +- Crystals for LFXO (32.768 kHz) and HFXO (38.4 MHz). + +For more information about the EFR32MG21 SoC and BRD4180B board, refer to these +documents: + +- `EFR32MG21 Website`_ +- `EFR32MG21 Datasheet`_ +- `EFR32xG21 Reference Manual`_ +- `EFR32-SLWSTK6006A Website`_ +- `BRD4180B User Guide`_ + +Supported Features +================== + +The ``slwrb4180b`` board supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| MPU | on-chip | memory protection unit | ++-----------+------------+-------------------------------------+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| SYSTICK | on-chip | systick | ++-----------+------------+-------------------------------------+ +| COUNTER | on-chip | rtcc | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash memory | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| I2C | on-chip | i2c port-polling | ++-----------+------------+-------------------------------------+ +| WATCHDOG | on-chip | watchdog | ++-----------+------------+-------------------------------------+ + +Connections and IOs +=================== + +In the following table, the column **Name** contains Pin names. For example, PD2 +means Pin number 2 on PORTD, as used in the board's datasheets and manuals. + ++-------+-------------+-------------------------------------+ +| Name | Function | Usage | ++=======+=============+=====================================+ +| PD2 | GPIO | LED0 | ++-------+-------------+-------------------------------------+ +| PD3 | GPIO | LED1 | ++-------+-------------+-------------------------------------+ +| PB0 | GPIO | Push Button PB0 | ++-------+-------------+-------------------------------------+ +| PB1 | GPIO | Push Button PB1 | ++-------+-------------+-------------------------------------+ +| PD4 | GPIO | Board Controller Enable | +| | | EFM_BC_EN | ++-------+-------------+-------------------------------------+ +| PA5 | USART1_TX | UART Console EFM_BC_TX US1_TX | ++-------+-------------+-------------------------------------+ +| PA6 | USART1_RX | UART Console EFM_BC_RX US1_RX | ++-------+-------------+-------------------------------------+ + +The default configuration can be found in +:zephyr_file:`boards/silabs/radio_boards/slwrb4180b/slwrb4180b_defconfig` + +Programming and Debugging +************************* + +Flashing +======== + +Connect the BRD4001A or BRD4002A mainboard, with the BRD4180B radio module mounted, +to your host computer via the USB port. + +Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: slwrb4180b + :goals: flash + +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 see the following message in the terminal: + +.. code-block:: console + + Hello World! slwrb4180b + + +.. _EFR32-SLWSTK6006A Website: + https://www.silabs.com/products/development-tools/wireless/efr32xg21-wireless-starter-kit + +.. _BRD4180B User Guide: + https://www.silabs.com/documents/public/user-guides/ug427-brd4180b-user-guide.pdf + +.. _EFR32MG21 Website: + https://www.silabs.com/products/wireless/mesh-networking/efr32mg21-series-2-socs + +.. _EFR32MG21 Datasheet: + https://www.silabs.com/documents/public/data-sheets/efr32mg21-datasheet.pdf + +.. _EFR32xG21 Reference Manual: + https://www.silabs.com/documents/public/reference-manuals/efr32xg21-rm.pdf diff --git a/boards/silabs/radio_boards/slwrb4180b/pre_dt_board.cmake b/boards/silabs/radio_boards/slwrb4180b/pre_dt_board.cmake new file mode 100644 index 00000000000..beb76b85552 --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/pre_dt_board.cmake @@ -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") diff --git a/boards/silabs/radio_boards/slwrb4180b/slwrb4180b-pinctrl.dtsi b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b-pinctrl.dtsi new file mode 100644 index 00000000000..4f8612eb15b --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b-pinctrl.dtsi @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Capgemini + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + usart0_default: usart0_default { + group0 { + pins = ; + drive-push-pull; + output-high; + }; + group1 { + pins = ; + input-enable; + silabs,input-filter; + }; + }; +}; diff --git a/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.dts b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.dts new file mode 100644 index 00000000000..77654a1f033 --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.dts @@ -0,0 +1,183 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Capgemini + * + */ + +/dts-v1/; +#include +#include +#include "slwrb4180b-pinctrl.dtsi" + +/ { + model = "Silicon Labs BRD4180B (Wireless Gecko 21 Radio Board)"; + compatible = "silabs,slwrb4180b", "silabs,efr32mg21"; + + chosen { + zephyr,console = &usart0; + zephyr,shell-uart = &usart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + sw0 = &button0; + sw1 = &button1; + watchdog0 = &wdog0; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpiod 2 0>; + label = "LED0"; + }; + + led1: led_1 { + gpios = <&gpiod 3 0>; + label = "LED1"; + }; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpiob 0 GPIO_ACTIVE_LOW>; + label = "BTN0"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpiob 1 GPIO_ACTIVE_LOW>; + label = "BTN1"; + zephyr,code = ; + }; + }; +}; + +&cpu0 { + clock-frequency = <76800000>; +}; + +&hfxo { + status = "okay"; + ctune = <129>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <79>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&rtccclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + +&wdog1clk { + clocks = <&lfxo>; +}; + +&usart0 { + current-speed = <115200>; + pinctrl-0 = <&usart0_default>; + pinctrl-names = "default"; + status = "okay"; +}; + +&rtcc0 { + prescaler = <1>; + status = "okay"; +}; + +&gpio { + status = "okay"; +}; + +&gpioa { + status = "okay"; +}; + +&gpiob { + status = "okay"; +}; + +&gpioc { + status = "okay"; +}; + +&gpiod { + status = "okay"; + + board-controller-enable { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&wdog0 { + status = "okay"; +}; + +&dma0 { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(48)>; + }; + + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 DT_SIZE_K(472)>; + }; + + slot1_partition: partition@82000 { + label = "image-1"; + reg = <0x00082000 DT_SIZE_K(472)>; + }; + + storage_partition: partition@F8000 { + label = "storage"; + reg = <0x000F8000 DT_SIZE_K(32)>; + }; + }; +}; diff --git a/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.yaml b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.yaml new file mode 100644 index 00000000000..c6e9d2b90cf --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b.yaml @@ -0,0 +1,18 @@ +identifier: slwrb4180b +name: EFR32xG21 2.4 GHz 20 dBm Radio Board (SLWRB4180B) +type: mcu +arch: arm +ram: 96 +flash: 1024 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - counter + - gpio + - nvs + - uart + - dma + - watchdog +vendor: silabs diff --git a/boards/silabs/radio_boards/slwrb4180b/slwrb4180b_defconfig b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b_defconfig new file mode 100644 index 00000000000..e70f8f5c519 --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/slwrb4180b_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/silabs/radio_boards/slwrb4180b/support/openocd.cfg b/boards/silabs/radio_boards/slwrb4180b/support/openocd.cfg new file mode 100644 index 00000000000..38409eb70ad --- /dev/null +++ b/boards/silabs/radio_boards/slwrb4180b/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 J-Link interface + set INTERFACE "jlink" +} + +source [find interface/$INTERFACE.cfg] + +transport select swd + +set CHIPNAME efr32 + +source [find target/efm32.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 +}