1.. zephyr:board:: steval_stwinbx1
2
3Overview
4********
5
6The STWIN.box (STEVAL-STWINBX1) is a development kit that features an Arm|reg| Cortex|reg|-M33 based STM32U585AI MCU
7and is a reference design that simplifies prototyping and testing of advanced industrial sensing applications in
8IoT contexts such as condition monitoring and predictive maintenance.
9
10The STEVAL-STWINBX1 kit consists of an STWIN.box core system, a 480mAh LiPo battery, an adapter for the ST-LINK debugger,
11a plastic case, an adapter board for DIL 24 sensors and a flexible cable.
12
13More information about the board can be found at the `STEVAL-STWINBX1 Development kit website`_.
14
15
16Supported Features
17******************
18
19The STEVAL-STWINBX1 provides motion, environmental, and audio
20sensor data through either the built-in RS485 transceiver, BLE, Wi-Fi, and
21NFC or USB protocols to a host application running on a smartphone/PC to implement applications such as:
22
23- Multisensing wireless platform for vibration monitoring and ultrasound detection
24- Baby crying detection with Cloud AI learning
25- Barometer / environmental monitoring
26- Vehicle / goods tracking
27- Vibration monitoring
28- Compass and inclinometer
29- Sensor data logger
30
31(see `Sensing`_ section for the complete lists of available
32sensors on board)
33
34Hardware
35********
36
37The STM32U585xx devices are an ultra-low-power microcontrollers family (STM32U5
38Series) based on the high-performance Arm|reg| Cortex|reg|-M33 32-bit RISC core.
39They operate at a frequency of up to 160 MHz.
40
41- Ultra-low-power with FlexPowerControl (down to 300 nA Standby mode and 19.5 uA/MHz run mode)
42- Core: ARM |reg| 32-bit Cortex |reg| -M33 CPU with TrustZone |reg| and FPU.
43- Performance benchmark:
44
45  - 1.5 DMPIS/MHz (Drystone 2.1)
46  - 651 CoreMark |reg| (4.07 CoreMark |reg| /MHZ)
47
48- Security and cryptography
49
50  - Arm |reg|  TrustZone |reg| and securable I/Os memories and peripherals
51  - Flexible life cycle scheme with RDP (readout protection) and password protected debug
52  - Root of trust thanks to unique boot entry and secure hide protection area (HDP)
53  - Secure Firmware Installation thanks to embedded Root Secure Services
54  - Secure data storage with hardware unique key (HUK)
55  - Secure Firmware Update support with TF-M
56  - 2 AES coprocessors including one with DPA resistance
57  - Public key accelerator, DPA resistant
58  - On-the-fly decryption of Octo-SPI external memories
59  - HASH hardware accelerator
60  - Active tampers
61  - True Random Number Generator NIST SP800-90B compliant
62  - 96-bit unique ID
63  - 512-byte One-Time Programmable for user data
64  - Active tampers
65
66- Clock management:
67
68  - 4 to 50 MHz crystal oscillator
69  - 32 kHz crystal oscillator for RTC (LSE)
70  - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
71  - Internal low-power 32 kHz RC ( |plusminus| 5%)
72  - 2 internal multispeed 100 kHz to 48 MHz oscillators, including one auto-trimmed by
73    LSE (better than  |plusminus| 0.25 % accuracy)
74  - 3 PLLs for system clock, USB, audio, ADC
75  - Internal 48 MHz with clock recovery
76
77- Power management
78
79  - Embedded regulator (LDO)
80  - Embedded SMPS step-down converter supporting switch on-the-fly and voltage scaling
81
82- RTC with HW calendar and calibration
83- Up to 136 fast I/Os, most 5 V-tolerant, up to 14 I/Os with independent supply down to 1.08 V
84- Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors
85- Up to 17 timers and 2 watchdogs
86
87  - 2x 16-bit advanced motor-control
88  - 2x 32-bit and 5 x 16-bit general purpose
89  - 4x low-power 16-bit timers (available in Stop mode)
90  - 2x watchdogs
91  - 2x SysTick timer
92
93- ART accelerator
94
95  - 8-Kbyte instruction cache allowing 0-wait-state execution from Flash and
96    external memories: up to 160 MHz, MPU, 240 DMIPS and DSP
97  - 4-Kbyte data cache for external memories
98
99- Memories
100
101  - 2-Mbyte Flash memory with ECC, 2 banks read-while-write, including 512 Kbytes with 100 kcycles
102  - 786-Kbyte SRAM with ECC OFF or 722-Kbyte SRAM including up to 322-Kbyte SRAM with ECC ON
103  - External memory interface supporting SRAM, PSRAM, NOR, NAND and FRAM memories
104  - 2 Octo-SPI memory interfaces
105
106- Rich analog peripherals (independent supply)
107
108  - 14-bit ADC 2.5-Msps, resolution up to 16 bits with hardware oversampling
109  - 12-bit ADC 2.5-Msps, with hardware oversampling, autonomous in Stop 2 mode
110  - 12-bit DAC, low-power sample and hold
111  - 2 operational amplifiers with built-in PGA
112  - 2 ultra-low-power comparators
113
114- Up to 22 communication interfaces
115
116  - USB Type-C / USB power delivery controller
117  - USB OTG 2.0 full-speed controller
118  - 2x SAIs (serial audio interface)
119  - 4x I2C FM+(1 Mbit/s), SMBus/PMBus
120  - 6x USARTs (ISO 7816, LIN, IrDA, modem)
121  - 3x SPIs (5x SPIs with dual OCTOSPI in SPI mode)
122  - 1x FDCAN
123  - 2x SDMMC interface
124  - 16- and 4-channel DMA controllers, functional in Stop mode
125  - 1 multi-function digital filter (6 filters)+ 1 audio digital filter with
126    sound-activity detection
127
128- CRC calculation unit
129- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell |trade|
130- True Random Number Generator (RNG)
131
132- Graphic features
133
134  - Chrom-ART Accelerator (DMA2D) for enhanced graphic content creation
135  - 1 digital camera interface
136
137- Mathematical co-processor
138
139 - CORDIC for trigonometric functions acceleration
140 - FMAC (filter mathematical accelerator)
141
142
143More information about STM32U585AI can be found here:
144
145- `STM32U585 on www.st.com`_
146- `STM32U585 reference manual`_
147
148Connectivity
149************
150
151   - **BlueNRG-M2SA** Bluetooth|reg| low energy v5.2 wireless technology module
152     (`BlueNRG-M2 datasheet`_)
153   - **MXCHIP EMW3080** (802.11 b/g/n compliant Wi-Fi module)
154   - **ST25DV64K** dynamic NFC/RFID tag IC with 64-Kbit EEPROM
155     (`st25dv64k datasheet`_)
156   - USB Type-C|trade| connector (power supply and data)
157   - STDC14 programming connector for **STLINK-V3MINI**
158     (`stlink-v3mini`_)
159   - microSD card socket
160
161Sensing
162*******
163
164  - **ILPS22QS** MEMS pressure sensor
165    (`ilps22qs datasheet`_)
166  - **STTS22H** Digital temperature sensor
167    (`stts22hh datasheet`_)
168  - **TSV912** wide-bandwidth (8 MHz) rail-to-rail I/O op-amp
169    (`tsv912 datasheet`_)
170  - **ISM330DHCX** iNEMO IMU, 3D accelerometer and 3D gyroscope with Machine Learning Core and Finite State Machine
171    (`ism330dhcx datasheet`_)
172  - **IIS3DWB** wide bandwidth accelerometer
173    (`iis3dwb datasheet`_)
174  - **IIS2DLPC** high-performance ultra-low-power 3-axis accelerometer for industrial applications
175    (`iis2dlpc datasheet`_)
176  - **IIS2MDC** 3-axis magnetometer
177    (`iis2mdc datasheet`_)
178  - **IIS2ICLX** high-accuracy, high-resolution, low-power, 2-axis digital inclinometer with Machine Learning Core
179    (`iis2iclx datasheet`_)
180  - **IMP23ABSU** analog MEMS microphone
181    (`imp23absu datasheet`_)
182  - **IMP34DT05** digital MEMS microphone
183    (`imp34dt05 datasheet`_)
184
185Connections and IOs
186*******************
187
188- 2x user LEDs
189
190  - **led0** (Green)
191  - **led1** (Orange)
192
193- 4x buttons/switch
194
195  - **User** / **boot0** button, available to user application
196    but useful to let the SensorTile.box PRO enter DFU mode
197    if found pressed after h/w reset (see **rst** button and
198    `Programming and Debugging`_ section)
199  - **RESET** button, used to reset the board
200  - **PWR** button, used to Power on/off the board
201
202
203For more details please refer to `STEVAL-STWINBX1 board User Manual`_.
204
205System Clock
206------------
207
208STEVAL-STWINBX1 System Clock could be driven by an internal or external oscillator,
209as well as the main PLL clock. By default the System clock is driven by the PLL clock at 160MHz,
210driven by 16MHz high speed external oscillator.
211The internal AHB/APB1/APB2/APB3 AMBA buses are all clocked at 160MHz.
212
213Serial Port
214-----------
215
216The USART2 is connected to JTAG/SWD connector
217and may be used as console.
218
219USB interface
220-------------
221
222STEVAL-STWINBX1 can be connected as a USB device to a PC host through its USB-C connector.
223The final application may use it to declare STEVAL-STWINBX1 device as belonging to a
224certain standard or vendor class, e.g. a CDC, a mass storage or a composite device with both
225functions.
226
227Console
228-------
229
230There are two possible options for Zephyr console output:
231
232
233- through common CDC ACM UART backend configuration for all boards
234
235- through USART2 which is available on SWD connector (CN4). In this case a JTAG adapter
236  can be used to connect STEVAL-STWINBX1 and have both SWD and console lines available.
237
238  To enable console and shell over UART:
239
240  - in your prj.conf, override the board's default configuration by setting :code:`CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n`
241
242  - add an overlay file named ``<board>.overlay``:
243
244.. code-block:: dts
245
246   / {
247       chosen {
248          zephyr,console = &usart2;
249          zephyr,shell-uart = &usart2;
250        };
251     };
252
253
254Console default settings are 115200 8N1.
255
256Programming and Debugging
257-------------------------
258
259There are two alternative methods of flashing ST Sensortile.box Pro board:
260
2611. Using DFU software tools
262
263   This method requires to enter STM32U585 ROM bootloader DFU mode
264   by powering up (or reset) the board while keeping the USER (BOOT0) button pressed.
265   No additional hardware is required except a USB-C cable. This method is fully
266   supported by :ref:`flash-debug-host-tools`.
267   You can read more about how to enable and use the ROM bootloader by checking
268   the application note `AN2606`_ (STM32U585xx section).
269
2702. Using SWD hardware tools
271
272   The STEVAL-STWINBX1 does not include a on-board debug probe.
273   It requires to connect additional hardware, like a ST-LINK/V3
274   embedded debug tool, to the board STDC14 connector (CN4) labeled ``MCU-/SWD``.
275
276
277Install dfu-util
278----------------
279
280.. note::
281   Required only to use dfu-util runner.
282
283It is recommended to use at least v0.9 of dfu-util. The package available in
284Debian and Ubuntu can be quite old, so you might have to build dfu-util from source.
285Information about how to get the source code and how to build it can be found
286at the `DFU-UTIL website`_
287
288Install STM32CubeProgrammer
289---------------------------
290
291.. note::
292   Required to program over DFU (default) or SWD.
293
294It is recommended to use the latest version of `STM32CubeProgrammer`_
295
296
297Flash an Application to STEVAL-STWINBX1
298------------------------------------------
299
300There are two ways to enter DFU mode:
301
3021. USB-C cable not connected
303
304   While pressing the USER button, connect the USB-C cable to the USB OTG STEVAL-STWINBX1
305   port and to your computer.
306
3072. USB-C cable connected
308
309   While pressing the USER button, press the RESET button and release it.
310
311With both methods, the board should be forced to enter DFU mode.
312
313Check that the board is indeed in DFU mode:
314
315.. code-block:: console
316
317   $ sudo dfu-util -l
318   dfu-util 0.9
319
320   Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
321   Copyright 2010-2019 Tormod Volden and Stefan Schmidt
322   This program is Free Software and has ABSOLUTELY NO WARRANTY
323   Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
324
325   Found DFU: [0483:df11] ver=0200, devnum=58, cfg=1, intf=0, path="3-1", alt=2, name="@OTP Memory   /0x0BFA0000/01*512 e", serial="207136863530"
326   Found DFU: [0483:df11] ver=0200, devnum=58, cfg=1, intf=0, path="3-1", alt=1, name="@Option Bytes   /0x40022040/01*64 e", serial="207136863530"
327   Found DFU: [0483:df11] ver=0200, devnum=58, cfg=1, intf=0, path="3-1", alt=0, name="@Internal Flash   /0x08000000/256*08Kg", serial="207136863530"
328
329You should see the following confirmation on your Linux host:
330
331.. code-block:: console
332
333   $ dmesg
334   usb 3-1: new full-speed USB device number 16 using xhci_hcd
335   usb 3-1: New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
336   usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
337   usb 3-1: Product: DFU in FS Mode
338   usb 3-1: Manufacturer: STMicroelectronics
339   usb 3-1: SerialNumber: 207136863530
340
341You can build and flash the provided sample application
342(:zephyr:code-sample:`stwinbx1_sensors`) that reads sensors data and outputs
343values on the console.
344
345.. _STEVAL-STWINBX1 Development kit website:
346   https://www.st.com/en/evaluation-tools/steval-stwinbx1.html
347
348.. _STEVAL-STWINBX1 board User Manual:
349   https://www.st.com/resource/en/user_manual/um2965-getting-started-with-the-stevalstwinbx1-sensortile-wireless-industrial-node-development-kit-stmicroelectronics.pdf
350
351.. _STM32U585 on www.st.com:
352   https://www.st.com/en/microcontrollers-microprocessors/stm32u575-585.html
353
354.. _STM32U585 reference manual:
355   https://www.st.com/resource/en/reference_manual/rm0456-stm32u575585-armbased-32bit-mcus-stmicroelectronics.pdf
356
357.. _STM32CubeProgrammer:
358   https://www.st.com/en/development-tools/stm32cubeprog.html
359
360.. _DFU-UTIL website:
361   http://dfu-util.sourceforge.net/
362
363.. _AN2606:
364   http://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdf
365
366.. _BlueNRG-M2 datasheet:
367   https://www.st.com/en/product/BlueNRG-M2
368
369.. _st25dv64k datasheet:
370   https://www.st.com/en/nfc/st25dv64k.html
371
372.. _stlink-v3mini:
373   https://www.st.com/en/development-tools/stlink-v3mini.html
374
375.. _ilps22qs datasheet:
376   https://www.st.com/en/mems-and-sensors/ilps22qs.html
377
378.. _stts22hh datasheet:
379   https://www.st.com/en/mems-and-sensors/stts22h.html
380
381.. _tsv912 datasheet:
382   https://www.st.com/en/automotive-analog-and-power/tsv912.html
383
384.. _ism330dhcx datasheet:
385   https://www.st.com/en/mems-and-sensors/ism330dhcx.html
386
387.. _iis3dwb datasheet:
388   https://www.st.com/en/mems-and-sensors/iis3dwb.html
389
390.. _iis2dlpc datasheet:
391   https://www.st.com/en/mems-and-sensors/iis2dlpc.html
392
393.. _iis2mdc datasheet:
394   https://www.st.com/en/mems-and-sensors/iis2mdc.html
395
396.. _iis2iclx datasheet:
397   https://www.st.com/en/mems-and-sensors/iis2iclx.html
398
399.. _imp23absu datasheet:
400   https://www.st.com/en/mems-and-sensors/imp23absu.html
401
402.. _imp34dt05 datasheet:
403   https://www.st.com/en/mems-and-sensors/imp34dt05.html
404