1.. _stm32wb5mmg_bluetooth_module: 2 3ST STM32WB5MMG 4################ 5 6Overview 7******** 8 9STM32WB5MMG is an ultra-low-power and small form factor certified 2.4 GHz 10wireless module. It supports Bluetooth|reg| Low Energy 5.4, Zigbee|reg| 3.0, 11OpenThread, dynamic, and static concurrent modes, and 802.15.4 proprietary 12protocols. This board support is added in order to make it possible use this 13module on other boards as HCI layer (Specefically B-U585I-IOT02A Development board). 14 15STM32WB5MMG supports the following features: 16 17- Bluetooth module in SiP-LGA86 package 18- Integrated chip antenna 19- Bluetooth|reg| Low Energy 5.4, Zigbee|reg| 3.0, OpenThread certified 20 Dynamic and static concurrent modes 21- IEEE 802.15.4-2011 MAC PHY Supports 2 Mbits/s 22- Frequency band 2402-2480 MHz 23- Advertising extension 24- Tx output power up to +6 dBm 25- Rx sensitivity: -96 dBm (Bluetooth|reg| Low Energy at 1 Mbps), -100 dBm (802.15.4) 26- Range: up to 75 meters 27- Dedicated Arm|reg| Cortex|reg|-M0+ CPU for radio and security tasks 28- Dedicated Arm|reg| Cortex|reg|-M4 CPU with FPU and ART (adaptive real-time accelerator) up to 64 MHz speed 29- 1-Mbyte flash memory, 256-Kbyte SRAM 30- Fully integrated BOM, including 32 MHz radio and 32 kHz RTC crystals 31- Integrated SMPS 32- Ultra-low-power modes for battery longevity 33- 68 GPIOs 34- SWD, JTAG 35 36.. image:: img/STM32WB5MMG.jpg 37 :align: center 38 :alt: STM32WB5MMG 39 40More information about the board can be found at the `` `STM32WB5MMG on www.st.com`_. 41 42Hardware 43******** 44 45STM32WB5MMG is an ultra-low-power and small form factor certified 2.4 GHz 46wireless module. It supportsBluetooth|reg| Low Energy 5.4, Zigbee|reg| 3.0, OpenThread, 47dynamic, and static concurrent modes, and 802.15.4proprietary protocols. Based 48on the STMicroelectronics STM32WB55VGY wireless microcontroller,STM32WB5MMG 49provides best-in-class RF performance thanks to its high receiver sensitivity 50and output power signal. Its low-power features enable extended battery life, 51small coin-cell batteries, and energy harvesting. STM32WB5MMG revision Y is 52based on cut 2.1 of the STM32WB55VGY microcontroller. Revision X is based on 53cut 2.2. 54 55- Ultra-low-power with FlexPowerControl (down to 600 nA Standby mode with RTC and 32KB RAM) 56- Core: ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU, frequency up to 64 MHz 57- Radio: 58 59 - 2.4GHz 60 - RF transceiver supporting Bluetooth|reg| 5.4 61 specification, IEEE 802.15.4-2011 PHY 62 and MAC, supporting Thread 1.3 and 63 - Zigbee|reg| 3.0 64 - RX sensitivity: -96 dBm (Bluetooth |reg| Low 65 Energy at 1 Mbps), -100 dBm (802.15.4) 66 - Programmable output power up to +6 dBm 67 with 1 dB steps 68 - Integrated balun to reduce BOM 69 - Support for 2 Mbps 70 - Support GATT caching 71 - Support EATT (enhanced ATT) 72 - Support advertising extension 73 - Dedicated Arm|reg| 32-bit Cortex|reg| M0+ CPU 74 for real-time Radio layer 75 - Accurate RSSI to enable power control 76 - Suitable for systems requiring compliance 77 with radio frequency regulations ETSI EN 78 300 328, EN 300 440, FCC CFR47 Part 15 79 and ARIB STD-T66 80 81 82- Clock Sources: 83 84 - 32 MHz crystal oscillator with integrated 85 trimming capacitors (Radio and CPU clock) 86 - 32 kHz crystal oscillator for RTC (LSE) 87 - Internal low-power 32 kHz (±5%) RC (LSI1) 88 - Internal low-power 32 kHz (stability 89 ±500 ppm) RC (LSI2) 90 - Internal multispeed 100 kHz to 48 MHz 91 oscillator, auto-trimmed by LSE (better than 92 ±0.25% accuracy) 93 - High speed internal 16 MHz factory 94 trimmed RC (±1%) 95 - 2x PLL for system clock, USB, SAI, ADC 96 97- 2x DMA controllers (seven channels each) supporting ADC, SPI, I2C, USART, QSPI, SAI, AES, timers 98- 1x USART (ISO 7816, IrDA, SPI master, Modbus and Smartcard mode) 99- 1x LPUART (low power) 100- Two SPI running at 32 Mbit/s 101- 2x I2C (SMBus/PMBus) 102- 1x SAI (dual channel high quality audio) 103- 1x USB 2.0 FS device, crystal-less, BCD and LPM 104- 1x Touch sensing controller, up to 18 sensors 105- 1x LCD 8x40 with step-up converter 106- 1x 16-bit, four channels advanced timer 107- 2x 16-bit, two channels timers 108- 1x 32-bit, four channels timer 109- 2x 16-bit ultra-low-power timers 110- 1x independent Systick 111- 1x independent watchdog 112- 1x window watchdog 113- Up to 72 fast I/Os, 70 of them 5 V-tolerant 114 115- Memories 116 117 - Up to 1 MB flash memory with sector 118 protection (PCROP) against R/W 119 operations, enabling radio stack and 120 application 121 - Up to 256 KB SRAM, including 64 KB with 122 hardware parity check 123 - 20x 32-bit backup register 124 - Boot loader supporting USART, SPI, I2C 125 and USB interfaces 126 - OTA (over the air) Bluetooth® Low Energy 127 and 802.15.4 update 128 - Quad SPI memory interface with XIP 129 - 1 Kbyte (128 double words) OTP 130 131- 4x digital filters for sigma delta modulator 132- Rich analog peripherals (down to 1.62 V) 133 134- 12-bit ADC 4.26 Msps, up to 16-bit with 135 hardware oversampling, 200 μA/Msps 136- 2x ultra-low-power comparator 137- Accurate 2.5 V or 2.048 V reference 138 voltage buffered output 139 140 141- Security and ID 142 143 - Secure firmware installation (SFI) for 144 Bluetooth|reg| Low Energy and 802.15.4 SW stack 145 - 3x hardware encryption AES maximum 256-bit for 146 the application, the Bluetooth|reg| 147 - Low Energy and IEEE802.15.4 148 - Customer key storage/manager services 149 - HW public key authority (PKA) 150 - Cryptographic algorithms: RSA, Diffie-Helman, ECC over GF(p) 151 - True random number generator (RNG) 152 - Sector protection against R/W operation (PCROP) 153 - CRC calculation unit 154 - Die information: 96-bit unique ID 155 - IEEE 64-bit unique ID, possibility to derive 802.15.4 64-bit 156 and Bluetooth|reg| Low Energy 157 - 48-bit EUI 158 159More information about STM32WB55RG can be found here: 160 161- `STM32WB5MMG on www.st.com`_ 162- `STM32WB5MMG datasheet`_ 163 164Supported Features 165================== 166 167The Zephyr STM32WB5MMG board configuration supports the following hardware features: 168 169+-----------+------------+-------------------------------------+ 170| Interface | Controller | Driver/Component | 171+===========+============+=====================================+ 172| UART | on-chip | serial port-polling; | 173| | | serial port-interrupt | 174+-----------+------------+-------------------------------------+ 175| RADIO | on-chip | Bluetooth Low Energy | 176+-----------+------------+-------------------------------------+ 177 178 179Other hardware features are not yet supported on this Zephyr port. 180 181The default configuration can be found in the defconfig file: 182:zephyr_file:`boards/st/stm32wb5mmg/stm32wb5mmg_defconfig` 183 184Bluetooth and compatibility with STM32WB Copro Wireless Binaries 185================================================================ 186 187To operate bluetooth on STM32WB5MMG, Cortex-M0 core should be flashed with 188a valid STM32WB Coprocessor binaries (either 'Full stack' or 'HCI Layer'). 189These binaries are delivered in STM32WB Cube packages, under 190Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/ 191For compatibility information with the various versions of these binaries, 192please check `modules/hal/stm32/lib/stm32wb/hci/README`_ 193in the hal_stm32 repo. 194Note that since STM32WB Cube package V1.13.2, "full stack" binaries are not compatible 195anymore for a use in Zephyr and only "HCI Only" versions should be used on the M0 196side. 197 198Connections and IOs 199=================== 200 201 202Default Zephyr Peripheral Mapping: 203---------------------------------- 204 205.. rst-class:: rst-columns 206 207- UART_1 TX/RX : PB7/PB6 208- LPUART_1 TX/RX : PA3/PA2 209- USB : PA11/PA12 210- SWD : PA13/PA14 211 212System Clock 213------------ 214 215STM32WB5MMG System Clock could be driven by internal or external oscillator, 216as well as main PLL clock. By default System clock is driven by HSE clock at 32MHz. 217 218Serial Port 219----------- 220 221STM32WB5MMG board has 2 (LP)U(S)ARTs. LPUART1 is connected to the main U585I 222microcontroller that is used as HCI controller port. USART1 is not connected 223to any external pinout, so it is not possible to debug the module directly. 224Rather, users can use the available USB port (CN12) to run virtual com port 225(VCP) USB stack for the debugging. 226 227 228Programming and Debugging 229************************* 230 231Applications for the ``stm32wb5mmg`` board configuration can be built the 232usual way (see :ref:`build_an_application`). 233 234Flashing the module 235=================== 236 237The onboard ST-Link on the ``b_u585i_iot02a`` board can be used to flash the 238STM32WB5MMG module. To do this you should put SW4 on OFF and SW5 on ON mode. 239In this case the firmware will be uploaded on the STM32WB5MMG module. 240 241 242Flashing `hci_uart` application to STM32WB5MMG 243---------------------------------------------- 244 245Connect the B-U585I-IOT02A to your host computer using the USB port. Put 246the SW4 (MCU SWD) in OFF mode and SW5 (SWD BLE) in ON mode. Then build 247and flash an application. Here is an example for the 248:ref:`hci_uart <bluetooth-hci-uart-sample>` application. 249 250Run a serial host program to connect with your B-U585I-IOT02A board: 251 252.. code-block:: console 253 254 $ minicom -D /dev/ttyACM0 255 256Then build and flash the application for the STM32WB5MMG module. 257 258.. zephyr-app-commands:: 259 :zephyr-app: samples/bluetooth/hci_uart 260 :board: stm32wb5mmg 261 :goals: build flash 262 263Next, reverse back the buttons to default mode (SW4 on ON and SW5 264on OFF) mode. In this case we will upload the Bluetooth sample on the 265main microcontroller.Then, build the bluetooth 266:zephyr_file:`samples/bluetooth/observer` demo application for 267B-U585I-IOT02A board: 268 269.. zephyr-app-commands:: 270 :zephyr-app: samples/bluetooth/observer 271 :board: b_u585i_iot02a 272 :goals: build flash 273 274Rest the board and you should see the following messages on the console: 275 276.. code-block:: console 277 278 Starting Observer Demo 279 Started scanning... 280 Exiting main thread. 281 Device found: 2C:98:F3:64:58:06 (random) (RSSI -82), type 3, AD data len 31 282 Device found: CE:5B:9A:87:69:4F (random) (RSSI -80), type 3, AD data len 8 283 Device found: 7B:1E:DD:38:23:E1 (random) (RSSI -85), type 0, AD data len 17 284 285 286Debugging 287========= 288 289You can debug an application in the usual way. Here is an example for the 290:ref:`hci_uart <bluetooth-hci-uart-sample>` application. 291 292.. zephyr-app-commands:: 293 :zephyr-app: samples/bluetooth/observer 294 :board: b_u585i_iot02a 295 :maybe-skip-config: 296 :goals: debug 297 298.. _STM32WB5MMG on www.st.com: 299 https://www.st.com/en/microcontrollers-microprocessors/stm32wb5mmg.html 300 301.. _STM32WB5MMG datasheet: 302 https://www.st.com/resource/en/datasheet/stm32wb5mmg.pdf 303.. _modules/hal/stm32/lib/stm32wb/hci/README: 304 https://github.com/zephyrproject-rtos/hal_stm32/blob/main/lib/stm32wb/hci/README 305