1.. zephyr:board:: nucleo_h503rb
2
3Overview
4********
5
6The Nucleo-H503RB board features an ARM |reg| Cortex |reg|-M33 core-based
7STM32H503RBT6 microcontroller with a wide range of connectivity support and
8configurations.
9Here are some highlights of the Nucleo-H503RB board:
10
11- STM32H503RB microcontroller featuring 128 Kbytes of Flash memory and 32 Kbytes of
12  SRAM in LQFP64 package
13
14- Board connectors:
15
16  - User USB Type-C |reg|
17  - MIPI10 for debugging (SWD/JTAG)
18  - Arduino |reg| Uno V3 connectivity (CN5, CN6, CN8, CN9)
19  - ST morpho extension connector (CN7, CN10)
20
21- Flexible board power supply:
22
23  - ST-LINK USB VBUS
24  - user USB connector
25  - external sources
26
27- On-board ST-LINK/V3EC debugger/programmer:
28
29  - mass storage
30  - Virtual COM port
31  - debug port
32
33- One user LED shared with ARDUINO |reg| Uno V3
34- Two push-buttons: USER and RESET
35- 32.768 kHz crystal oscillator
36- 24 MHz HSE crystal oscillator
37
38More information about the board can be found at the `NUCLEO_H503RB website`_.
39
40.. image:: img/nucleo_h503rb.png
41   :align: center
42   :alt: NUCLEO-H503RB
43
44Hardware
45********
46
47The STM32H503xx devices are a high-performance microcontrollers family
48(STM32H5 series) based on the high-performance Arm |reg| Cortex |reg|-M33 32-bit
49RISC core. They operate at a frequency of up to 250 MHz.
50
51- Core: Arm |reg| Cortex |reg|-M33 CPU with FPU, MPU, 375 DMIPS (Dhrystone 2.1),
52  and DSP instructions
53- ART Accelerator
54
55- Memories
56
57  - 128 Kbytes of embedded flash memory with ECC, two banks of read-while-write
58  - 2-Kbyte OTP (one-time programmable)
59  - 32-Kbyte SRAM with ECC
60  - 2 Kbytes of backup SRAM (available in the lowest power modes)
61
62- Clock management
63
64  - Internal oscillators: 64 MHz HSI, 48 MHz HSI48, 4 MHz CSI, 32 kHz LSI
65  - Two PLLs for system clock, USB, audio, and ADC
66  - External oscillators: 4 to 50 MHz HSE, 32.768 kHz LSE
67
68- Embedded regulator (LDO)
69- Up to 49 fast I/Os (most 5 V tolerant), up to 9 I/Os with independent supply down to 1.08 V
70
71- Analog peripherals
72
73  - 1x 12-bit ADC with up to 2.5 MSPS
74  - 1x 12-bit dual-channel DAC
75  - 1x ultra-low-power comparator
76  - 1x operational amplifier (7 MHz bandwidth)
77
78- 1x Digital temperature sensor
79
80- Up to 11 timers
81  - 4x 16-bit
82  - 1x 32-bit
83  - 2x 16-bit low-power 16-bit timers (available in Stop mode)
84  - 2x watchdogs
85  - 1x SysTick timer
86  - RTC with HW calendar, alarms and calibration
87
88- Up to 16x communication interfaces
89
90  - Up to 2x I2Cs FM + interfaces (SMBus/PMBus |reg|)
91  - Up to 2x I3Cs shared with I2C
92  - Up to 3x USARTs (ISO7816 interface, LIN, IrDA, modem control)
93  - 1x LPUART
94  - Up to 3x SPIs including three muxed with full-duplex I2S
95  - Up to 3x additional SPI from 3x USART when configured in synchronous mode
96  - 1x FDCAN
97  - 1x USB 2.0 full-speed host and device
98
99- Two DMA controllers to offload the CPU
100
101- Security
102
103  - HASH (SHA-1, SHA-2), HMAC
104  - True random generator
105  - 96-bit unique ID
106  - Active tamper
107
108- Development support: serial wire debug (SWD) and JTAG interfaces
109
110More information about STM32H533RE can be found here:
111
112- `STM32H503rb on www.st.com`_
113- `STM32H503 reference manual`_
114
115Supported Features
116==================
117
118.. zephyr:board-supported-hw::
119
120Connections and IOs
121===================
122
123Nucleo-H503RB board has 8 GPIO controllers. These controllers are responsible for pin muxing,
124input/output, pull-up, etc.
125
126For more details please refer to `STM32H5 Nucleo-64 board User Manual`_.
127
128Default Zephyr Peripheral Mapping:
129----------------------------------
130
131- USART1 TX/RX : PB14/PB15 (Arduino USART1)
132- SPI1 SCK/MISO/MOSI/NSS: PA5/PA6/PA7/PC9
133- USART3 TX/RX : PA3/PA4 (VCP)
134- USER_PB : PC13
135- User LED (green): PA5
136
137System Clock
138------------
139
140Nucleo H533RE System Clock could be driven by internal or external oscillator,
141as well as main PLL clock. By default System clock is driven by PLL clock at
142240 MHz, driven by an 24 MHz high-speed external clock.
143
144Serial Port
145-----------
146
147Nucleo H533RE board has up to 3 U(S)ARTs. The Zephyr console output is assigned
148to USART3. Default settings are 115200 8N1.
149
150Backup SRAM
151-----------
152
153In order to test backup SRAM, you may want to disconnect VBAT from VDD_MCU.
154You can do it by removing ``SB38`` jumper on the back side of the board.
155VBAT can be provided via the left ST Morpho connector's pin 33.
156
157Programming and Debugging
158*************************
159
160Nucleo-H503RB board includes an ST-LINK/V3EC embedded debug tool interface.
161This probe allows to flash the board using various tools.
162
163Applications for the ``nucleo_h503rb`` board can be built and
164flashed in the usual way (see :ref:`build_an_application` and
165:ref:`application_run` for more details).
166
167OpenOCD Support
168===============
169
170For now, openocd support  for stm32h5 is not available on upstream OpenOCD.
171You can check `OpenOCD official Github mirror`_.
172In order to use it though, you should clone from the customized
173`STMicroelectronics OpenOCD Github`_ and compile it following usual README guidelines.
174Once it is done, you can set the OPENOCD and OPENOCD_DEFAULT_PATH variables in
175:zephyr_file:`boards/st/nucleo_h563zi/board.cmake` to point the build
176to the paths of the OpenOCD binary and its scripts,  before
177including the common openocd.board.cmake file:
178
179   .. code-block:: none
180
181      set(OPENOCD "<path_to_openocd_repo>/src/openocd" CACHE FILEPATH "" FORCE)
182      set(OPENOCD_DEFAULT_PATH <path_to_opneocd_repo>/tcl)
183      include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
184
185Flashing
186========
187
188The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
189so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
190
191Alternatively, OpencOCD or pyOCD can also be used to flash the board using
192the ``--runner`` (or ``-r``) option:
193
194.. code-block:: console
195
196   $ west flash --runner openocd
197   $ west flash --runner pyocd
198
199For pyOCD, additional target information needs to be installed
200which can be done by executing the following commands:
201
202.. code-block:: console
203
204   $ pyocd pack --update
205   $ pyocd pack --install stm32h5
206
207Flashing an application to Nucleo-H503RB
208----------------------------------------
209
210Connect the Nucleo-H503RB to your host computer using the USB port.
211Then build and flash an application. Here is an example for the
212:zephyr:code-sample:`hello_world` application.
213
214Run a serial host program to connect with your Nucleo board:
215
216.. code-block:: console
217
218   $ minicom -D /dev/ttyACM0
219
220Then build and flash the application.
221
222.. zephyr-app-commands::
223   :zephyr-app: samples/hello_world
224   :board: nucleo_h503rb
225   :goals: build flash
226
227You should see the following message on the console:
228
229.. code-block:: console
230
231   Hello World! nucleo_h503rb/stm32h503xx
232
233Debugging
234=========
235
236You can debug an application in the usual way. Here is an example for the
237:zephyr:code-sample:`blinky` application.
238
239.. zephyr-app-commands::
240   :zephyr-app: samples/basic/blinky
241   :board: nucleo_h503rb
242   :goals: debug
243
244.. _NUCLEO_H503RB website:
245   https://www.st.com/en/evaluation-tools/nucleo-h503rb
246
247.. _STM32H5 Nucleo-64 board User Manual:
248   https://www.st.com/resource/en/user_manual/um3121-stm32h5-nucleo64-board-mb1814-stmicroelectronics.pdf
249
250.. _STM32H503RB on www.st.com:
251   https://www.st.com/en/microcontrollers-microprocessors/stm32h503rb
252
253.. _STM32H503 reference manual:
254   https://www.st.com/resource/en/reference_manual/rm0492-stm32h503-line-armbased-32bit-mcus-stmicroelectronics.pdf
255
256.. _STM32CubeProgrammer:
257   https://www.st.com/en/development-tools/stm32cubeprog.html
258
259.. _OpenOCD official Github mirror:
260   https://github.com/openocd-org/openocd/
261
262.. _STMicroelectronics OpenOCD Github:
263   https://github.com/STMicroelectronics/OpenOCD/tree/openocd-cubeide-r6
264