Skip to content

Commit 8b403ba

Browse files
FRASTMkartben
authored andcommitted
boards: st: introduce new STM32F413H-DISCO discovery kit
Add the stm32f413h_disco target to the boards/st Add the PLLi2S when needed by the USB or SDMMC or RNG. Signed-off-by: Francois Ramu <[email protected]>
1 parent 65997ce commit 8b403ba

File tree

10 files changed

+411
-0
lines changed

10 files changed

+411
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024 STMicroelectronics
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_STM32F413H_DISCO
5+
select SOC_STM32F413XX
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
arduino_header: connector {
9+
compatible = "arduino-header-r3";
10+
#gpio-cells = <2>;
11+
gpio-map-mask = <0xffffffff 0xffffffc0>;
12+
gpio-map-pass-thru = <0 0x3f>;
13+
gpio-map = <0 0 &gpioc 0 0>, /* A0 */
14+
<1 0 &gpioa 1 0>, /* A1 */
15+
<2 0 &gpioa 2 0>, /* A2 */
16+
<3 0 &gpioa 5 0>, /* A3 */
17+
<4 0 &gpiob 1 0>, /* A4 */
18+
<5 0 &gpioc 4 0>, /* A5 */
19+
<6 0 &gpiof 6 0>, /* D0 */
20+
<7 0 &gpiof 7 0>, /* D1 */
21+
<8 0 &gpiog 13 0>, /* D2 */
22+
<9 0 &gpiof 10 0>, /* D3 */
23+
<10 0 &gpiob 6 0>, /* D4 */
24+
<11 0 &gpioe 6 0>, /* D5 */
25+
<12 0 &gpiob 0 0>, /* D6 */
26+
<13 0 &gpioc 13 0>, /* D7 */
27+
<14 0 &gpioa 4 0>, /* D8 */
28+
<15 0 &gpiob 8 0>, /* D9 */
29+
<16 0 &gpioa 15 0>, /* D10 */
30+
<17 0 &gpiob 5 0>, /* D11 */
31+
<18 0 &gpiob 4 0>, /* D12 */
32+
<19 0 &gpiob 12 0>, /* D13 */
33+
<20 0 &gpiob 11 0>, /* D14 */
34+
<21 0 &gpiob 10 0>; /* D15 */
35+
};
36+
};
37+
38+
arduino_i2c: &i2c2 {};
39+
arduino_spi: &spi3 {};
40+
arduino_serial: &uart7 {};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# keep first
4+
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
5+
board_runner_args(jlink "--device=STM32F413ZH" "--speed=4000")
6+
7+
# keep first
8+
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
10+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: stm32f413h_disco
3+
full_name: STM32F413H Discovery
4+
vendor: st
5+
socs:
6+
- name: stm32f413xx
38.6 KB
Loading
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
.. zephyr:board:: stm32f413h_disco
2+
3+
Overview
4+
********
5+
6+
The STM32F413H-DISCO Discovery kit features an ARM Cortex-M4 based STM32F413ZH MCU
7+
with a wide range of connectivity support and configurations. Here are
8+
some highlights of the STM32F413H-DISCO board:
9+
10+
11+
- STM32F413ZHT6 microcontroller featuring 1.5 Mbyte of Flash memory and 320 Kbytes of RAM in an LQFP144 package
12+
- On-board ST-LINK/V2-1 SWD debugger supporting USB re-enumeration capability:
13+
14+
- USB virtual COM port
15+
- mass storage
16+
- debug port
17+
18+
- 1.54 inch 240x240 pixel TFT color LCD with parallel interface and capacitive touchscreen
19+
- I2S Audio CODEC, with a stereo headset jack, including analog microphone input and a loudspeaker output
20+
- Stereo digital MEMS microphones
21+
- MicroSD card connector extension
22+
- I2C extension connector
23+
- 128 Mbit Quad-SPI Nor Flash
24+
- 8 Mbit 16-bit wide PSRAM
25+
- Reset and User buttons
26+
- Two color user LEDs.
27+
- USB OTG FS with Micro-AB connector
28+
- Four power supply options:
29+
30+
- ST-LINK/V2-1 USB connector
31+
- User USB FS connector
32+
- VIN from Arduino* connectors
33+
- + 5 V from Arduino* connectors
34+
35+
- Two power supplies for MCU: 2.0 V and 3.3 V
36+
- Compatible with Arduino(tm) Uno revision 3 connectors
37+
- Extension connector for direct access to various features of STM32F413ZHT6 MCU
38+
- Comprehensive free software including a variety of examples, part of STM32Cube package
39+
40+
More information about the board can be found at the `32F413HDISCOVERY website`_.
41+
42+
Hardware
43+
********
44+
45+
STM32F413H-DISCO Discovery kit provides the following hardware components:
46+
47+
- STM32F413ZHT6 in LQFP144 package
48+
- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
49+
- 100 MHz max CPU frequency
50+
- VDD from 1.7 V to 3.6 V
51+
- 1.5 MB Flash
52+
- 320 KB SRAM
53+
- GPIO with external interrupt capability
54+
- LCD parallel interface, 8080/6800 modes
55+
- 1x12-bit ADC with 16 channels
56+
- RTC
57+
- Advanced-control Timer
58+
- General Purpose Timers (12)
59+
- Watchdog Timers (2)
60+
- USART/UART (10)
61+
- I2C (4)
62+
- SPI (5)
63+
- SDIO
64+
- SAI
65+
- 3xCAN
66+
- USB OTG 2.0 Full-speed
67+
- CRC calculation unit
68+
- True random number generator
69+
- DMA Controller
70+
71+
More information about STM32F413ZH can be found here:
72+
- `STM32F413ZH on www.st.com`_
73+
- `STM32F413 reference manual`_
74+
75+
Supported Features
76+
==================
77+
78+
The Zephyr STM32F413H-DISCO board configuration supports the following hardware features:
79+
80+
+-----------+------------+-------------------------------------+
81+
| Interface | Controller | Driver/Component |
82+
+===========+============+=====================================+
83+
| NVIC | on-chip | nested vector interrupt controller |
84+
+-----------+------------+-------------------------------------+
85+
| UART | on-chip | serial port-polling; |
86+
| | | serial port-interrupt |
87+
+-----------+------------+-------------------------------------+
88+
| PINMUX | on-chip | pinmux |
89+
+-----------+------------+-------------------------------------+
90+
| GPIO | on-chip | gpio |
91+
+-----------+------------+-------------------------------------+
92+
| I2C | on-chip | i2c |
93+
+-----------+------------+-------------------------------------+
94+
| SPI | on-chip | spi |
95+
+-----------+------------+-------------------------------------+
96+
97+
Other hardware features are not yet supported by Zephyr.
98+
99+
The default configuration can be found in
100+
:zephyr_file:`boards/st/stm32f413h_disco/stm32f413h_disco_defconfig`
101+
102+
103+
Pin Mapping
104+
===========
105+
106+
STM32F413H-DISCO Discovery kit has 8 GPIO controllers. These controllers are responsible for pin muxing,
107+
input/output, pull-up, etc.
108+
109+
For more details please refer to `32F413HDISCOVERY board User Manual`_.
110+
111+
Default Zephyr Peripheral Mapping:
112+
----------------------------------
113+
- UART_6_TX : PG14
114+
- UART_6_RX : PG9
115+
- LD1 : PE3
116+
- LD2 : PC5
117+
118+
System Clock
119+
============
120+
121+
STM32F413H-DISCO System Clock could be driven by internal or external oscillator,
122+
as well as main PLL clock. By default System clock is driven by PLL clock at 100MHz,
123+
that is driven by the internal oscillator.
124+
125+
Serial Port
126+
===========
127+
128+
The STM32F413H-DISCO Discovery kit has up to 10 UARTs. The Zephyr console output is assigned to UART6.
129+
Default settings are 115200 8N1.
130+
131+
132+
Programming and Debugging
133+
*************************
134+
135+
STM32F413H-DISCO Discovery kit includes an ST-LINK/V2 embedded debug tool interface.
136+
137+
Applications for the STM32F413H-DISCO board configuration can be built and
138+
flashed in the usual way (see :ref:`build_an_application` and
139+
:ref:`application_run` for more details).
140+
141+
Flashing
142+
========
143+
144+
The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
145+
so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
146+
147+
Alternatively, OpenOCD or JLink can also be used to flash the board using
148+
the ``--runner`` (or ``-r``) option:
149+
150+
.. code-block:: console
151+
152+
$ west flash --runner openocd
153+
$ west flash --runner jlink
154+
155+
Flashing an application to STM32F413H-DISCO
156+
-------------------------------------------
157+
158+
Connect the STM32F413H-DISCO Discovery kit to your host computer using
159+
the USB port, then run a serial host program to connect with your
160+
board:
161+
162+
.. code-block:: console
163+
164+
$ minicom -D /dev/ttyACM0
165+
166+
Then build and flash an application. Here is an example for the
167+
:zephyr:code-sample:`hello_world` application.
168+
169+
.. zephyr-app-commands::
170+
:zephyr-app: samples/hello_world
171+
:board: stm32f413h_disco
172+
:goals: build flash
173+
174+
You should see the following message on the console:
175+
176+
.. code-block:: console
177+
178+
Hello World! stm32f413h_disco/stm32f413xx
179+
180+
181+
Debugging
182+
=========
183+
184+
You can debug an application in the usual way. Here is an example for the
185+
:zephyr:code-sample:`hello_world` application.
186+
187+
.. zephyr-app-commands::
188+
:zephyr-app: samples/hello_world
189+
:board: stm32f413h_disco
190+
:maybe-skip-config:
191+
:goals: debug
192+
193+
.. _32F413HDISCOVERY website:
194+
https://www.st.com/en/evaluation-tools/32f413hdiscovery.html
195+
196+
.. _32F413HDISCOVERY board User Manual:
197+
https://www.st.com/resource/en/user_manual/um2135-discovery-kit-with-stm32f413zh-mcu-stmicroelectronics.pdf
198+
199+
.. _STM32F413ZH on www.st.com:
200+
https://www.st.com/en/microcontrollers/stm32f413zh.html
201+
202+
.. _STM32F413 reference manual:
203+
https://www.st.com/resource/en/reference_manual/rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
204+
205+
.. _STM32CubeProgrammer:
206+
https://www.st.com/en/development-tools/stm32cubeprog.html
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/f4/stm32f413Xh.dtsi>
9+
#include <st/f4/stm32f413z(g-h)tx-pinctrl.dtsi>
10+
#include "arduino_r3_connector.dtsi"
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
12+
13+
/ {
14+
model = "STMicroelectronics STM32F413H-DISCO board";
15+
compatible = "st,stm32f413h-disco";
16+
17+
chosen {
18+
zephyr,console = &usart6;
19+
zephyr,shell-uart = &usart6;
20+
zephyr,sram = &sram0;
21+
zephyr,flash = &flash0;
22+
};
23+
24+
leds {
25+
compatible = "gpio-leds";
26+
green_led_1: led_1 {
27+
gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
28+
label = "User LD1";
29+
};
30+
red_led_2: led_2 {
31+
gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
32+
label = "User LD4";
33+
};
34+
};
35+
36+
aliases {
37+
led0 = &green_led_1;
38+
led1 = &red_led_2;
39+
40+
};
41+
};
42+
43+
&clk_lsi {
44+
status = "okay";
45+
};
46+
47+
&clk_hse {
48+
hse-bypass;
49+
clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
50+
status = "okay";
51+
};
52+
53+
&pll {
54+
div-m = <4>;
55+
mul-n = <100>;
56+
div-p = <2>;
57+
div-q = <8>;
58+
clocks = <&clk_hse>;
59+
status = "okay";
60+
};
61+
62+
&rcc {
63+
clocks = <&pll>;
64+
clock-frequency = <DT_FREQ_M(100)>;
65+
ahb-prescaler = <1>;
66+
apb1-prescaler = <2>;
67+
apb2-prescaler = <1>;
68+
};
69+
70+
&usart6 {
71+
pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
72+
pinctrl-names = "default";
73+
current-speed = <115200>;
74+
status = "okay";
75+
};
76+
77+
&uart7 {
78+
pinctrl-0 = <&uart7_tx_pf7 &uart7_rx_pf6>;
79+
pinctrl-names = "default";
80+
current-speed = <115200>;
81+
status = "okay";
82+
};
83+
84+
&i2c2 {
85+
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
86+
pinctrl-names = "default";
87+
clock-frequency = <I2C_BITRATE_FAST>;
88+
status = "okay";
89+
};
90+
91+
&spi3 {
92+
pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pb12
93+
&spi3_miso_pb4 &spi3_mosi_pb5>;
94+
pinctrl-names = "default";
95+
status = "okay";
96+
};
97+
98+
&rtc {
99+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
100+
<&rcc STM32_SRC_LSI RTC_SEL(2)>;
101+
status = "okay";
102+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
identifier: stm32f413h_disco
2+
name: ST STM32F413H Discovery
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
supported:
10+
- arduino_gpio
11+
- arduino_serial
12+
- arduino_i2c
13+
- arduino_spi
14+
vendor: st

0 commit comments

Comments
 (0)