1.. _stm32h745i_disco_board:
2
3ST STM32H745I Discovery
4#######################
5
6Overview
7********
8
9The STM32H745I-DISCO Discovery kit is a complete demonstration and development
10platform for STMicroelectronics Arm |reg| Cortex |reg|‑M7 and Cortex |reg|‑M4 core-based STM32H745XI microcontroller.
11
12The full range of hardware features available on the board helps users enhance their application
13development by an evaluation of almost all peripherals (such as USB OTG FS, Ethernet 10/100Mb/s,
14eMMC, USART, SAI audio DAC stereo with audio jack input and output, MEMS digital microphone, SDRAM,
15Quad-SPI flash memory, and RGB interface LCD with capacitive multi-touch panel). ARDUINO |reg| Uno V3
16connectors provide easy connection to extension shields or daughterboards for specific applications.
17
18STLINK-V3E is integrated into the board, as an embedded in-circuit debugger and programmer for the
19STM32 MCU and the USB Virtual COM port bridge
20
21Key Features
22
23- Arm |reg| Cortex |reg| core-based microcontroller with 2 Mbytes of flash memory and 1 Mbyte of RAM, in a TFBGA240+25 package
24- 4.3” RGB interface LCD with touch panel connector
25- Ethernet compliant with IEEE-802.3-2002, and PoE
26- USB OTG FS
27- SAI audio codec
28- One ST-MEMS digital microphone
29- 2× 512-Mbit Quad-SPI NOR flash memory
30- 128-Mbit SDRAM
31- 4-Gbyte on-board eMMC
32- 1 user and reset push-button
33- Fanout daughterboard
34- 2× CAN FDs
35- Board connectors:
36
37 - USB FS Micro-AB connectors
38 - ST-LINK Micro-B USB connector
39 - USB power Micro-B connector
40 - Ethernet RJ45
41 - Stereo headset jack including analog microphone input
42 - Audio header for external speakers
43 - Tag‑Connect |trade| (TAG) 10-pin footprint
44 - Arm |reg| Cortex |reg| 10-pin 1.27 mm pitch debug connector over STDC14 footprint
45 - ARDUINO |reg| Uno V3 expansion connectors
46 - STMod+
47
48- Flexible power-supply options:
49
50 - STLINK-V3E USB connector, USB FS connector
51 - 5 V delivered by RJ45 (Power over Ethernet)
52 - 5 V delivered by ARDUINO |reg| or external connector
53 - USB charger
54 - USB power
55
56.. image:: img/stm32h745i-disco.jpg
57   :align: center
58   :alt: STM32H745I-DISCO
59
60More information about the board can be found at the `STM32H745I-DISCO website`_.
61More information about STM32H747XIH6 can be found here:
62
63- `STM32H745XI on www.st.com`_
64- `STM32H745xx reference manual`_
65- `STM32H745xx datasheet`_
66
67Supported Features
68==================
69
70The current Zephyr stm32h745i_disco board configuration supports the following hardware features:
71
72+-----------+------------+-------------------------------------+
73| Interface | Controller | Driver/Component                    |
74+===========+============+=====================================+
75| NVIC      | on-chip    | nested vector interrupt controller  |
76+-----------+------------+-------------------------------------+
77| UART      | on-chip    | serial port                         |
78+-----------+------------+-------------------------------------+
79| PINMUX    | on-chip    | pinmux                              |
80+-----------+------------+-------------------------------------+
81| GPIO      | on-chip    | gpio                                |
82+-----------+------------+-------------------------------------+
83| RTC       | on-chip    | counter                             |
84+-----------+------------+-------------------------------------+
85| I2C       | on-chip    | i2c                                 |
86+-----------+------------+-------------------------------------+
87| PWM       | on-chip    | pwm                                 |
88+-----------+------------+-------------------------------------+
89| ETHERNET  | on-chip    | ethernet                            |
90+-----------+------------+-------------------------------------+
91| SPI       | on-chip    | spi                                 |
92+-----------+------------+-------------------------------------+
93| QSPI NOR  | on-chip    | off-chip flash                      |
94+-----------+------------+-------------------------------------+
95| FDCAN     | on-chip    | fdcan                               |
96+-----------+------------+-------------------------------------+
97| FMC       | on-chip    | memc (SDRAM)                        |
98+-----------+------------+-------------------------------------+
99| RTC       | on-chip    | rtc                                 |
100+-----------+------------+-------------------------------------+
101
102Other hardware features are not yet supported on this Zephyr port.
103
104The default configuration per core can be found in the defconfig files:
105:zephyr_file:`boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7_defconfig` and
106:zephyr_file:`boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m4_defconfig`
107
108For more details please refer to `STM32H745-Disco UM`_.
109
110Default Zephyr Peripheral Mapping:
111----------------------------------
112
113- USART_3 TX/RX : PB10/PB11 (ST-Link Virtual Port Com)
114- USART_1 TX/RX : PB6/PB7 (Arduino Serial)
115- SPI_2 NSS/SCK/MISO/MOSI : PB4/PD3/PI2/PB15 (Arduino SPI)
116- I2C_4 SCL/SDA: PD12, PD13 (Arduino I2C)
117- USER_PB : PC13
118- LD1 : PI13
119- LD2 : PJ2
120- LD3 : PD3
121
122System Clock
123------------
124
125STM32H745I-DISCO System Clock could be driven by an internal or external
126oscillator, as well as the main PLL clock. By default, the System clock is
127driven by the PLL clock at 480MHz, driven by an 25MHz high-speed external clock.
128
129Serial Port
130-----------
131
132STM32H745I-DISCO board has 4 UARTs and 4 USARTs. The Zephyr console output is
133assigned to UART3. Default settings are 115200 8N1.
134
135Resources sharing
136-----------------
137
138The dual core nature of STM32H745 SoC requires sharing HW resources between the
139two cores. This is done in 3 ways:
140
141- **Compilation**: Clock configuration is only accessible to M7 core. M4 core only
142  has access to bus clock activation and deactivation.
143- **Static pre-compilation assignment**: Peripherals such as a UART are assigned in
144  devicetree before compilation. The user must ensure peripherals are not assigned
145  to both cores at the same time.
146- **Run time protection**: Interrupt-controller and GPIO configurations could be
147  accessed by both cores at run time. Accesses are protected by a hardware semaphore
148  to avoid potential concurrent access issues.
149
150Programming and Debugging
151*************************
152
153Applications for the ``stm32h745i_disco`` board should be built per core target,
154using either ``stm32h745i_disco/stm32h745xx/m7`` or ``stm32h745i_disco/stm32h745xx/m4`` as the target
155(see :ref:`build_an_application` and :ref:`application_run` for more details).
156
157.. note::
158
159   Check if the on-board ST-LINK V3 has the latest firmware version. It can be done with either `STM32CubeIDE`_ or `STM32CubeProgrammer`_
160
161Flashing
162========
163
164STM32H745I-DISCO board includes an ST-LINK/V3 embedded debug tool interface.
165
166Flashing operation will depend on the target and the SoC
167option bytes configuration.
168
169By default:
170
171  - CPU0 (Cortex-M7) boot address is set to 0x80000000 (OB: BOOT_CM7_ADD0)
172  - CPU1 (Cortex-M4) boot address is set to 0x81000000 (OB: BOOT_CM4_ADD0)
173
174Also, the out of the box default board configuration enables CM7 and CM4 boot when
175board is powered (Option bytes BCM7 and BCM4 are checked).
176In that configuration, Kconfig boot option ``STM32H7_BOOT_CM4_CM7`` should be selected.
177Zephyr flash configuration has been set to meet these default settings.
178
179Alternatively, west `STM32CubeProgrammer`_ runner can be used, after installing
180it, to flash applications for both cores. The target core is detected automatically.
181
182.. code-block:: console
183
184   $ west flash --runner stm32cubeprogrammer
185
186Flashing an application to STM32H745XI M7 Core
187----------------------------------------------
188First, connect the STM32H745I-DISCO to your host computer using
189the USB port to prepare it for flashing. Then build and flash your application.
190
191Here is an example for the :ref:`hello_world` application.
192
193Run a serial host program to connect with your STM32H745I-DISCO board.
194
195.. code-block:: console
196
197   $ minicom -b 115200 -D /dev/ttyACM0
198
199or use screen:
200
201.. code-block:: console
202
203   $ screen /dev/ttyACM0 115200
204
205Build and flash the application:
206
207.. zephyr-app-commands::
208   :zephyr-app: samples/hello_world
209   :board: stm32h745i_disco/stm32h745xx/m7
210   :goals: build flash
211
212You should see the following message on the console:
213
214.. code-block:: console
215
216   $ Hello World! stm32h745i_disco
217
218.. note::
219  Sometimes, flashing does not work properly. It is necessary to erase the flash
220  (with STM32CubeProgrammer for example) to make it work again.
221
222Similarly, you can build and flash samples on the M4 target. For this, please
223take care of the resource sharing (UART port used for console for instance).
224
225Here is an example for the :zephyr:code-sample:`blinky` application on M4 core.
226
227.. zephyr-app-commands::
228   :zephyr-app: samples/basic/blinky
229   :board: stm32h745i_disco/stm32h745xx/m7
230   :goals: build flash
231
232.. note::
233
234   Flashing both M4 and M7 and pushing RESTART button on the board leads
235   to LD1 and LD2 flashing simultaneously.
236
237Debugging
238=========
239
240You can debug an application in the usual way.  Here is an example for the
241:ref:`hello_world` application.
242
243.. zephyr-app-commands::
244   :zephyr-app: samples/hello_world
245   :board: stm32h745i_disco/stm32h745xx/m7
246   :maybe-skip-config:
247   :goals: debug
248
249Debugging with west is currently not available on Cortex M4 side.
250In order to debug a Zephyr application on Cortex M4 side, you can use
251`STM32CubeIDE`_.
252
253.. _STM32H745I-DISCO website:
254   https://www.st.com/en/evaluation-tools/stm32h745i-disco.html
255
256.. _STM32H745XI on www.st.com:
257   https://www.st.com/en/microcontrollers-microprocessors/stm32h745xi.html
258
259.. _STM32H745xx reference manual:
260   https://www.st.com/resource/en/reference_manual/rm0399-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
261
262.. _STM32H745xx datasheet:
263   https://www.st.com/resource/en/datasheet/stm32h745xi.pdf
264
265.. _STM32H745-Disco UM:
266   https://www.st.com/resource/en/user_manual/um2488-discovery-kits-with-stm32h745xi-and-stm32h750xb-mcus-stmicroelectronics.pdf
267
268.. _STM32CubeProgrammer:
269   https://www.st.com/en/development-tools/stm32cubeprog.html
270
271.. _STM32CubeIDE:
272   https://www.st.com/en/development-tools/stm32cubeide.html
273