diff --git a/boards/arm/stm32wb5mm_dk/Kconfig.board b/boards/arm/stm32wb5mm_dk/Kconfig.board new file mode 100644 index 000000000000..28ca74d81a95 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/Kconfig.board @@ -0,0 +1,8 @@ +# STM32WB5MM-DK Discovery Development board configuration + +# Copyright (c) 2024 Javad Rahimipetroudi +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_STM32WB5MM_DK + bool "stm32wb5mm-dk Discovery Development Board" + depends on SOC_STM32WB55XX diff --git a/boards/arm/stm32wb5mm_dk/Kconfig.defconfig b/boards/arm/stm32wb5mm_dk/Kconfig.defconfig new file mode 100644 index 000000000000..5ce31881bd07 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/Kconfig.defconfig @@ -0,0 +1,16 @@ +# STM32WB5MM-DK Discovery Development board configuration + +# Copyright (c) 2024 Javad Rahimipetroudi +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_STM32WB5MM_DK + +config BOARD + default "stm32wb5mm_dk" + +choice BT_HCI_BUS_TYPE + default BT_STM32_IPM + depends on BT +endchoice + +endif # BOARD_STM32WB5MM_DK diff --git a/boards/arm/stm32wb5mm_dk/board.cmake b/boards/arm/stm32wb5mm_dk/board.cmake new file mode 100644 index 000000000000..47fc12f13088 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/board.cmake @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +board_runner_args(pyocd "--target=stm32wb55vgyx") +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") + +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) diff --git a/boards/arm/stm32wb5mm_dk/doc/img/STM32WB5MM_DK.jpg b/boards/arm/stm32wb5mm_dk/doc/img/STM32WB5MM_DK.jpg new file mode 100644 index 000000000000..0e9cc26ac201 Binary files /dev/null and b/boards/arm/stm32wb5mm_dk/doc/img/STM32WB5MM_DK.jpg differ diff --git a/boards/arm/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst b/boards/arm/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst new file mode 100644 index 000000000000..b23361a30f57 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst @@ -0,0 +1,226 @@ +.. _stm32wb5mm_dk_discovery_kit: + +ST STM32WB5MM-DK +################ + +Overview +******** + +The STM32WB5MM-DK Discovery kit is designed as a complete demonstration +and development platform for the STMicroelectronics STM32W5MMG module based +on the Arm |reg| Cortex |reg|-M4 and Arm |reg| Cortex |reg|-M0+ cores. The +STM32 device is a multi-protocol wireless and ultra-low-power device +embedding a powerful and ultra-low-power radio compliant with the +Bluetooth |reg| Low Energy (BLE) SIG specification v5.2 and with +IEEE 802.15.4-2011. + + +STM32WB5MM-DK supports the following features: + +* STM32WB5MMG (1-Mbyte Flash memory, 256-Kbyte SRAM) + - Dual-core 32‑bit (Arm |reg| Cortex |reg|-M4 and M0+) + - 2.4 GHz RF transceiver + - 0.96-inch 128x64 OLED display + - 128-Mbit Quad-SPI NOR Flash Memory + - Temperature sensor + - Accelerometer/gyroscope sensor + - Time-of-Flight and gesture-detection sensor + - Digital microphone + - RGB LED + - Infrared LED + - 3 push-buttons (2 users and 1 reset) and 1 touch key button +* Board connectors: + - STMod+ + - ARDUINO |reg| Uno V3 expansion connector + - USB user with Micro-B connector + - TAG10 10-pin footprint + +* Flexible power-supply options: + - ST-LINK/V2-1 USB connector, + - 5 V delivered by: + - ARDUINO |reg|, + - external connector, + - USB charger, or USB power +* On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration + - Virtual COM port and debug port + + +.. image:: img/STM32WB5MM_DK.jpg + :align: center + :alt: STM32WB5MM-DK + +More information about the board can be found at the `` `STM32WB5MM-DK on www.st.com`_. + +Hardware +******** + +STM32WB5MMG is an ultra-low-power and small form factor certified 2.4 GHz +wireless module. It supportsBluetooth |reg| Low Energy 5.4, Zigbee |reg| 3.0, +OpenThread, dynamic, and static concurrent modes, and 802.15.4proprietary +protocols. Based on the STMicroelectronics STM32WB55VGY wireless +microcontroller,STM32WB5MMG provides best-in-class RF performance thanks +to its high receiver sensitivity and output power signal. Its low-power +features enable extended battery life, small coin-cell batteries, and +energy harvesting. + +- Ultra-low-power with FlexPowerControl +- Core: ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU +- Radio: +- 2.4GHz + + - RF transceiver supporting: + + - Bluetooth |reg| 5.4 specification, + - IEEE 802.15.4-2011 PHY and MAC, + - Zigbee|reg| 3.0 + - RX sensitivity: + + - -96 dBm (Bluetooth |reg| Low Energy at 1 Mbps), + - -100 dBm (802.15.4) + + - Programmable output power up to +6 dBm with 1 dB steps + - Integrated balun to reduce BOM + - Support for 2 Mbps + - Support GATT caching + - Support EATT (enhanced ATT) + - Support advertising extension + - Accurate RSSI to enable power control + +- Clock Sources: + + - 32 MHz crystal oscillator with integrated + trimming capacitors (Radio and CPU clock) + - 32 kHz crystal oscillator for RTC (LSE) + - Internal low-power 32 kHz (±5%) RC (LSI1) + - Internal low-power 32 kHz (stability + ±500 ppm) RC (LSI2) + - Internal multispeed 100 kHz to 48 MHz + oscillator, auto-trimmed by LSE (better than + ±0.25% accuracy) + - High speed internal 16 MHz factory + trimmed RC (±1%) + - 2x PLL for system clock, USB, SAI, ADC + +More information about STM32WB55RG can be found here: + +- `STM32WB5MM-DK on www.st.com`_ +- `STM32WB5MMG datasheet`_ + +Supported Features +================== + +The Zephyr STM32WB5MM-DK board configuration supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ + + +Other hardware features are not yet supported on this Zephyr port. + +The default configuration can be found in the defconfig file: +``boards/arm/stm32wb5mm_dk/stm32wb5mm_dk_defconfig`` + +Bluetooth and compatibility with STM32WB Copro Wireless Binaries +================================================================ + +To operate bluetooth on STM32WB5MMG, Cortex-M0 core should be flashed with +a valid STM32WB Coprocessor binaries (either 'Full stack' or 'HCI Layer'). +These binaries are delivered in STM32WB Cube packages, under +Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/ +For compatibility information with the various versions of these binaries, +please check `modules/hal/stm32/lib/stm32wb/hci/README`_ +in the hal_stm32 repo. +Note that since STM32WB Cube package V1.13.2, "full stack" binaries are not compatible +anymore for a use in Zephyr and only "HCI Only" versions should be used on the M0 +side. + +Connections and IOs +=================== + + +Default Zephyr Peripheral Mapping: +---------------------------------- + +.. rst-class:: rst-columns + +- UART_1 TX/RX : PB7/PB6 ( Connected to ST-Link VCP) +- LPUART_1 TX/RX : PA3/PA2 +- USB : PA11/PA12 +- SWD : PA13/PA14 + +System Clock +------------ + +STM32WB5MMG System Clock could be driven by internal or external oscillator, +as well as main PLL clock. By default System clock is driven by HSE clock at 32MHz. + +Serial Port +----------- + +STM32WB5MM-DK board has 2 (LP)U(S)ARTs. The Zephyr console output is assigned to USART1. +Default settings are 115200 8N1. + + +Programming and Debugging +************************* + +Applications for the ``stm32wb5mm_dk`` board configuration can be built the +usual way (see :ref:`build_an_application`). + +Flashing +======== + +STM32WB5MM-DK has onboard ST-Link to flash and debug the firmware on the +module. + + +Flashing `hello_world` application to STM32WB5MM-DK +---------------------------------------------------- + +Connect the STM32WB5MM-DK to your host computer using the USB port (CN11). +Then build and flash an application. Here is an example for the ``hello_world`` +application. + +Run a serial host program to connect with your STM32WB5MM-DK board: + +.. code-block:: console + + $ minicom -D /dev/ttyACM0 + +Then first build and flash the application for the STM32WB5MM-DK board. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: stm32wb5mm_dk + :goals: build flash + +Reset the board and you should see the following messages on the console: + +.. code-block:: console + + Hello World! stm32w5mm_dk + +Debugging +========= + +You can debug an application in the usual way. Here is an example for the +`Hello_World`_ application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: stm32wb5mm_dk + :maybe-skip-config: + :goals: debug + +.. _STM32WB5MM-DK on www.st.com: + https://www.st.com/en/evaluation-tools/stm32wb5mm-dk.html +.. _STM32WB5MMG datasheet: + https://www.st.com/resource/en/datasheet/stm32wb5mmg.pdf +.. _modules/hal/stm32/lib/stm32wb/hci/README: + https://github.com/zephyrproject-rtos/hal_stm32/blob/main/lib/stm32wb/hci/README +.. _Hello_World: + https://docs.zephyrproject.org/latest/samples/hello_world/README.html diff --git a/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.dts b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.dts new file mode 100644 index 000000000000..4f4fb99cea01 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.dts @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Javad Rahimipetroudi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include + +/ { + model = "STMicroelectronics STM32WB5MM Discovery Development Kit"; + compatible = "st,stm32wb5mm-dk"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,bt-mon-uart = &lpuart1; + zephyr,bt-c2h-uart = &lpuart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + aliases { + watchdog0 = &iwdg; + die-temp0 = &die_temp; + volt-sensor0 = &vref; + volt-sensor1 = &vbat; + }; +}; + +&die_temp { + status = "okay"; +}; + +&clk_hse { + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&clk_hsi48 { + status = "okay"; +}; + +&clk48 { + /* Node is disabled by default as default source is HSI48 */ + /* To select another clock, enable the node */ + clocks = <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; +}; + +&rcc { + clocks = <&clk_hse>; + clock-frequency = ; + cpu1-prescaler = <1>; + cpu2-prescaler = <1>; + ahb4-prescaler = <1>; + apb1-prescaler = <1>; + apb2-prescaler = <1>; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + + +&lpuart1 { + pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>; + pinctrl-names = "default"; + current-speed = <100000>; + status = "okay"; +}; + +&adc1 { + pinctrl-0 = <&adc1_in3_pc2>; + pinctrl-names = "default"; + st,adc-clock-source = ; + st,adc-prescaler = <4>; + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + +zephyr_udc0: &usb { + status = "okay"; + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; +}; + +&aes1 { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* + * Configure partitions while leaving space for M0 BLE f/w + * Since STM32WBCube release V1.13.2, only _HCIOnly_ f/w are supported. + * These FW are expected to be located not before 0x080DB000 + * Current partition is using the first 876K of the flash for M4 + */ + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(48)>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000c000 DT_SIZE_K(400)>; + }; + slot1_partition: partition@70000 { + label = "image-1"; + reg = <0x00070000 DT_SIZE_K(400)>; + }; + scratch_partition: partition@d4000 { + label = "image-scratch"; + reg = <0x000d4000 DT_SIZE_K(16)>; + }; + storage_partition: partition@d8000 { + label = "storage"; + reg = <0x000d8000 DT_SIZE_K(8)>; + }; + + }; +}; + +&vref { + status = "okay"; +}; + +&vbat { + status = "okay"; +}; diff --git a/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.yaml b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.yaml new file mode 100644 index 000000000000..63c75d4473fb --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk.yaml @@ -0,0 +1,14 @@ +identifier: stm32wb5mm_dk +name: ST STM32WB5MM-DK Discovery Development Board +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 256 +flash: 1024 +supported: + - gpio + - uart +vendor: st diff --git a/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk_defconfig b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk_defconfig new file mode 100644 index 000000000000..9fdd732848ef --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/stm32wb5mm_dk_defconfig @@ -0,0 +1,24 @@ +CONFIG_SOC_SERIES_STM32WBX=y +CONFIG_SOC_STM32WB55XX=y + +# enable uart driver +CONFIG_SERIAL=y + +# enable GPIO +CONFIG_GPIO=y + +# enable clocks +CONFIG_CLOCK_CONTROL=y + +# console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y + +# enable pin controller +CONFIG_PINCTRL=y diff --git a/boards/arm/stm32wb5mm_dk/support/openocd.cfg b/boards/arm/stm32wb5mm_dk/support/openocd.cfg new file mode 100644 index 000000000000..2ad582703684 --- /dev/null +++ b/boards/arm/stm32wb5mm_dk/support/openocd.cfg @@ -0,0 +1,7 @@ +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32wbx.cfg] + +reset_config srst_only