boards: arm: Add board definition for Adafruit Feather STM32F405 Express

Added board definition additions for adafruit_feather_stm32f405 board.

Signed-off-by: Lucian Copeland <hierophect@gmail.com>
This commit is contained in:
Lucian Copeland 2020-02-25 13:26:00 -05:00 committed by Johan Hedberg
commit dcacaf7078
10 changed files with 336 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()

View file

@ -0,0 +1,8 @@
# Adafruit Feather STM32F405 Express board configuration
# Copyright (c) 2020 Lucian Copeland for Adafruit Industries
# SPDX-License-Identifier: Apache-2.0
config BOARD_ADAFRUIT_FEATHER_STM32F405
bool "Feather STM32F405 Express Board"
depends on SOC_STM32F405XG

View file

@ -0,0 +1,23 @@
# Adafruit Feather STM32F405 Express board configuration
# Copyright (c) 2020 Lucian Copeland for Adafruit Industries.
# SPDX-License-Identifier: Apache-2.0
if BOARD_ADAFRUIT_FEATHER_STM32F405
config BOARD
default "adafruit_feather_stm32f405"
config UART_3
default y
depends on UART_CONSOLE
config I2C_1
default y
depends on I2C
config SPI_2
default y
depends on SPI
endif # BOARD_ADAFRUIT_FEATHER_STM32F405

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/f4/stm32f405Xg.dtsi>
/ {
model = "Adafruit Feather STM32F405 Express";
compatible = "st,adafruit_feather_stm32f405", "st,stm32f405";
chosen {
zephyr,console = &usart3;
zephyr,shell-uart = &usart3;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ccm = &ccm0;
};
leds {
compatible = "gpio-leds";
led: led {
gpios = <&gpioc 1 GPIO_INT_ACTIVE_HIGH>;
label = "User LED";
};
};
aliases {
led0 = &led;
};
};
&usart3 {
current-speed = <115200>;
status = "okay";
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
};
&spi2 {
status = "okay";
};
&rtc {
status = "okay";
};
&usbotg_fs {
status = "okay";
};

View file

@ -0,0 +1,14 @@
identifier: adafruit_feather_stm32f405
name: ADAFRUIT_FEATHER_STM32F405
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 128
flash: 1024
supported:
- i2c
- spi
- usb

View file

@ -0,0 +1,38 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_STM32F4X=y
CONFIG_SOC_STM32F405XG=y
# 168MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=168000000
# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_SERIAL=y
# console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=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=12000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# use HSE as PLL input
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
# produce 168MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=12
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=336
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=7
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=4
CONFIG_CLOCK_STM32_APB2_PRESCALER=2

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
board_runner_args(jlink "--device=STM32F405RG" "--speed=4000")
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

View file

@ -0,0 +1,138 @@
.. _adafruit_feather_stm32f405:
Adafruit Feather STM32F405 Express
##################################
Overview
********
The Adafruit Feather STM32F405 is an ARM Development board in the
Feather standard layout, sharing peripheral placement with other
devices labeled as Feathers or FeatherWings. The board is equipped
with a lithium ion battery charger, native USB C connector, 2MB of
external flash memory, and SD card socket.
.. image:: img/f405feather.jpg
:width: 640px
:align: center
:alt: Adafruit Feather STM32F405 Express
Hardware
********
- STM32F405 Cortex M4 with FPU and 1MB Flash, 168MHz speed
- 192KB RAM total - 128 KB RAM + 64 KB program-only/cache RAM
- USB C power and data
- LiPo connector and charger
- SD socket on the bottom, connected to SDIO port
- 2 MB SPI Flash chip
- Built in NeoPixel indicator
- I2C, UART, GPIO, ADCs, DACs
- Qwiic/STEMMA-QT connector for fast I2C connectivity
- SWD SMT mount region on board underside.
Supported Features
==================
The Adafruit Feather STM32F405 board configuration supports the
following hardware features:
+-----------+------------+----------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================+
| NVIC | on-chip | nested vectored |
| | | interrupt controller |
+-----------+------------+----------------------+
| SYSTICK | on-chip | system clock |
+-----------+------------+----------------------+
| UART | on-chip | serial port |
+-----------+------------+----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+----------------------+
| I2C | on-chip | i2c |
+-----------+------------+----------------------+
| SPI | on-chip | spi |
+-----------+------------+----------------------+
| USB | on-chip | USB device |
+-----------+------------+----------------------+
Other hardware features are not supported by the Zephyr kernel.
Connections and IOs
===================
The `Adafruit Feather STM32F405 Express Learn site`_ has detailed
information about the board including `pinouts`_ and the `schematic`_.
System Clock
============
The STM32F405 is configured to use the 12MHz HSE Oscillator to produce
a 168MHz system clock.
Serial Port
===========
The STM32F405 UART 3 peripheral is available on the TX (PB10) and RX
(PB11) pins.
I2C Port
========
The STM32F405 I2C1 peripheral is available on the SDA (PB7) and SCL
(PB6) pins.
SPI Port
========
The STM32F405 SPI2 peripheral is available on the SCK (PB13), MI
(PB14) and MO (PB15) pins.
Programming and Debugging
*************************
DFU-Util programming is supported through Zephyr by default. Set up
of the built in DFU-Util bootloader is possible by following the
`instructions on the Learn website`_.
Flashing
========
#. Build the Zephyr kernel and the :ref:`blinky-sample` sample
application:
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_stm32f405
:goals: build
:compact:
#. On the Adafruit Feather STM32F405, connect the 3.3V pin to the B0
boot pin with a jumper wire.
#. Flash the image:
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_stm32f405
:goals: flash
:compact:
You should see the D13 LED blinking.
References
**********
.. target-notes::
.. _Adafruit Feather STM32F405 Express Learn site:
https://learn.adafruit.com/adafruit-stm32f405-feather-express/
.. _pinouts:
https://learn.adafruit.com/adafruit-stm32f405-feather-express/pinouts
.. _schematic:
https://learn.adafruit.com/adafruit-stm32f405-feather-express/downloads
.. _instructions on the Learn website:
https://learn.adafruit.com/adafruit-stm32f405-feather-express/dfu-bootloader-details

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <drivers/pinmux.h>
#include <sys/sys_io.h>
#include <pinmux/stm32/pinmux_stm32.h>
/* pin assignments for Feather STM32F405 board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_3
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_USART3_TX},
{STM32_PIN_PB11, STM32F4_PINMUX_FUNC_PB11_USART3_RX},
#endif /* CONFIG_UART_3 */
#ifdef CONFIG_I2C_1
{STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_I2C1_SCL},
{STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_I2C1_SDA},
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_SPI_2
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_SPI2_SCK},
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
};
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);