1.. zephyr:board:: nucleo_h745zi_q
2
3Overview
4********
5
6The STM32 Nucleo-144 board provides an affordable and flexible way for users
7to try out new concepts and build prototypes by choosing from the various combinations
8of performance and power consumption features, provided by the STM32 microcontroller.
9For the compatible boards, the internal or external SMPS significantly reduces power
10consumption in Run mode.
11
12The ST Zio connector, which extends the ARDUINO® Uno V3 connectivity, and
13the ST morpho headers provide an easy means of expanding the functionality of the Nucleo
14open development platform with a wide choice of specialized shields.
15The STM32 Nucleo-144 board does not require any separate probe as it integrates
16the ST-LINK V3 debugger/programmer.
17
18The STM32 Nucleo-144 board comes with the STM32 comprehensive free software
19libraries and examples available with the STM32Cube MCU Package.
20
21Key Features
22
23- STM32 microcontroller in LQFP144 package
24- Ethernet compliant with IEEE-802.3-2002 (depending on STM32 support)
25- USB OTG or full-speed device (depending on STM32 support)
26- 3 user LEDs
27- 2 user and reset push-buttons
28- 32.768 kHz crystal oscillator
29- Board connectors:
30
31 - USB with Micro-AB
32 - Ethernet RJ45 (depending on STM32 support)
33 - SWDST Zio connector including Arduino* Uno V3ST
34 - ST morpho expansion
35
36- Flexible power-supply options: ST-LINK USB VBUS or external sources
37- External or internal SMPS to generate Vcore logic supply
38- On-board ST-LINK/V3 debugger/programmer with USB re-enumeration
39- capability: mass storage, virtual COM port and debug port
40- USB OTG full speed or device only
41- Comprehensive free software libraries and examples available with the
42  STM32Cube MCU package.
43- Arm* Mbed Enabled* compliant (only for some Nucleo part numbers)
44
45More information about the board can be found at the `Nucleo H745ZI-Q website`_.
46
47Hardware
48********
49
50Nucleo H745ZI-Q provides the following hardware components:
51
52- STM32H745ZI in LQFP144 package
53- ARM 32-bit Cortex-M7 CPU with FPU
54- ARM 32-bit Cortex-M4 CPU with FPU
55- Chrom-ART Accelerator
56- Hardware JPEG Codec
57- 480 MHz max CPU frequency
58- VDD from 1.62 V to 3.6 V
59- 2 MB Flash
60- 1 MB SRAM
61- High-resolution timer (2.1 ns)
62- 32-bit timers(2)
63- 16-bit timers(12)
64- SPI(6)
65- I2C(4)
66- I2S (3)
67- USART(4)
68- UART(4)
69- USB OTG Full Speed and High Speed(1)
70- USB OTG Full Speed(1)
71- CAN FD(2)
72- SAI(2)
73- SPDIF_Rx(4)
74- HDMI_CEC(1)
75- Dual Mode Quad SPI(1)
76- Camera Interface
77- GPIO (up to 114) with external interrupt capability
78- 16-bit ADC(3) with 36 channels / 3.6 MSPS
79- 12-bit DAC with 2 channels(2)
80- True Random Number Generator (RNG)
81- 16-channel DMA
82- LCD-TFT Controller with XGA resolution
83
84Supported Features
85==================
86
87.. zephyr:board-supported-hw::
88
89For more details please refer to `STM32 Nucleo-144 board User Manual`_.
90
91Default Zephyr Peripheral Mapping:
92----------------------------------
93
94The Nucleo H745ZI board features a ST Zio connector (extended Arduino Uno V3)
95and a ST morpho connector. Board is configured as follows:
96
97- UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com)
98- USER_PB : PC13
99- LD1 : PB0
100- LD2 : PE1
101- LD3 : PB14
102- I2C : PB8, PB9
103- SPI : PA5, PA6, PB5, PD14
104
105System Clock
106------------
107
108Nucleo H745ZI-Q System Clock could be driven by an internal or external
109oscillator, as well as the main PLL clock. By default, the System clock is
110driven by the PLL clock at 480MHz, driven by an 8MHz high-speed external clock.
111
112Serial Port
113-----------
114
115Nucleo H745ZI-Q board has 4 UARTs and 4 USARTs. The Zephyr console output is
116assigned to UART3. Default settings are 115200 8N1.
117
118Resources sharing
119-----------------
120
121The dual core nature of STM32H745 SoC requires sharing HW resources between the
122two cores. This is done in 3 ways:
123
124- **Compilation**: Clock configuration is only accessible to M7 core. M4 core only
125  has access to bus clock activation and deactivation.
126- **Static pre-compilation assignment**: Peripherals such as a UART are assigned in
127  devicetree before compilation. The user must ensure peripherals are not assigned
128  to both cores at the same time.
129- **Run time protection**: Interrupt-controller and GPIO configurations could be
130  accessed by both cores at run time. Accesses are protected by a hardware semaphore
131  to avoid potential concurrent access issues.
132
133Programming and Debugging
134*************************
135
136.. zephyr:board-supported-runners::
137
138Nucleo H745ZI-Q board includes an ST-LINK/V3 embedded debug tool interface.
139
140Applications for the ``nucleo_h745zi_q`` board should be built per core target,
141using either ``nucleo_h745zi_q/stm32h745xx/m7`` or ``nucleo_h745zi_q/stm32h745xx/m4``
142as the target (see :ref:`build_an_application` and :ref:`application_run` for more details).
143
144.. note::
145
146   Check if the board's ST-LINK V3 has the newest FW version. It can be updated
147   using `STM32CubeProgrammer`_.
148
149Flashing
150========
151
152Flashing operation will depend on the target to be flashed and the SoC
153option bytes configuration.
154
155The board is configured to be flashed using west `STM32CubeProgrammer`_ runner
156for both cores, so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
157The target core is detected automatically.
158
159Alternatively, OpenOCD or JLink can also be used to flash the board using
160the ``--runner`` (or ``-r``) option:
161
162.. code-block:: console
163
164   $ west flash --runner openocd
165   $ west flash --runner jlink
166
167It is advised to use `STM32CubeProgrammer`_ to check and update option bytes
168configuration.
169
170By default:
171
172  - CPU0 (Cortex-M7) boot address is set to 0x80000000 (OB: BOOT_CM7_ADD0)
173  - CPU1 (Cortex-M4) boot address is set to 0x81000000 (OB: BOOT_CM4_ADD0)
174
175Also, default out of the box board configuration enables CM7 and CM4 boot when
176board is powered (Option bytes BCM7 and BCM4 are checked).
177In that configuration, Kconfig boot option ``STM32H7_BOOT_CM4_CM7`` should be selected.
178Zephyr flash configuration has been set to meet these default settings.
179
180Flashing an application to STM32H745ZI M7 Core
181----------------------------------------------
182First, connect the NUCLEO-H745ZI-Q to your host computer using
183the USB port to prepare it for flashing. Then build and flash your application.
184
185Here is an example for the :zephyr:code-sample:`hello_world` application.
186
187Run a serial host program to connect with your NUCLEO-H745ZI-Q board.
188
189.. code-block:: console
190
191   $ minicom -b 115200 -D /dev/ttyACM0
192
193or use screen:
194
195.. code-block:: console
196
197   $ screen /dev/ttyACM0 115200
198
199Build and flash the application:
200
201.. zephyr-app-commands::
202   :zephyr-app: samples/hello_world
203   :board: nucleo_h745zi_q/stm32h745xx/m7
204   :goals: build flash
205
206You should see the following message on the console:
207
208.. code-block:: console
209
210   $ Hello World! nucleo_h745zi_q_m7
211
212.. note::
213  Sometimes, flashing is not working. It is necessary to erase the flash
214  (with STM32CubeProgrammer for example) to make it work again.
215
216Similarly, you can build and flash samples on the M4 target. For this, please
217take care of the resource sharing (UART port used for console for instance).
218
219Here is an example for the :zephyr:code-sample:`blinky` application on M4 core.
220
221.. zephyr-app-commands::
222   :zephyr-app: samples/basic/blinky
223   :board: nucleo_h745zi_q/stm32h745xx/m4
224   :goals: build flash
225
226.. note::
227
228   Flashing both M4 and M7 and pushing RESTART button on the board leads
229   to LD1 and LD2 flashing simultaneously.
230
231Debugging
232=========
233
234You can debug an application on Cortex M7 side in the usual way. Here is an example
235for the :zephyr:code-sample:`hello_world` application.
236
237.. zephyr-app-commands::
238   :zephyr-app: samples/hello_world
239   :board: nucleo_h745zi_q/stm32h745xx/m7
240   :maybe-skip-config:
241   :goals: debug
242
243Debugging a Zephyr application on Cortex M4 side with west is currently not available.
244As a workaround, you can use `STM32CubeIDE`_.
245
246.. _Nucleo H745ZI-Q website:
247   https://www.st.com/en/evaluation-tools/nucleo-h745zi-q.html
248
249.. _STM32 Nucleo-144 board User Manual:
250   https://www.st.com/resource/en/user_manual/dm00499171-stm32h7-nucleo144-boards-mb1363-stmicroelectronics.pdf
251
252.. _STM32H745ZI on www.st.com:
253   https://www.st.com/en/microcontrollers-microprocessors/stm32h745zi.html
254
255.. _STM32H745 reference manual:
256   https://www.st.com/resource/en/reference_manual/dm00176879-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
257
258.. _OpenOCD installing Debug Version:
259   https://github.com/zephyrproject-rtos/openocd
260
261.. _OpenOCD installing with ST-LINK V3 support:
262   https://mbd.kleier.net/integrating-st-link-v3.html
263
264.. _STM32CubeIDE:
265   https://www.st.com/en/development-tools/stm32cubeide.html
266
267.. _STM32CubeProgrammer:
268   https://www.st.com/en/development-tools/stm32cubeprog.html
269