diff --git a/boards/arm/nucleo_f413zh/Kconfig.board b/boards/arm/nucleo_f413zh/Kconfig.board new file mode 100644 index 00000000000..c8456c81789 --- /dev/null +++ b/boards/arm/nucleo_f413zh/Kconfig.board @@ -0,0 +1,10 @@ +# Kconfig - NUCLEO-144 F413ZH board configuration +# +# Copyright (c) 2017 Florian Vaussard, HEIG-VD +# +# SPDX-License-Identifier: Apache-2.0 +# + +config BOARD_NUCLEO_F413ZH + bool "NUCLEO-144 F413ZH Development Board" + depends on SOC_STM32F413XH diff --git a/boards/arm/nucleo_f413zh/Kconfig.defconfig b/boards/arm/nucleo_f413zh/Kconfig.defconfig new file mode 100644 index 00000000000..aa9b566e9b3 --- /dev/null +++ b/boards/arm/nucleo_f413zh/Kconfig.defconfig @@ -0,0 +1,13 @@ +# Kconfig - NUCLEO-144 F413ZH board configuration +# +# Copyright (c) 2017 Florian Vaussard, HEIG-VD +# +# SPDX-License-Identifier: Apache-2.0 +# + +if BOARD_NUCLEO_F413ZH + +config BOARD + default nucleo_f413zh + +endif # BOARD_NUCLEO_F413ZH diff --git a/boards/arm/nucleo_f413zh/Makefile b/boards/arm/nucleo_f413zh/Makefile new file mode 100644 index 00000000000..c925263c43a --- /dev/null +++ b/boards/arm/nucleo_f413zh/Makefile @@ -0,0 +1,2 @@ +# No C files (yet) +obj- += dummy.o diff --git a/boards/arm/nucleo_f413zh/board.h b/boards/arm/nucleo_f413zh/board.h new file mode 100644 index 00000000000..b73f2941adc --- /dev/null +++ b/boards/arm/nucleo_f413zh/board.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017 Florian Vaussard, HEIG-VD + * + * Based on nucleo_f411re: + * + * Copyright (c) 2016 Matthias Boesl + * Copyright (c) 2017 Linaro Limited. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +/* USER push button */ +#define USER_PB_GPIO_PORT "GPIOC" +#define USER_PB_GPIO_PIN 13 + +/* LD1 green LED */ +#define LD1_GPIO_PORT "GPIOB" +#define LD1_GPIO_PIN 0 + +/* LD2 blue LED */ +#define LD2_GPIO_PORT "GPIOB" +#define LD2_GPIO_PIN 7 + +/* LD3 red LED */ +#define LD3_GPIO_PORT "GPIOB" +#define LD3_GPIO_PIN 14 + +/* 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 LD1_GPIO_PORT +#define LED0_GPIO_PIN LD1_GPIO_PIN +#define LED1_GPIO_PORT LD2_GPIO_PORT +#define LED1_GPIO_PIN LD2_GPIO_PIN +#define LED2_GPIO_PORT LD3_GPIO_PORT +#define LED2_GPIO_PIN LD3_GPIO_PIN + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.jpg b/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.jpg new file mode 100644 index 00000000000..48804abf5a9 Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.jpg differ diff --git a/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.png b/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.png new file mode 100644 index 00000000000..5af1a52fd27 Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/Nucleo144_perf_logo_1024.png differ diff --git a/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_left.png b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_left.png new file mode 100644 index 00000000000..4bba86c662b Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_left.png differ diff --git a/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_right.png b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_right.png new file mode 100644 index 00000000000..4ca8f29636d Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_morpho_right.png differ diff --git a/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_left.png b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_left.png new file mode 100644 index 00000000000..059273f7e6e Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_left.png differ diff --git a/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_right.png b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_right.png new file mode 100644 index 00000000000..4d1b7f3fa42 Binary files /dev/null and b/boards/arm/nucleo_f413zh/doc/img/nucleo_f412zg_zio_right.png differ diff --git a/boards/arm/nucleo_f413zh/doc/nucleof413zh.rst b/boards/arm/nucleo_f413zh/doc/nucleof413zh.rst new file mode 100644 index 00000000000..aa8041b2477 --- /dev/null +++ b/boards/arm/nucleo_f413zh/doc/nucleof413zh.rst @@ -0,0 +1,165 @@ +.. _nucleo_f413zh_board: + +ST Nucleo F413ZH +################ + +Overview +******** + +The Nucleo F413ZH board features an ARM Cortex-M4 based STM32F413ZH MCU +with a wide range of connectivity support and configurations. Here are +some highlights of the Nucleo F413ZH board: + + +- STM32 microcontroller in LQFP144 package +- Two types of extension resources: + - ST Zio connector including: support for Arduino™ Uno V3 connectivity + (A0 to A5, D0 to D15) and additional signals exposing a wide range of + peripherals + - 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: + - 5 V from ST-LINK/V2-1 USB VBUS + - External power sources: 3.3 V and 7 - 12 V on ST Zio or ST morpho + connectors, 5 V on ST morpho connector +- Three user LEDs +- Two push-buttons: USER and RESET + +.. image:: img/Nucleo144_perf_logo_1024.png + :width: 720px + :align: center + :height: 720px + :alt: Nucleo F413ZH + +More information about the board can be found at the `Nucleo F413ZH website`_. + +Hardware +******** + +Nucleo F413ZH provides the following hardware components: + +- STM32F413ZHT6 in LQFP144 package +- ARM®32-bit Cortex®-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 +- 2 12-bit ADC with 16 channels, with FIFO and burst support +- RTC +- 14 General purpose timers +- 2 watchdog timers (independent and window) +- SysTick timer +- USART/UART (10) +- I2C (4) +- SPI (5) +- SDIO +- USB 2.0 OTG FS +- DMA Controller +- CRC calculation unit + +More information about STM32F413ZH can be found here: + - `STM32F413ZH on www.st.com`_ + - `STM32F413/423 reference manual`_ + +Supported Features +================== + +The Zephyr nucleo_413zh 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 | ++-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ + +Other hardware features are not yet supported on this Zephyr port. + +The default configuration can be found in the defconfig file: + + ``boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig`` + + +Connections and IOs +=================== + +Nucleo F413ZH Board has 8 GPIO controllers. These controllers are responsible for pin muxing, +input/output, pull-up, etc. + +Available pins: +--------------- +.. image:: img/nucleo_f412zg_zio_left.png + :width: 720px + :align: center + :height: 540px + :alt: Nucleo F413ZH ZIO connectors (left) +.. image:: img/nucleo_f412zg_zio_right.png + :width: 720px + :align: center + :height: 540px + :alt: Nucleo F413ZH ZIO connectors (right) +.. image:: img/nucleo_f412zg_morpho_left.png + :width: 720px + :align: center + :height: 540px + :alt: Nucleo F413ZH Morpho connectors (left) +.. image:: img/nucleo_f412zg_morpho_right.png + :width: 720px + :align: center + :height: 540px + :alt: Nucleo F413ZH Morpho connectors (right) + +For mode details please refer to `STM32 Nucleo-144 board User Manual`_. + +Default Zephyr Peripheral Mapping: +---------------------------------- +- UART_3_TX : PD8 +- UART_3_RX : PD9 +- PWM_2_CH1 : PA0 +- USER_PB : PC13 +- LD1 : PB0 +- LD2 : PB7 +- LD3 : PB14 + +System Clock +------------ + +Nucleo F413ZH 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 96MHz, +driven by 8MHz high speed external clock. + +Serial Port +----------- + +Nucleo F413ZH board has 10 UARTs. The Zephyr console output is assigned to UART3. +Default settings are 115200 8N1. + + +Programming and Debugging +************************* + +Nucleo F413ZH board includes an ST-LINK/V2-1 embedded debug tool interface. +However this interface is currently not supported by openocd. You will need +to use ST tools or an external JTAG probe. + + +.. _Nucleo F413ZH website: + http://www.st.com/en/evaluation-tools/nucleo-f413zh.html + +.. _STM32 Nucleo-144 board User Manual: + http://www.st.com/resource/en/user_manual/dm00244518.pdf + +.. _STM32F413ZH on www.st.com: + http://www.st.com/en/microcontrollers/stm32f413zh.html + +.. _STM32F413/423 reference manual: + http://www.st.com/resource/en/reference_manual/dm00305666.pdf diff --git a/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig b/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig new file mode 100644 index 00000000000..afe7715f569 --- /dev/null +++ b/boards/arm/nucleo_f413zh/nucleo_f413zh_defconfig @@ -0,0 +1,42 @@ +CONFIG_ARM=y +CONFIG_BOARD_NUCLEO_F413ZH=y +CONFIG_SOC_SERIES_STM32F4X=y +CONFIG_SOC_STM32F413XH=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 USART2 - passthrough to STLINK v2 connector +CONFIG_UART_STM32_PORT_3=y +# enable console on this port by default +CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_3" + +# enable pinmux +CONFIG_PINMUX=y + +# enable GPIO ports A, B, C +CONFIG_GPIO=y + +# clock configuration +CONFIG_CLOCK_CONTROL=y +CONFIG_CLOCK_VDD_VOLTAGE=3300 + +# 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 96MHz 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 +CONFIG_CLOCK_STM32_APB1_PRESCALER=2 +CONFIG_CLOCK_STM32_APB2_PRESCALER=1 + +#enable DTS +CONFIG_HAS_DTS=y diff --git a/drivers/pinmux/Makefile b/drivers/pinmux/Makefile index b50ac5fd66c..4a0cee01ff7 100644 --- a/drivers/pinmux/Makefile +++ b/drivers/pinmux/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_BOARD_NUCLEO_F334R8) += stm32/pinmux_board_nucleo_f334r8.o obj-$(CONFIG_BOARD_STM32373C_EVAL) += stm32/pinmux_board_stm32373c_eval.o obj-$(CONFIG_BOARD_NUCLEO_F401RE) += stm32/pinmux_board_nucleo_f401re.o obj-$(CONFIG_BOARD_NUCLEO_F411RE) += stm32/pinmux_board_nucleo_f411re.o +obj-$(CONFIG_BOARD_NUCLEO_F413ZH) += stm32/pinmux_board_nucleo_f413zh.o obj-$(CONFIG_BOARD_96B_CARBON) += stm32/pinmux_board_carbon.o obj-$(CONFIG_BOARD_NUCLEO_L476RG) += stm32/pinmux_board_nucleo_l476rg.o obj-$(CONFIG_BOARD_NUCLEO_L432KC) += stm32/pinmux_board_nucleo_l432kc.o diff --git a/drivers/pinmux/stm32/pinmux_board_nucleo_f413zh.c b/drivers/pinmux/stm32/pinmux_board_nucleo_f413zh.c new file mode 100644 index 00000000000..65310ae3f2e --- /dev/null +++ b/drivers/pinmux/stm32/pinmux_board_nucleo_f413zh.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017 Florian Vaussard, HEIG-VD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include "pinmux/pinmux.h" + +#include "pinmux_stm32.h" + +/* pin assignments for NUCLEO-F413ZH board */ +static const struct pin_config pinconf[] = { +#ifdef CONFIG_UART_STM32_PORT_3 + {STM32_PIN_PD8, STM32F4_PINMUX_FUNC_PD8_USART3_TX}, + {STM32_PIN_PD9, STM32F4_PINMUX_FUNC_PD9_USART3_RX}, +#endif /* #ifdef CONFIG_UART_STM32_PORT_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); diff --git a/dts/arm/Makefile b/dts/arm/Makefile index b4717cb7da6..54a882a3be5 100644 --- a/dts/arm/Makefile +++ b/dts/arm/Makefile @@ -16,6 +16,7 @@ dtb-$(CONFIG_BOARD_96B_CARBON) = 96b_carbon.dts_compiled dtb-$(CONFIG_BOARD_96B_CARBON_NRF51) = 96b_carbon_nrf51.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F401RE) = nucleo_f401re.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F411RE) = nucleo_f411re.dts_compiled +dtb-$(CONFIG_BOARD_NUCLEO_F413ZH) = nucleo_f413zh.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F103RB) = nucleo_f103rb.dts_compiled dtb-$(CONFIG_BOARD_STM3210C_EVAL) = stm3210c_eval.dts_compiled dtb-$(CONFIG_BOARD_STM32_MINI_A15) = stm32_mini_a15.dts_compiled diff --git a/dts/arm/nucleo_f413zh.dts b/dts/arm/nucleo_f413zh.dts new file mode 100644 index 00000000000..aafe940f7bf --- /dev/null +++ b/dts/arm/nucleo_f413zh.dts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017 Florian Vaussard, HEIG-VD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "STMicroelectronics STM32F413ZH-NUCLEO board"; + compatible = "st,stm32f413zh-nucleo", "st,stm32f413"; + + chosen { + zephyr,console = &usart3; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; +}; + +&usart3 { + current-speed = <115200>; + status = "ok"; +}; diff --git a/dts/arm/nucleo_f413zh.fixup b/dts/arm/nucleo_f413zh.fixup new file mode 100644 index 00000000000..b8fb1c8750f --- /dev/null +++ b/dts/arm/nucleo_f413zh.fixup @@ -0,0 +1,13 @@ +/* This file is a temporary workaround for mapping of the generated information + * to the current driver definitions. This will be removed when the drivers + * are modified to handle the generated information, or the mapping of + * generated data matches the driver definitions. + */ + + +#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS + +#define CONFIG_UART_STM32_PORT_3_BASE_ADDRESS ST_STM32_USART_40004800_BASE_ADDRESS +#define CONFIG_UART_STM32_PORT_3_BAUD_RATE ST_STM32_USART_40004800_CURRENT_SPEED +#define CONFIG_UART_STM32_PORT_3_IRQ_PRI ST_STM32_USART_40004800_IRQ_0_PRIORITY +#define PORT_3_IRQ ST_STM32_USART_40004800_IRQ_0 diff --git a/scripts/sanity_chk/arches/arm.ini b/scripts/sanity_chk/arches/arm.ini index dbe0640545f..2b675ddff54 100644 --- a/scripts/sanity_chk/arches/arm.ini +++ b/scripts/sanity_chk/arches/arm.ini @@ -8,6 +8,7 @@ platforms = qemu_cortex_m3 frdm_k64f arduino_due nucleo_f103rb stm32_mini_a15 stm3210c_eval nucleo_f334r8 stm32373c_eval mps2_an385 frdm_kw41z sam_e70_xplained curie_ble nrf52_blenano2 hexiwear_kw40z cc3220sf_launchxl frdm_kl25z disco_l475_iot1 nucleo_l432kc + nucleo_f413zh supported_toolchains = zephyr gccarmemb