boards: arm: Add nucleo-f446re board

Add nucleo-f446re board support and documentation

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
This commit is contained in:
Philémon Jaermann 2018-03-05 17:46:46 +01:00 committed by Kumar Gala
parent 8834a8d47b
commit 74db6bfa73
16 changed files with 441 additions and 0 deletions

View file

@ -0,0 +1,3 @@
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)

View file

@ -0,0 +1,10 @@
# Kconfig - STM32F446RE Nucleo board configuration
#
# Copyright (c) 2018 Philémon Jaermann
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_NUCLEO_F446RE
bool "Nucleo F446RE Development Board"
depends on SOC_STM32F446XE

View file

@ -0,0 +1,27 @@
# Kconfig - STM32F446RE Nucleo board configuration
#
# Copyright (c) 2018 Philémon Jaermann
#
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_NUCLEO_F446RE
config BOARD
default nucleo_f446re
if UART_CONSOLE
config UART_STM32_PORT_2
default y
endif # UART_CONSOLE
if I2C
config I2C_1
default y
endif # I2C
endif # BOARD_NUCLEO_F446RE

View file

@ -0,0 +1 @@
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2018 Philémon Jaermann
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __INC_BOARD_H
#define __INC_BOARD_H
#include <soc.h>
/* User push button */
#define USER_PB_GPIO_PORT "GPIOC"
#define USER_PB_GPIO_PIN 13
/* LD2 green LED */
#define LD2_GPIO_PORT "GPIOA"
#define LD2_GPIO_PIN 5
/* Create aliases to make the basic samples work */
#define SW0_GPIO_NAME USER_PB_GPIO_PORT
#define SW0_GPIO_PIN USER_PB_GPIO_PIN
#define LED0_GPIO_PORT LD2_GPIO_PORT
#define LED0_GPIO_PIN LD2_GPIO_PIN
#endif /* __INC_BOARD_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View file

@ -0,0 +1,219 @@
.. _nucleo_f446re_board:
ST Nucleo F446RE
################
Overview
********
The Nucleo F446RE board features an ARM Cortex-M4 based STM32F446RE MCU
with a wide range of connectivity support and configurations. Here are
some highlights of the Nucleo F446RE board:
- STM32 microcontroller in QFP64 package
- Two types of extension resources:
- Arduino Uno V3 connectivity
- ST morpho extension pin headers for full access to all STM32 I/Os
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector
- Flexible board power supply:
- USB VBUS or external source(3.3V, 5V, 7 - 12V)
- Power management access point
- Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3)
- Two push-buttons: USER and RESET
.. image:: img/nucleo64_perf_logo_1024.png
:width: 720px
:align: center
:height: 720px
:alt: Nucleo F446RE
More information about the board can be found at the `Nucleo F446RE website`_.
Hardware
********
Nucleo F446RE provides the following hardware components:
- STM32F446RET6 in LQFP64 package
- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
- Adaptive real-time accelerator (ART Accelerator)
- 180 MHz max CPU frequency
- VDD from 1.7 V to 3.6 V
- 512 KB Flash
- 128 KB SRAM
- 10 General purpose timers
- 2 Advanced control timers
- 2 basic timers
- SPI(4)
- I2C(3)
- USART(4)
- UART(2)
- USB OTG Full Speed and High Speed
- CAN(2)
- SAI(2)
- SPDIF_Rx(1)
- HDMI_CEC(1)
- Quad SPI(1)
- Camera Interface
- GPIO(50) with external interrupt capability
- 12-bit ADC(3) with 16 channels
- 12-bit DAC with 2 channels
More information about STM32F446RE can be found here:
- `STM32F446RE on www.st.com`_
- `STM32F446 reference manual`_
Supported Features
==================
The Zephyr nucleo_f446re board configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on this Zephyr port.
The default configuration can be found in the defconfig file:
``boards/arm/nucleo_f446re/nucleo_f446re_defconfig``
Connections and IOs
===================
Nucleo F446RE Board has 8 GPIO controllers. These controllers are responsible for pin muxing,
input/output, pull-up, etc.
Available pins:
---------------
.. image:: img/nucleo_f446re_arduino_top_left.png
:width: 720px
:align: center
:height: 540px
:alt: Nucleo F446RE Arduino connectors (top left)
.. image:: img/nucleo_f446re_arduino_top_right.png
:width: 720px
:align: center
:height: 540px
:alt: Nucleo F446RE Arduino connectors (top right)
.. image:: img/nucleo_f446re_morpho_top_left.png
:width: 720px
:align: center
:height: 540px
:alt: Nucleo F446RE Morpho connectors (top left)
.. image:: img/nucleo_f446re_morpho_top_right.png
:width: 720px
:align: center
:height: 540px
:alt: Nucleo F446RE Morpho connectors (top right)
For mode details please refer to `STM32 Nucleo-64 board User Manual`_.
Default Zephyr Peripheral Mapping:
----------------------------------
- UART_1_TX : PB6
- UART_1_RX : PB7
- UART_2_TX : PA2
- UART_2_RX : PA3
- USER_PB : PC13
- LD2 : PA5
- I2C1_SDA : PB9
- I2C1_SCL : PB8
- I2C2_SDA : PB3
- I2C2_SCL : PB10
- I2C3_SDA : PB4
- I2C3_SCL : PA8
System Clock
------------
Nucleo F446RE System Clock could be driven by an internal or external oscillator,
as well as the main PLL clock. By default, the System clock is driven by the PLL clock at 84MHz,
driven by an 8MHz high-speed external clock.
Serial Port
-----------
Nucleo F446RE board has 2 UARTs and 4 USARTs. The Zephyr console output is assigned to UART2.
Default settings are 115200 8N1.
Programming and Debugging
*************************
Applications for the ``nucleo_f446re`` board configuration can be built and
flashed in the usual way (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Flashing
========
Nucleo F446RE board includes an ST-LINK/V2-1 embedded debug tool interface.
This interface is supported by the openocd version included in the Zephyr SDK.
Flashing an application to Nucleo F446RE
----------------------------------------
Here is an example for the :ref:`hello_world` application.
Run a serial host program to connect with your Nucleo board.
.. code-block:: console
$ minicom -b 115200 -D /dev/ttyACM0
Build and flash the application:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: nucleo_f446re
:goals: build flash
You should see the following message on the console:
.. code-block:: console
$ Hello World! arm
Debugging
=========
You can debug an application in the usual way. Here is an example for the
:ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: nucleo_f446re
:maybe-skip-config:
:goals: debug
.. _Nucleo F446RE website:
http://www.st.com/en/evaluation-tools/nucleo-f446re.html
.. _STM32 Nucleo-64 board User Manual:
http://www.st.com/resource/en/user_manual/dm00105823.pdf
.. _STM32F446RE on www.st.com:
http://www.st.com/en/microcontrollers/stm32f446re.html
.. _STM32F446 reference manual:
http://www.st.com/resource/en/reference_manual/dm00135183.pdf

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018 Philémon Jaermann
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/stm32f446.dtsi>
/ {
model = "STMicroelectronics STM32F446RE-NUCLEO board";
compatible = "st,stm32f446re-nucleo", "st,stm32f446";
chosen {
zephyr,console = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};
&usart1 {
current-speed = <115200>;
pinctrl-0 = <&usart1_pins_a>;
pinctrl-names = "default";
status = "ok";
};
&usart2 {
current-speed = <115200>;
pinctrl-0 = <&usart2_pins_a>;
pinctrl-names = "default";
status = "ok";
};
&i2c1 {
status = "ok";
clock-frequency = <I2C_BITRATE_FAST>;
};

View file

@ -0,0 +1,7 @@
identifier: nucleo_f446re
name: NUCLEO-F446RE
type: mcu
arch: arm
toolchain:
- zephyr
- gccarmemb

View file

@ -0,0 +1,48 @@
CONFIG_ARM=y
CONFIG_BOARD_NUCLEO_F446RE=y
CONFIG_SOC_SERIES_STM32F4X=y
CONFIG_SOC_STM32F446XE=y
# 96MHz system clock (highest value to get a precise USB clock)
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
# Enable MPU
CONFIG_STM32_ARM_MPU_ENABLE=y
CONFIG_SERIAL=y
# console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# enable I2C
CONFIG_I2C=y
# enable pinmux
CONFIG_PINMUX=y
# enable GPIO
CONFIG_GPIO=y
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Clock configuration for Cube Clock control driver
CONFIG_CLOCK_STM32_HSE_CLOCK=8000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# use HSE as PLL input
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# however, the board does not have an external oscillator, so just use
# the 8MHz clock signal coming from integrated STLink
CONFIG_CLOCK_STM32_HSE_BYPASS=y
# produce 84MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=8
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=384
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=8
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
# APB1 clock must not exceed 50MHz limit
CONFIG_CLOCK_STM32_APB1_PRESCALER=2
CONFIG_CLOCK_STM32_APB2_PRESCALER=1

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2018 Philémon Jaermann
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <sys_io.h>
#include <pinmux/stm32/pinmux_stm32.h>
/* pin assignments for stm32F446RE Nucleo board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_STM32_PORT_1
{STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_USART1_TX},
{STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_USART1_RX},
#endif /* CONFIG_UART_STM32_PORT_1 */
#ifdef CONFIG_UART_STM32_PORT_2
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
#endif /* CONFIG_UART_STM32_PORT_2 */
#ifdef CONFIG_I2C_1
{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_I2C1_SDA},
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_I2C_2
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_I2C2_SCL},
{STM32_PIN_PB3, STM32F4_PINMUX_FUNC_PB3_I2C2_SDA},
#endif /* CONFIG_I2C_2 */
#ifdef CONFIG_I2C_3
{STM32_PIN_PA8, STM32F4_PINMUX_FUNC_PA8_I2C3_SCL},
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_I2C3_SDA},
#endif /* CONFIG_I2C_3 */
};
static int pinmux_stm32_init(struct device *port)
{
ARG_UNUSED(port);
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
return 0;
}
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);

View file

@ -0,0 +1,12 @@
source [find board/st_nucleo_f4.cfg]
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}