1.. zephyr:board:: stm32h745i_disco
2
3Overview
4********
5
6The STM32H745I-DISCO Discovery kit is a complete demonstration and development
7platform for STMicroelectronics Arm |reg| Cortex |reg|‑M7 and Cortex |reg|‑M4 core-based STM32H745XI microcontroller.
8
9The full range of hardware features available on the board helps users enhance their application
10development by an evaluation of almost all peripherals (such as USB OTG FS, Ethernet 10/100Mb/s,
11eMMC, USART, SAI audio DAC stereo with audio jack input and output, MEMS digital microphone, SDRAM,
12Quad-SPI flash memory, and RGB interface LCD with capacitive multi-touch panel). ARDUINO |reg| Uno V3
13connectors provide easy connection to extension shields or daughterboards for specific applications.
14
15STLINK-V3E is integrated into the board, as an embedded in-circuit debugger and programmer for the
16STM32 MCU and the USB Virtual COM port bridge
17
18Key Features
19
20- Arm |reg| Cortex |reg| core-based microcontroller with 2 Mbytes of flash memory and 1 Mbyte of RAM, in a TFBGA240+25 package
21- 4.3” RGB interface LCD with touch panel connector
22- Ethernet compliant with IEEE-802.3-2002, and PoE
23- USB OTG FS
24- SAI audio codec
25- One ST-MEMS digital microphone
26- 2× 512-Mbit Quad-SPI NOR flash memory
27- 128-Mbit SDRAM
28- 4-Gbyte on-board eMMC
29- 1 user and reset push-button
30- Fanout daughterboard
31- 2× CAN FDs
32- Board connectors:
33
34 - USB FS Micro-AB connectors
35 - ST-LINK Micro-B USB connector
36 - USB power Micro-B connector
37 - Ethernet RJ45
38 - Stereo headset jack including analog microphone input
39 - Audio header for external speakers
40 - Tag‑Connect |trade| (TAG) 10-pin footprint
41 - Arm |reg| Cortex |reg| 10-pin 1.27 mm pitch debug connector over STDC14 footprint
42 - ARDUINO |reg| Uno V3 expansion connectors
43 - STMod+
44
45- Flexible power-supply options:
46
47 - STLINK-V3E USB connector, USB FS connector
48 - 5 V delivered by RJ45 (Power over Ethernet)
49 - 5 V delivered by ARDUINO |reg| or external connector
50 - USB charger
51 - USB power
52
53More information about the board can be found at the `STM32H745I-DISCO website`_.
54More information about STM32H747XIH6 can be found here:
55
56- `STM32H745XI on www.st.com`_
57- `STM32H745xx reference manual`_
58- `STM32H745xx datasheet`_
59
60Supported Features
61==================
62
63The current Zephyr stm32h745i_disco board configuration supports the following hardware features:
64
65+-----------+------------+-------------------------------------+
66| Interface | Controller | Driver/Component                    |
67+===========+============+=====================================+
68| NVIC      | on-chip    | nested vector interrupt controller  |
69+-----------+------------+-------------------------------------+
70| UART      | on-chip    | serial port                         |
71+-----------+------------+-------------------------------------+
72| PINMUX    | on-chip    | pinmux                              |
73+-----------+------------+-------------------------------------+
74| GPIO      | on-chip    | gpio                                |
75+-----------+------------+-------------------------------------+
76| RTC       | on-chip    | counter                             |
77+-----------+------------+-------------------------------------+
78| I2C       | on-chip    | i2c                                 |
79+-----------+------------+-------------------------------------+
80| PWM       | on-chip    | pwm                                 |
81+-----------+------------+-------------------------------------+
82| ETHERNET  | on-chip    | ethernet                            |
83+-----------+------------+-------------------------------------+
84| SPI       | on-chip    | spi                                 |
85+-----------+------------+-------------------------------------+
86| QSPI NOR  | on-chip    | off-chip flash                      |
87+-----------+------------+-------------------------------------+
88| FDCAN     | on-chip    | fdcan                               |
89+-----------+------------+-------------------------------------+
90| FMC       | on-chip    | memc (SDRAM)                        |
91+-----------+------------+-------------------------------------+
92| RTC       | on-chip    | rtc                                 |
93+-----------+------------+-------------------------------------+
94
95Other hardware features are not yet supported on this Zephyr port.
96
97The default configuration per core can be found in the defconfig files:
98:zephyr_file:`boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7_defconfig` and
99:zephyr_file:`boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m4_defconfig`
100
101For more details please refer to `STM32H745-Disco UM`_.
102
103Default Zephyr Peripheral Mapping:
104----------------------------------
105
106- USART_3 TX/RX : PB10/PB11 (ST-Link Virtual Port Com)
107- USART_1 TX/RX : PB6/PB7 (Arduino Serial)
108- SPI_2 NSS/SCK/MISO/MOSI : PB4/PD3/PI2/PB15 (Arduino SPI)
109- I2C_4 SCL/SDA: PD12, PD13 (Arduino I2C)
110- USER_PB : PC13
111- LD1 : PI13
112- LD2 : PJ2
113- LD3 : PD3
114
115System Clock
116------------
117
118STM32H745I-DISCO System Clock could be driven by an internal or external
119oscillator, as well as the main PLL clock. By default, the System clock is
120driven by the PLL clock at 480MHz, driven by an 25MHz high-speed external clock.
121
122Serial Port
123-----------
124
125STM32H745I-DISCO board has 4 UARTs and 4 USARTs. The Zephyr console output is
126assigned to UART3. Default settings are 115200 8N1.
127
128Resources sharing
129-----------------
130
131The dual core nature of STM32H745 SoC requires sharing HW resources between the
132two cores. This is done in 3 ways:
133
134- **Compilation**: Clock configuration is only accessible to M7 core. M4 core only
135  has access to bus clock activation and deactivation.
136- **Static pre-compilation assignment**: Peripherals such as a UART are assigned in
137  devicetree before compilation. The user must ensure peripherals are not assigned
138  to both cores at the same time.
139- **Run time protection**: Interrupt-controller and GPIO configurations could be
140  accessed by both cores at run time. Accesses are protected by a hardware semaphore
141  to avoid potential concurrent access issues.
142
143Programming and Debugging
144*************************
145
146STM32H745I-DISCO board includes an ST-LINK/V3 embedded debug tool interface.
147
148Applications for the ``stm32h745i_disco`` board should be built per core target,
149using either ``stm32h745i_disco/stm32h745xx/m7`` or ``stm32h745i_disco/stm32h745xx/m4`` as the target
150(see :ref:`build_an_application` and :ref:`application_run` for more details).
151
152.. note::
153
154   Check if the on-board ST-LINK V3 has the latest firmware version. It can be done with either `STM32CubeIDE`_ or `STM32CubeProgrammer`_
155
156Flashing
157========
158
159The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
160so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
161The target core is detected automatically.
162
163Alternatively, OpenOCD or JLink can also be used to flash the board using
164the ``--runner`` (or ``-r``) option:
165
166.. code-block:: console
167
168   $ west flash --runner openocd
169   $ west flash --runner jlink
170
171Flashing an application to STM32H745I-DISCO
172-------------------------------------------
173
174Flashing operation will depend on the target and the SoC option bytes configuration.
175
176By default:
177
178  - CPU0 (Cortex-M7) boot address is set to 0x80000000 (OB: BOOT_CM7_ADD0)
179  - CPU1 (Cortex-M4) boot address is set to 0x81000000 (OB: BOOT_CM4_ADD0)
180
181Also, the out of the box default board configuration enables CM7 and CM4 boot when
182board is powered (Option bytes BCM7 and BCM4 are checked).
183In that configuration, Kconfig boot option ``STM32H7_BOOT_CM4_CM7`` should be selected.
184Zephyr flash configuration has been set to meet these default settings.
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 :zephyr:code-sample:`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:zephyr:code-sample:`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