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
87The Zephyr nucleo_h745zi_q board configuration supports the following hardware
88features:
89
90+-------------+------------+-------------------------------------+
91| Interface   | Controller | Driver/Component                    |
92+=============+============+=====================================+
93| NVIC        | on-chip    | nested vector interrupt controller  |
94+-------------+------------+-------------------------------------+
95| UART        | on-chip    | serial port                         |
96+-------------+------------+-------------------------------------+
97| PINMUX      | on-chip    | pinmux                              |
98+-------------+------------+-------------------------------------+
99| GPIO        | on-chip    | gpio                                |
100+-------------+------------+-------------------------------------+
101| RTC         | on-chip    | counter                             |
102+-------------+------------+-------------------------------------+
103| I2C         | on-chip    | i2c                                 |
104+-------------+------------+-------------------------------------+
105| PWM         | on-chip    | pwm                                 |
106+-------------+------------+-------------------------------------+
107| ETHERNET    | on-chip    | ethernet                            |
108+-------------+------------+-------------------------------------+
109| RNG         | on-chip    | True Random number generator        |
110+-------------+------------+-------------------------------------+
111| USB OTG FS  | on-chip    | USB device                          |
112+-------------+------------+-------------------------------------+
113| SPI         | on-chip    | spi                                 |
114+-------------+------------+-------------------------------------+
115| FDCAN       | on-chip    | CAN-FD Control Area Network         |
116+-------------+------------+-------------------------------------+
117
118Other hardware features are not yet supported on this Zephyr port.
119
120The default configuration per core can be found in the defconfig files:
121:zephyr_file:`boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7_defconfig` and
122:zephyr_file:`boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m4_defconfig`
123
124For more details please refer to `STM32 Nucleo-144 board User Manual`_.
125
126Default Zephyr Peripheral Mapping:
127----------------------------------
128
129The Nucleo H745ZI board features a ST Zio connector (extended Arduino Uno V3)
130and a ST morpho connector. Board is configured as follows:
131
132- UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com)
133- USER_PB : PC13
134- LD1 : PB0
135- LD2 : PE1
136- LD3 : PB14
137- I2C : PB8, PB9
138- SPI : PA5, PA6, PB5, PD14
139
140System Clock
141------------
142
143Nucleo H745ZI-Q System Clock could be driven by an internal or external
144oscillator, as well as the main PLL clock. By default, the System clock is
145driven by the PLL clock at 480MHz, driven by an 8MHz high-speed external clock.
146
147Serial Port
148-----------
149
150Nucleo H745ZI-Q board has 4 UARTs and 4 USARTs. The Zephyr console output is
151assigned to UART3. Default settings are 115200 8N1.
152
153Resources sharing
154-----------------
155
156The dual core nature of STM32H745 SoC requires sharing HW resources between the
157two cores. This is done in 3 ways:
158
159- **Compilation**: Clock configuration is only accessible to M7 core. M4 core only
160  has access to bus clock activation and deactivation.
161- **Static pre-compilation assignment**: Peripherals such as a UART are assigned in
162  devicetree before compilation. The user must ensure peripherals are not assigned
163  to both cores at the same time.
164- **Run time protection**: Interrupt-controller and GPIO configurations could be
165  accessed by both cores at run time. Accesses are protected by a hardware semaphore
166  to avoid potential concurrent access issues.
167
168Programming and Debugging
169*************************
170
171Nucleo H745ZI-Q board includes an ST-LINK/V3 embedded debug tool interface.
172
173Applications for the ``nucleo_h745zi_q`` board should be built per core target,
174using either ``nucleo_h745zi_q/stm32h745xx/m7`` or ``nucleo_h745zi_q/stm32h745xx/m4``
175as the target (see :ref:`build_an_application` and :ref:`application_run` for more details).
176
177.. note::
178
179   Check if the board's ST-LINK V3 has the newest FW version. It can be updated
180   using `STM32CubeProgrammer`_.
181
182Flashing
183========
184
185Flashing operation will depend on the target to be flashed and the SoC
186option bytes configuration.
187
188The board is configured to be flashed using west `STM32CubeProgrammer`_ runner
189for both cores, so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
190The target core is detected automatically.
191
192Alternatively, OpenOCD or JLink can also be used to flash the board using
193the ``--runner`` (or ``-r``) option:
194
195.. code-block:: console
196
197   $ west flash --runner openocd
198   $ west flash --runner jlink
199
200It is advised to use `STM32CubeProgrammer`_ to check and update option bytes
201configuration.
202
203By default:
204
205  - CPU0 (Cortex-M7) boot address is set to 0x80000000 (OB: BOOT_CM7_ADD0)
206  - CPU1 (Cortex-M4) boot address is set to 0x81000000 (OB: BOOT_CM4_ADD0)
207
208Also, default out of the box board configuration enables CM7 and CM4 boot when
209board is powered (Option bytes BCM7 and BCM4 are checked).
210In that configuration, Kconfig boot option ``STM32H7_BOOT_CM4_CM7`` should be selected.
211Zephyr flash configuration has been set to meet these default settings.
212
213Flashing an application to STM32H745ZI M7 Core
214----------------------------------------------
215First, connect the NUCLEO-H745ZI-Q to your host computer using
216the USB port to prepare it for flashing. Then build and flash your application.
217
218Here is an example for the :zephyr:code-sample:`hello_world` application.
219
220Run a serial host program to connect with your NUCLEO-H745ZI-Q board.
221
222.. code-block:: console
223
224   $ minicom -b 115200 -D /dev/ttyACM0
225
226or use screen:
227
228.. code-block:: console
229
230   $ screen /dev/ttyACM0 115200
231
232Build and flash the application:
233
234.. zephyr-app-commands::
235   :zephyr-app: samples/hello_world
236   :board: nucleo_h745zi_q/stm32h745xx/m7
237   :goals: build flash
238
239You should see the following message on the console:
240
241.. code-block:: console
242
243   $ Hello World! nucleo_h745zi_q_m7
244
245.. note::
246  Sometimes, flashing is not working. It is necessary to erase the flash
247  (with STM32CubeProgrammer for example) to make it work again.
248
249Similarly, you can build and flash samples on the M4 target. For this, please
250take care of the resource sharing (UART port used for console for instance).
251
252Here is an example for the :zephyr:code-sample:`blinky` application on M4 core.
253
254.. zephyr-app-commands::
255   :zephyr-app: samples/basic/blinky
256   :board: nucleo_h745zi_q/stm32h745xx/m4
257   :goals: build flash
258
259.. note::
260
261   Flashing both M4 and M7 and pushing RESTART button on the board leads
262   to LD1 and LD2 flashing simultaneously.
263
264Debugging
265=========
266
267You can debug an application on Cortex M7 side in the usual way. Here is an example
268for the :zephyr:code-sample:`hello_world` application.
269
270.. zephyr-app-commands::
271   :zephyr-app: samples/hello_world
272   :board: nucleo_h745zi_q/stm32h745xx/m7
273   :maybe-skip-config:
274   :goals: debug
275
276Debugging a Zephyr application on Cortex M4 side with west is currently not available.
277As a workaround, you can use `STM32CubeIDE`_.
278
279.. _Nucleo H745ZI-Q website:
280   https://www.st.com/en/evaluation-tools/nucleo-h745zi-q.html
281
282.. _STM32 Nucleo-144 board User Manual:
283   https://www.st.com/resource/en/user_manual/dm00499171-stm32h7-nucleo144-boards-mb1363-stmicroelectronics.pdf
284
285.. _STM32H745ZI on www.st.com:
286   https://www.st.com/en/microcontrollers-microprocessors/stm32h745zi.html
287
288.. _STM32H745 reference manual:
289   https://www.st.com/resource/en/reference_manual/dm00176879-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
290
291.. _OpenOCD installing Debug Version:
292   https://github.com/zephyrproject-rtos/openocd
293
294.. _OpenOCD installing with ST-LINK V3 support:
295   https://mbd.kleier.net/integrating-st-link-v3.html
296
297.. _STM32CubeIDE:
298   https://www.st.com/en/development-tools/stm32cubeide.html
299
300.. _STM32CubeProgrammer:
301   https://www.st.com/en/development-tools/stm32cubeprog.html
302