1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/stm32f469i-disco: Add board

This commit is contained in:
luisan00 2021-09-27 19:13:06 +02:00 committed by kl
parent af4c01bbc6
commit 50277d31e9
10 changed files with 571 additions and 0 deletions

View File

@ -0,0 +1,24 @@
config BOARD
default "stm32f469i-disco" if BOARD_STM32F469I_DISCO
config BOARD_STM32F469I_DISCO
bool
default y
select CPU_MODEL_STM32F469NI
# MCU peripherals (in alphabetical order)
select HAS_PERIPH_ADC
select HAS_PERIPH_DMA
select HAS_PERIPH_I2C
select HAS_PERIPH_PWM
select HAS_PERIPH_RTC
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
# Clock configuration
select BOARD_HAS_HSE
select BOARD_HAS_LSE
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -0,0 +1,3 @@
MODULE = board
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,13 @@
CPU = stm32
CPU_MODEL = stm32f469ni
# MCU peripherals (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev

View File

@ -0,0 +1,11 @@
# we use shared STM32 configuration snippets
INCLUDES += -I$(RIOTBOARD)/common/stm32/include
# this board uses openocd
PROGRAMMER ?= openocd
# this board has an on-board ST-link adapter
OPENOCD_DEBUG_ADAPTER ?= stlink
# openocd programmer is supported
PROGRAMMERS_SUPPORTED += openocd

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2021 luisan00
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup boards_stm32f469i-disco
* @{
*
* @file
* @brief Board specific implementations for the STM32F469I-DISCO board
*
* @author Luis A. Ruiz <luisan00@hotmail.com>
* @}
*/
#include "board.h"
#include "periph/gpio.h"
#include <stdio.h>
void board_init(void)
{
cpu_init();
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
gpio_init(LED3_PIN, GPIO_OUT);
}

View File

@ -0,0 +1,99 @@
/**
* @defgroup boards_stm32f469i-disco STM32F469I-DISCO
* @ingroup boards
* @brief Support for the STM32F469I-DISCO board
*/
## Table of Contents:
1. Overview
2. Hardware
3. Connectors and Pinout
4. Buttons, LEDS and other devices
5. Working with this Dev-Kit.
## Overview
The STM32F469I Discovery kit is a complete development platform for powered by ARM Cortex-M4 core-based
STM32F469NIH6 MCU.
The MCU presents a large list of peripherals available, but specifically this development board exposes:
## Hardware
| MCU | STM32F469Ixx |
|:----------------- |:------------------------|
| Family | ARM Cortex-M4F |
| Vendor | ST Microelectronics |
| RAM | 384+4 KiB |
| Flash | 2 MiB |
| Frequency | 180 MHz |
| FPU | Yes |
| Timers | 12 |
| ADCs | 3 12-bit (16 channels each) |
| DACs | 2 12-bit |
| USARTs | 4 |
| UARTs | 4 |
| SPIs | 6 |
| I2Cs | 3 |
| I2Ss | 2 |
| CANs | 2 |
| USBs | 1 Full Speed |
| Ethernet MAC | Yes |
| RNG | Yes |
| Vcc | 1.7V - 3.6V |
| Datasheet | [MCU Datasheet](https://www.st.com/resource/en/datasheet/stm32f469ae.pdf) (pdf) |
| Reference Manual | [Dev-Kit Reference Manual](https://www.st.com/resource/en/user_manual/um1932-discovery-kit-with-stm32f469ni-mcu-stmicroelectronics.pdf) (pdf)|
## Connectors and Pinout
- 1 USB Mini-B used by the On-board ST-LINK debugger (Ref.CN1)
- 1 USB Micro-AB Full speed (Ref. CN13)
- Arduino(R) Uno expansion connectors (Refs. CN5/6/7/8)
- microSD(tm) card receptacle.
- Audio 3.5 mm stereo jack
Through 2 connector we have available:
### CN11
- I2C1
- Reset
Also provides power pins, 3V3 and GND
### CN12
This extension connector gives access to:
- CAN2
- USART6 (Tx, Rx)
- I2S2
- SPI1
- 7 timers channels.
- Speaker output (1W)
Also provides some system signals and power.
**Important!** note than some pins are shared between peripherals.
## Buttons, LEDS and other devices
- 1 Button for reset.
- 1 User button.
- 4 LEDs.
- 3 Digital microphones
- 1 LCD Color 4"
## Working with this Dev-Kit
There are two requirements to start,first of them is the **gcc-arm-embedded** toolchain,
we can follow the usual process [here](https://github.com/RIOT-OS/RIOT/wiki/Family:-ARM).
The other requirement is **OpenOCD**, also we can follow the usual process
[here](https://github.com/RIOT-OS/RIOT/wiki/OpenOCD)
Once both things are installed and ready to work just connect the board through
the USB Mini-B connector try to compile and flash some code, type:
```
make flash BOARD=stm32f469i-disco
```

View File

@ -0,0 +1,83 @@
/*
* Copyright (C) 2021 luisan00
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup boards_stm32f469i-disco
* @{
*
* @file
* @brief Board specific definitions for the STM32F469I-DISCO board
*
* @author Luis A. Ruiz <luisan00@hotmail.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "periph_conf.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @name Macros for controlling the on-board LEDs
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_G, 6)
#define LED1_PIN GPIO_PIN(PORT_D, 4)
#define LED2_PIN GPIO_PIN(PORT_D, 5)
#define LED3_PIN GPIO_PIN(PORT_K, 3)
#define LED0_PORT GPIOG
#define LED1_PORT GPIOD
#define LED2_PORT GPIOD
#define LED3_PORT GPIOK
#define LED0_MASK (1 << 6)
#define LED1_MASK (1 << 4)
#define LED2_MASK (1 << 5)
#define LED3_MASK (1 << 3)
#define LED0_ON (LED0_PORT->BSRR = LED0_MASK)
#define LED0_OFF (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
#define LED1_ON (LED1_PORT->BSRR = LED1_MASK)
#define LED1_OFF (LED1_PORT->BSRR = (LED1_MASK << 16))
#define LED1_TOGGLE (LED1_PORT->ODR ^= LED1_MASK)
#define LED2_ON (LED2_PORT->BSRR = LED2_MASK)
#define LED2_OFF (LED2_PORT->BSRR = (LED2_MASK << 16))
#define LED2_TOGGLE (LED2_PORT->ODR ^= LED2_MASK)
#define LED3_ON (LED3_PORT->BSRR = LED3_MASK)
#define LED3_OFF (LED3_PORT->BSRR = (LED3_MASK << 16))
#define LED3_TOGGLE (LED3_PORT->ODR ^= LED3_MASK)
/** @} */
/**
* @name User button
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_A, 0)
#define BTN0_MODE GPIO_IN
/** @} */
/**
* @brief Initialize board specific hardware
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,54 @@
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @name LEDs and BTN configuration
* @{
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED1",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INIT_SET,
},
{
.name = "LED2",
.pin = LED1_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INIT_SET,
},
{
.name = "LED3",
.pin = LED2_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INIT_SET,
},
{
.name = "LED4",
.pin = LED3_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INIT_SET,
},
{
.name = "BTN USER",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,249 @@
/*
* Copyright (C) 2021 luisan00
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup boards_stm32f469i-disco
* @{
* @file
* @brief Peripheral MCU configuration for the STM32F469I-DISCO
* @author Luis A. Ruiz <luisan00@hotmail.com>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
/* This board provides a LSE, marked as X3 on the board */
#ifndef CONFIG_BOARD_HAS_LSE
#define CONFIG_BOARD_HAS_LSE 1
#endif
/* This board provides a HSE, marked as X2 on the board */
#ifndef CONFIG_BOARD_HAS_HSE
#define CONFIG_BOARD_HAS_HSE 1
#endif
/* The HSE provides a 8MHz clock */
#define CLOCK_HSE MHZ(8)
#include "periph_cpu.h"
#include "clk_conf.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_tim2.h"
#include "cfg_usb_otg_fs.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @name DMA streams configuration
* @{
*/
static const dma_conf_t dma_config[] = {
{.stream = 14}, /* DMA2 Stream 6 - SPI TX */
{.stream = 13}, /* DMA2 Stream 5 - SPI RX */
};
#define DMA_0_ISR isr_dma2_stream6
#define DMA_1_ISR isr_dma2_stream5
#define DMA_NUMOF ARRAY_SIZE(dma_config)
/** @} */
/**
* @name UART configuration
* UART_DEV(0): Is used as Virtual Com Port for the STLINK, not available pyshically
* UART_DEV(1): Available on CN12 and Arduino(R) expansion connector CN7
* @{
*/
static const uart_conf_t uart_config[] = {
{
.dev = USART3,
.rcc_mask = RCC_APB1ENR_USART3EN,
.rx_pin = GPIO_PIN(PORT_B, 11),
.tx_pin = GPIO_PIN(PORT_B, 10),
.rx_af = GPIO_AF7,
.tx_af = GPIO_AF7,
.bus = APB1,
.irqn = USART3_IRQn,
#ifdef MODULE_PERIPH_DMA
.dma = DMA_STREAM_UNDEF,
.dma_chan = UINT8_MAX
#endif
},
{
.dev = USART6,
.rcc_mask = RCC_APB2ENR_USART6EN,
.rx_pin = GPIO_PIN(PORT_C, 7),
.tx_pin = GPIO_PIN(PORT_C, 6),
.rx_af = GPIO_AF8,
.tx_af = GPIO_AF8,
.bus = APB2,
.irqn = USART6_IRQn,
#ifdef MODULE_PERIPH_DMA
.dma = DMA_STREAM_UNDEF,
.dma_chan = UINT8_MAX
#endif
},
};
#define UART_0_ISR (isr_usart3)
#define UART_1_ISR (isr_usart6)
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @name I2C configuration
*
* DEV_I2C(0): Available on the connector CN11
* and the Arduino(R) connector CN5 ONLY if we have the next configuration
* on the solder bridges; open SB10 and SB12, close SB9 and SB11.
* For more information see the user manual.
*
* DEV_I2C(1): Is not physically available but
* it's used for the audio DAC-SAI, with address 0x94
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = I2C1,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_B, 8),
.sda_pin = GPIO_PIN(PORT_B, 9),
.scl_af = GPIO_AF4,
.sda_af = GPIO_AF4,
.bus = APB1,
.rcc_mask = RCC_APB1ENR_I2C1EN,
.clk = CLOCK_APB1,
.irqn = I2C1_EV_IRQn,
},
{
.dev = I2C2,
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PORT_H, 4),
.sda_pin = GPIO_PIN(PORT_H, 5),
.scl_af = GPIO_AF4,
.sda_af = GPIO_AF4,
.bus = APB1,
.rcc_mask = RCC_APB1ENR_I2C2EN,
.clk = CLOCK_APB1,
.irqn = I2C2_EV_IRQn,
},
};
#define I2C_0_ISR isr_i2c1_ev
#define I2C_1_ISR isr_i2c2_ev
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @}*/
/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = SPI2,
.mosi_pin = GPIO_PIN(PORT_B, 15),
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_D, 3),
.cs_pin = GPIO_PIN(PORT_H, 6),
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR_I2C2EN,
.apbbus = APB1,
#ifdef MODULE_PERIPH_DMA
.tx_dma = 0,
.tx_dma_chan = 6,
.rx_dma = 1,
.rx_dma_chan = 6,
#endif
},
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
* @name PWM configuration
* @{
*/
static const pwm_conf_t pwm_config[] = {
{
.dev = TIM3,
.rcc_mask = RCC_APB1ENR_TIM3EN,
.chan = {
{.pin = GPIO_PIN(PORT_A, 6), .cc_chan = 0}, /* D6 */
{.pin = GPIO_PIN(PORT_B, 5), .cc_chan = 1}, /* CN12-P9 */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
},
.af = GPIO_AF2,
.bus = APB1,
},
{
.dev = TIM5,
.rcc_mask = RCC_APB1ENR_TIM5EN,
.chan = {
{.pin = GPIO_PIN(PORT_A, 1), .cc_chan = 1}, /* D5 */
{.pin = GPIO_PIN(PORT_A, 2), .cc_chan = 2}, /* D3 */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
},
.af = GPIO_AF2,
.bus = APB1,
},
{
.dev = TIM12,
.rcc_mask = RCC_APB1ENR_TIM12EN,
.chan = {
{.pin = GPIO_PIN(PORT_H, 6), .cc_chan = 0}, /* D10 */
{.pin = GPIO_PIN(PORT_B, 15), .cc_chan = 1}, /* D11 */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
},
.af = GPIO_AF9,
.bus = APB1,
},
{
.dev = TIM14,
.rcc_mask = RCC_APB1ENR_TIM14EN,
.chan = {
{.pin = GPIO_PIN(PORT_A, 7), .cc_chan = 0}, /* D9 */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
{.pin = GPIO_UNDEF, .cc_chan = 0}, /* unused */
},
.af = GPIO_AF9,
.bus = APB1,
},
};
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */
/**
* @name ADC configuration
*
* Not all ADCs are configured, by now, only the 6 ones available
* on the Arduino(R) connector A0-A5
* @{
*/
static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_B, 1), 2, 9},
{GPIO_PIN(PORT_C, 2), 2, 12},
{GPIO_PIN(PORT_C, 3), 2, 13},
{GPIO_PIN(PORT_C, 4), 2, 14},
{GPIO_PIN(PORT_C, 5), 2, 15},
{GPIO_PIN(PORT_A, 4), 2, 4},
};
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */