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