Skip to content

Commit

Permalink
boards: st: introduce new stm32f413 disco kit
Browse files Browse the repository at this point in the history
Add the stm32f413h_disco target to the boards/st

Signed-off-by: Francois Ramu <[email protected]>
  • Loading branch information
FRASTM committed Nov 28, 2024
1 parent 9211abc commit 81aa2a0
Show file tree
Hide file tree
Showing 11 changed files with 424 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boards/st/stm32f412g_disco/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ More information about the board can be found at the `32F412GDISCOVERY website`_
Hardware
********

STM32F469I-DISCO Discovery kit provides the following hardware components:
STM32F412G-DISCO Discovery kit provides the following hardware components:

- STM32F412ZGT6 in LQFP144 package
- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
Expand Down
5 changes: 5 additions & 0 deletions boards/st/stm32f413h_disco/Kconfig.stm32f413h_disco
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

config BOARD_STM32F413H_DISCO
select SOC_STM32F413XX
40 changes: 40 additions & 0 deletions boards/st/stm32f413h_disco/arduino_r3_connector.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &gpioc 0 0>, /* A0 */
<1 0 &gpioa 1 0>, /* A1 */
<2 0 &gpioa 2 0>, /* A2 */
<3 0 &gpioa 5 0>, /* A3 */
<4 0 &gpiob 1 0>, /* A4 */
<5 0 &gpioc 4 0>, /* A5 */
<6 0 &gpiof 6 0>, /* D0 */
<7 0 &gpiof 7 0>, /* D1 */
<8 0 &gpiog 13 0>, /* D2 */
<9 0 &gpiof 10 0>, /* D3 */
<10 0 &gpiob 6 0>, /* D4 */
<11 0 &gpioe 6 0>, /* D5 */
<12 0 &gpiob 0 0>, /* D6 */
<13 0 &gpioc 13 0>, /* D7 */
<14 0 &gpioa 4 0>, /* D8 */
<15 0 &gpiob 8 0>, /* D9 */
<16 0 &gpioa 15 0>, /* D10 */
<17 0 &gpiob 5 0>, /* D11 */
<18 0 &gpiob 4 0>, /* D12 */
<19 0 &gpiob 12 0>, /* D13 */
<20 0 &gpiob 11 0>, /* D14 */
<21 0 &gpiob 10 0>; /* D15 */
};
};

arduino_i2c: &i2c2 {};
arduino_spi: &spi3 {};
arduino_serial: &usart7 {};
12 changes: 12 additions & 0 deletions boards/st/stm32f413h_disco/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

# keep first
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(jlink "--device=STM32F413ZH" "--speed=4000")



# keep first
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
6 changes: 6 additions & 0 deletions boards/st/stm32f413h_disco/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: stm32f413h_disco
full_name: STM32F413H Discovery
vendor: st
socs:
- name: stm32f413xx
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
206 changes: 206 additions & 0 deletions boards/st/stm32f413h_disco/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
.. zephyr:board:: stm32f413h_disco
Overview
********

The STM32F413 Discovery kit features an ARM Cortex-M4 based STM32F413ZH MCU
with a wide range of connectivity support and configurations Here are
some highlights of the STM32F413ZH-DISCO board:


- STM32F413ZHT6 microcontroller featuring 1.5 Mbyte of Flash memory and 320 Kbytes of RAM in an LQFP144 package
- On-board ST-LINK/V2-1 SWD debugger supporting USB re-enumeration capability:

- USB virtual COM port
- mass storage
- debug port

- 1.54 inch 240x240 pixel TFT color LCD with parallel interface and capacitive touchscreen
- I2S Audio CODEC, with a stereo headset jack, including analog microphone input and a loudspeaker output
- Stereo digital MEMS microphones
- MicroSD card connector extension
- I2C extension connector
- 128 Mbit Quad-SPI Nor Flash
- 8 Mbit 16-bit wide PSRAM
- Reset and User buttons
- Two color user LEDs.
- USB OTG FS with Micro-AB connector
- Four power supply options:

- ST-LINK/V2-1 USB connector
- User USB FS connector
- VIN from Arduino* connectors
- + 5 V from Arduino* connectors

- Two power supplies for MCU: 2.0 V and 3.3 V
- Compatible with Arduino(tm) Uno revision 3 connectors
- Extension connector for direct access to various features of STM32F413ZHT6 MCU
- Comprehensive free software including a variety of examples, part of STM32Cube package

More information about the board can be found at the `32F413HDISCOVERY website`_.

Hardware
********

STM32F413H-DISCO Discovery kit provides the following hardware components:

- STM32F413ZHT6 in LQFP144 package
- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
- 100 MHz max CPU frequency
- VDD from 1.7 V to 3.6 V
- 1.5 MB Flash
- 320 KB SRAM
- GPIO with external interrupt capability
- LCD parallel interface, 8080/6800 modes
- 1x12-bit ADC with 16 channels
- RTC
- Advanced-control Timer
- General Purpose Timers (12)
- Watchdog Timers (2)
- USART/UART (10)
- I2C (4)
- SPI (5)
- SDIO
- SAI
- 3xCAN
- USB OTG 2.0 Full-speed
- CRC calculation unit
- True random number generator
- DMA Controller

More information about STM32F413ZH can be found here:
- `STM32F413ZH on www.st.com`_
- `STM32F413 reference manual`_

Supported Features
==================

The Zephyr stm32f413h_disco board configuration supports the following hardware features:

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SPI | on-chip | spi |
+-----------+------------+-------------------------------------+

Other hardware features are not yet supported on Zephyr porting.

The default configuration can be found in
:zephyr_file:`boards/st/stm32f413h_disco/stm32f413h_disco_defconfig`


Pin Mapping
===========

STM32F413H-DISCO Discovery kit has 8 GPIO controllers. These controllers are responsible for pin muxing,
input/output, pull-up, etc.

For more details please refer to `32F413HDISCOVERY board User Manual`_.

Default Zephyr Peripheral Mapping:
----------------------------------
- UART_6_TX : PG14
- UART_6_RX : PG9
- LD1 : PE3
- LD2 : PC5

System Clock
============

STM32F413H-DISCO System Clock could be driven by internal or external oscillator,
as well as main PLL clock. By default System clock is driven by PLL clock at 100MHz,
driven internal oscillator.

Serial Port
===========

The STM32F413H Discovery kit has up to 10 UARTs. The Zephyr console output is assigned to UART6.
Default settings are 115200 8N1.


Programming and Debugging
*************************

STM32F413H-DISCO Discovery kit includes an ST-LINK/V2 embedded debug tool interface.

Applications for the ``stm32f413h_disco`` board configuration can be built and
flashed in the usual way (see :ref:`build_an_application` and
:ref:`application_run` for more details).

Flashing
========

The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.

Alternatively, OpenOCD or JLink can also be used to flash the board using
the ``--runner`` (or ``-r``) option:

.. code-block:: console
$ west flash --runner openocd
$ west flash --runner jlink
Flashing an application to STM32F413H-DISCO
-------------------------------------------

Connect the STM32F413H-DISCO Discovery kit to your host computer using
the USB port, then run a serial host program to connect with your
board:

.. code-block:: console
$ minicom -D /dev/ttyACM0
Then build and flash an application. Here is an example for the
:zephyr:code-sample:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: stm32f413h_disco
:goals: build flash

You should see the following message on the console:

.. code-block:: console
Hello World! stm32f413h_disco/stm32f413xx
Debugging
=========

You can debug an application in the usual way. Here is an example for the
:zephyr:code-sample:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: stm32f413h_disco
:maybe-skip-config:
:goals: debug

.. _32F413HDISCOVERY website:
https://www.st.com/en/evaluation-tools/32f413hdiscovery.html

.. _32F413HDISCOVERY board User Manual:
https://www.st.com/resource/en/user_manual/um2135-discovery-kit-with-stm32f413zh-mcu-stmicroelectronics.pdf

.. _STM32F413ZH on www.st.com:
https://www.st.com/en/microcontrollers/stm32f413zh.html

.. _STM32F413 reference manual:
https://www.st.com/resource/en/reference_manual/rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

.. _STM32CubeProgrammer:
https://www.st.com/en/development-tools/stm32cubeprog.html
112 changes: 112 additions & 0 deletions boards/st/stm32f413h_disco/stm32f413h_disco.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/f4/stm32f413Xh.dtsi>
#include <st/f4/stm32f413z(g-h)tx-pinctrl.dtsi>
#include "arduino_r3_connector.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
model = "STMicroelectronics STM32F413H-DISCO board";
compatible = "st,stm32f413h-disco";

chosen {
zephyr,console = &usart6;
zephyr,shell-uart = &usart6;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

leds {
compatible = "gpio-leds";
green_led_1: led_1 {
gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
label = "User LD1";
};
red_led_2: led_2 {
gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
label = "User LD4";
};
};

aliases {
led0 = &green_led_1;
led1 = &red_led_2;

};
};

&clk_lsi {
status = "okay";
};

&clk_hse {
hse-bypass;
clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
status = "okay";
};

&pll {
div-m = <4>;
mul-n = <100>;
div-p = <2>;
div-q = <8>;
clocks = <&clk_hse>;
status = "okay";
};

&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(100)>;
ahb-prescaler = <1>;
apb1-prescaler = <2>;
apb2-prescaler = <1>;
};

/* Enable PLL I2S to Deliver 48MHz clock from HS Clock */
&plli2s {
div-m = <4>;
mul-n = <96>;
div-q = <4>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};

&usart7 {
pinctrl-0 = <&usart7_tx_pf7 &usart7_rx_pf6>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};

&usart6 {
pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};

&i2c2 {
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
status = "okay";
};

&spi3 {
pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pb12
&spi3_miso_pb4 &spi3_mosi_pb5>;
pinctrl-names = "default";
status = "okay";
};

&rtc {
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
<&rcc STM32_SRC_LSI RTC_SEL(2)>;
status = "okay";
};
Loading

0 comments on commit 81aa2a0

Please sign in to comment.