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