1.. zephyr:board:: nucleo_u031r8
2
3Overview
4********
5
6The Nucleo U031R8 board, featuring an ARM Cortex-M0+ based STM32U031R8 MCU,
7provides an affordable and flexible way for users to try out new concepts and
8build prototypes by choosing from the various combinations of performance and
9power consumption features. Here are some highlights of the Nucleo U031R8
10board:
11
12
13- STM32U031R8 microcontroller in LQFP48 package
14- Two types of extension resources:
15
16  - Arduino Uno V3 connectivity
17  - ST morpho extension pin headers for full access to all STM32U0 I/Os
18
19- On-board STLINK-V2EC debugger/programmer with USB re-enumeration
20  capability: mass storage, Virtual COM port, and debug port
21- Flexible board power supply:
22
23  - USB VBUS or external source(3.3V, 5V, 7 - 12V)
24
25- User LED shared with ARDUINO |reg| Uno V3
26- Two push-buttons: USER and RESET
27- USB Type-C |reg| connector for the ST-LINK
28
29More information about the board can be found at the `NUCLEO_U031R8 website`_.
30
31Hardware
32********
33
34The STM32U031x4/6/8 devices are an ultra-low-power microcontrollers family (STM32U0
35Series) based on the high-performance Arm |reg| Cortex |reg|-M0+ 32-bit RISC core.
36They operate at a frequency of up to 56 MHz.
37
38- Includes ST state-of-the-art patented technology
39- Ultra-low-power with FlexPowerControl:
40
41  - 1.71 V to 3.6 V power supply
42  - -40 °C to +85/125 °C temperature range
43  - 130 nA VBAT mode: supply for RTC, 9 x 32-bit backup registers
44  - 16 nA Shutdown mode (4 wake-up pins)
45  - 30 nA Standby mode (6 wake-up pins) without RTC
46  - 160 nA Standby mode with RTC
47  - 630 nA Stop 2 mode with RTC
48  - 515 nA Stop 2 mode without RTC
49  - 4 µA wake-up from Stop mode
50  - 52 µA/MHz Run mode
51  - Brownout reset
52
53- Core:
54
55  - 32-bit Arm |reg| Cortex |reg|-M0+ CPU, frequency up to 56 MHz
56
57- ART Accelerator:
58
59  - 1-Kbyte instruction cache allowing 0-wait-state execution from flash memory
60
61- Benchmarks:
62
63  - 1.13 DMIPS/MHz (Drystone 2.1)
64  - 134 CoreMark |reg| (2.4 CoreMark/MHz at 56 MHz)
65  - 430 ULPMark™-CP
66  - 167 ULPMark™-PP
67  - 20.3 ULPMark™-CM
68
69- Memories:
70
71  - 64-Kbyte single bank flash memory, proprietary code readout protection
72  - 12-Kbyte SRAM with hardware parity check
73
74- General-purpose input/outputs:
75
76  - Up to 53 fast I/Os, most of them 5 V‑tolerant
77
78- Clock management:
79
80  - 4 to 48 MHz crystal oscillator
81  - 32 kHz crystal oscillator for RTC (LSE)
82  - Internal 16 MHz factory-trimmed RC (±1%)
83  - Internal low-power 32 kHz RC (±5%)
84  - Internal multispeed 100 kHz to 48 MHz oscillator,
85    auto-trimmed by LSE (better than ±0.25 % accuracy)
86  - PLL for system clock, ADC
87
88- Security:
89
90  - Customer code protection
91  - Robust read out protection (RDP): 3 protection level states
92    and password-based regression (128-bit PSWD)
93  - Hardware protection feature (HDP)
94  - Secure boot
95  - True random number generation, candidate for NIST SP 800-90B certification
96  - Candidate for Arm |reg| PSA level 1 and SESIP level 3 certifications
97  - 5 passive anti-tamper pins
98  - 96-bit unique ID
99
100- Up to 9 timers, RTC, and 2 watchdogs :
101
102  - 1x 16-bit advanced motor-control, 1x 32-bit and 3x 16-bit general purpose,
103    2x 16-bit basic, 2x low-power 16-bit timers (available in Stop mode),
104    2x watchdogs, SysTick timer
105  - RTC with hardware calendar, alarms and calibration
106
107- Up to 16 communication peripherals:
108
109  - 6x USARTs/LPUARTs (SPI, ISO 7816, LIN, IrDA, modem)
110  - 3x I2C interfaces supporting Fast-mode and Fast-mode Plus (up to 1 Mbit/s)
111  - 2x SPIs, plus 4x USARTs in SPI mode
112  - IRTIM (Infrared interface)
113
114- Rich analog peripherals (independent supply):
115
116  - 1x 12-bit ADC (0.4 µs conversion time), up to 16-bit with hardware oversampling
117  - 1x 12-bit DAC output channel, low-power sample and hold
118  - 1x general-purpose operational amplifier with built-in PGA (variable gain up to 16)
119  - 1x ultra-low-power comparator
120
121- ECOPACK2 compliant packages
122
123More information about STM32U031R8 can be found here:
124
125- `STM32U031R8 on www.st.com`_
126- `STM32U031R8 reference manual`_
127
128Supported Features
129==================
130
131The Zephyr _nucleo_u031r8_ board configuration supports the following hardware features:
132
133+-----------+------------+-------------------------------------+
134| Interface | Controller | Driver/Component                    |
135+===========+============+=====================================+
136| CLOCK     | on-chip    | reset and clock control             |
137+-----------+------------+-------------------------------------+
138| GPIO      | on-chip    | gpio                                |
139+-----------+------------+-------------------------------------+
140| NVIC      | on-chip    | nested vector interrupt controller  |
141+-----------+------------+-------------------------------------+
142| ADC       | on-chip    | adc                                 |
143+-----------+------------+-------------------------------------+
144| DAC       | on-chip    | DAC Controller                      |
145+-----------+------------+-------------------------------------+
146| I2C       | on-chip    | i2c                                 |
147+-----------+------------+-------------------------------------+
148| PWM       | on-chip    | pwm                                 |
149+-----------+------------+-------------------------------------+
150
151
152Other hardware features are not yet supported on this Zephyr port.
153
154The default configuration can be found in the defconfig file:
155:zephyr_file:`boards/st/nucleo_u031r8/nucleo_u031r8_defconfig`
156
157
158Connections and IOs
159===================
160
161Nucleo U031R8 Board has 10 GPIO controllers. These controllers are responsible
162for pin muxing, input/output, pull-up, etc.
163
164For more details please refer to `STM32U031 User Manual`_.
165
166Default Zephyr Peripheral Mapping:
167----------------------------------
168
169- DAC1_OUT1 : PA4
170- LD1 : PA5
171- UART_1_TX : PA9
172- UART_1_RX : PA10
173- UART_2_TX : PA2
174- UART_2_RX : PA3
175- USER_PB : PC13
176
177System Clock
178------------
179
180Nucleo U031R8 System Clock could be driven by internal or external oscillator,
181as well as main PLL clock. By default System clock is driven by PLL clock at
18248MHz, driven by 4MHz medium speed internal oscillator.
183
184Serial Port
185-----------
186
187Nucleo U031R8 board has 4 U(S)ARTs. The Zephyr console output is assigned to
188USART2. Default settings are 115200 8N1.
189
190
191Programming and Debugging
192*************************
193
194Nucleo U031R8 board includes an ST-LINK/V3 embedded debug tool interface.
195This probe allows to flash the board using various tools.
196
197Flashing
198========
199
200The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
201so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
202
203Alternatively, JLink or pyOCD can also be used to flash the board using
204the ``--runner`` (or ``-r``) option:
205
206.. code-block:: console
207
208   $ west flash --runner pyocd
209   $ west flash --runner jlink
210
211For pyOCD, additional target information needs to be installed
212by executing the following pyOCD commands:
213
214.. code-block:: console
215
216   $ pyocd pack --update
217   $ pyocd pack --install stm32u0
218
219
220Flashing an application to Nucleo U031R8
221------------------------------------------
222
223Connect the Nucleo U031R8 to your host computer using the USB port.
224Then build and flash an application. Here is an example for the
225:zephyr:code-sample:`hello_world` application.
226
227Run a serial host program to connect with your Nucleo board:
228
229.. code-block:: console
230
231   $ minicom -D /dev/ttyACM0
232
233Then build and flash the application.
234
235.. zephyr-app-commands::
236   :zephyr-app: samples/hello_world
237   :board: nucleo_u031r8
238   :goals: build flash
239
240You should see the following message on the console:
241
242.. code-block:: console
243
244   Hello World! nucleo_u031r8
245
246Debugging
247=========
248
249Default flasher for this board is openocd. It could be used in the usual way.
250Here is an example for the :zephyr:code-sample:`blinky` application.
251
252.. zephyr-app-commands::
253   :zephyr-app: samples/basic/blinky
254   :board: nucleo_u031r8
255   :goals: debug
256
257Note: Check the ``build/tfm`` directory to ensure that the commands required by these scripts
258(``readlink``, etc.) are available on your system. Please also check ``STM32_Programmer_CLI``
259(which is used for initialization) is available in the PATH.
260
261.. _NUCLEO_U031R8 website:
262  https://www.st.com/en/evaluation-tools/nucleo-u031r8.html
263
264.. _STM32U031 User Manual:
265   https://www.st.com/resource/en/user_manual/um3261-stm32u0-series-safety-manual-stmicroelectronics.pdf
266
267.. _STM32U031R8 on www.st.com:
268   https://www.st.com/en/microcontrollers-microprocessors/stm32u031r8
269
270.. _STM32U031R8 reference manual:
271   https://www.st.com/resource/en/reference_manual/rm0503-stm32u0-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
272
273.. _STM32CubeProgrammer:
274   https://www.st.com/en/development-tools/stm32cubeprog.html
275