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

boards/b-u585i-iot02a: add initial basic support

This commit is contained in:
Alexandre Abadie 2021-12-15 15:54:10 +01:00
parent 2f0efa8c9e
commit 62a682dd2c
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
12 changed files with 480 additions and 1 deletions

View File

@ -0,0 +1,28 @@
# Copyright (c) 2021 Inria
#
# 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.
#
config BOARD
default "b-u585i-iot02a" if BOARD_B_U585I_IOT02A
config BOARD_B_U585I_IOT02A
bool
default y
select CPU_MODEL_STM32U585AI
# Put defined MCU peripherals here (in alphabetical order)
select HAS_PERIPH_I2C
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
# Clock configuration
select BOARD_HAS_LSE
select HAVE_SAUL_GPIO
select HAVE_HTS221
select HAVE_LPS22HH
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

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

View File

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

View File

@ -0,0 +1,9 @@
CPU = stm32
CPU_MODEL = stm32u585ai
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# Put other features for this board (in alphabetical order)

View File

@ -0,0 +1,13 @@
# we use shared STM32 configuration snippets
INCLUDES += -I$(RIOTBOARD)/common/stm32/include
# this board has an on-board ST-link adapter
PROGRAMMER ?= openocd
OPENOCD_DEBUG_ADAPTER ?= stlink
# Add openocd as supported programmer
PROGRAMMERS_SUPPORTED += openocd
# The board can become un-flashable after some execution,
# use connect_assert_srst to always be able to flash or reset the board.
OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2021 Inria
*
* 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_b-u585i-iot02a
* @{
*
* @file
* @brief Board specific implementations for the ST B-U585I-IOT02A board
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
#ifdef AUTO_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
gpio_init(LED0_PIN, GPIO_OUT);
#endif
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
}

View File

@ -0,0 +1,43 @@
/**
@defgroup boards_b-u585i-iot02a STM32 B-U585I-IOT02A
@ingroup boards
@brief Support for the STM32 B-U585I-IOT02A
## Flashing the device
The ST B-U585I-IOT02A board includes an on-board ST-LINK programmer and can be
flashed using OpenOCD.
@note The latest release (v0.11) of OpenOCD doesn't contain yet support for this board,
so the source code version from upstream master must be cloned and built:
```
$ git clone https://git.code.sf.net/p/openocd/code openocd
$ cd openocd
$ ./bootstrap
$ ./configure --prefix=<installation directory>
$ make -j
$ sudo make install
```
Once the patched OpenOCD is built and installed, you can flash the board simply
by typing
```
make BOARD=b-u585i-iot02a flash
```
and debug via GDB by simply typing
```
make BOARD=b-u585i-iot02a debug
```
## Supported Toolchains
For using the ST B-U585I-IOT02A board we recommend the usage of the
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded)
toolchain.
**Important notice:** With GCC 10, the `tests/malloc` application doesn't work.
To use malloc, prefer GCC 9 which seems to work better.
*/

View File

@ -0,0 +1,88 @@
/*
* Copyright (C) 2021 Inria
*
* 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_b-u585i-iot02a
* @{
*
* @file
* @brief Board specific definitions for the ST B-U585I-IOT02A board
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_E, 13)
#define LED0_MASK (1 << 13)
#define LED0_ON (GPIOE->BSRR = LED0_MASK)
#define LED0_OFF (GPIOE->BSRR = (LED0_MASK << 16))
#define LED0_TOGGLE (GPIOE->ODR ^= LED0_MASK)
#define LED1_PIN GPIO_PIN(PORT_H, 6)
#define LED1_MASK (1 << 6)
#define LED1_ON (GPIOH->BSRR = LED1_MASK)
#define LED1_OFF (GPIOH->BSRR = (LED1_MASK << 16))
#define LED1_TOGGLE (GPIOH->ODR ^= LED1_MASK)
#define LED2_PIN GPIO_PIN(PORT_H, 7)
#define LED2_MASK (1 << 7)
#define LED2_ON (GPIOH->BSRR = LED2_MASK)
#define LED2_OFF (GPIOH->BSRR = (LED2_MASK << 16))
#define LED2_TOGGLE (GPIOH->ODR ^= LED2_MASK)
/** @} */
/**
* @name Button pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_C, 13)
#define BTN0_MODE GPIO_IN_PU
/** @} */
/**
* @name HTS221 temperature/humidity sensor configuration
* @{
*/
#define HTS221_PARAM_I2C I2C_DEV(1)
/** @} */
/**
* @name LPS22HH pressure/temperature sensor configuration
* @{
*/
#define LPSXXX_PARAM_I2C I2C_DEV(1)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,67 @@
/*
* Copyright (C) Inria 2021
*
* 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_b-u585i-iot02a
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#ifdef AUTO_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
{
.name = "LD2", /* Blue LED (Arduino D13) */
.pin = LED0_PIN,
.mode = GPIO_OUT
},
#endif
{
.name = "LD6", /* Red LED */
.pin = LED1_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "LD7", /* Green LED */
.pin = LED2_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
{
.name = "Button(B1 User)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
}
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,186 @@
/*
* Copyright (C) 2021 Inria
*
* 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_b-u585i-iot02a
* @{
*
* @file
* @brief Peripheral MCU configuration for the ST B-U585I-IOT02A board
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
/* Add specific clock configuration (HSE, LSE) for this board here */
#ifndef CONFIG_BOARD_HAS_LSE
#define CONFIG_BOARD_HAS_LSE 1
#endif
#include "periph_cpu.h"
#include "clk_conf.h"
#include "cfg_timer_tim5.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name UART configuration
* @{
*/
static const uart_conf_t uart_config[] = {
{
.dev = USART1,
.rcc_mask = RCC_APB2ENR_USART1EN,
.rx_pin = GPIO_PIN(PORT_A, 10),
.tx_pin = GPIO_PIN(PORT_A, 9),
.rx_af = GPIO_AF7,
.tx_af = GPIO_AF7,
.bus = APB2,
.irqn = USART1_IRQn,
.type = STM32_USART,
.clk_src = 0, /* Use APB clock */
},
{ /* Connected to Arduino D0/D1 and STMOD+2 */
.dev = USART3,
.rcc_mask = RCC_APB1ENR1_USART3EN,
.rx_pin = GPIO_PIN(PORT_D, 9),
.tx_pin = GPIO_PIN(PORT_D, 8),
.rx_af = GPIO_AF7,
.tx_af = GPIO_AF7,
.bus = APB1,
.irqn = USART3_IRQn,
.type = STM32_USART,
.clk_src = 0, /* Use APB clock */
},
{ /* Connected to STMOD+1 */
.dev = USART2,
.rcc_mask = RCC_APB1ENR1_USART2EN,
.rx_pin = GPIO_PIN(PORT_A, 3),
.tx_pin = GPIO_PIN(PORT_A, 2),
.rx_af = GPIO_AF7,
.tx_af = GPIO_AF7,
.bus = APB1,
.irqn = USART2_IRQn,
.type = STM32_USART,
.clk_src = 0, /* Use APB clock */
},
{ /* Connected to Wireless */
.dev = UART4,
.rcc_mask = RCC_APB1ENR1_UART4EN,
.rx_pin = GPIO_PIN(PORT_C, 11),
.tx_pin = GPIO_PIN(PORT_C, 10),
.rx_af = GPIO_AF7,
.tx_af = GPIO_AF7,
.bus = APB1,
.irqn = UART4_IRQn,
.type = STM32_USART,
.clk_src = 0, /* Use APB clock */
},
};
#define UART_0_ISR (isr_usart1)
#define UART_1_ISR (isr_usart3)
#define UART_2_ISR (isr_usart2)
#define UART_3_ISR (isr_uart4)
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = SPI1,
.mosi_pin = GPIO_PIN(PORT_E, 15), /* Arduino D11 */
.miso_pin = GPIO_PIN(PORT_E, 14), /* Arduino D12 */
.sclk_pin = GPIO_PIN(PORT_E, 13), /* Arduino D13 */
.cs_pin = GPIO_UNDEF,
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2,
},
{ /* Connected to wireless */
.dev = SPI2,
.mosi_pin = GPIO_PIN(PORT_D, 4),
.miso_pin = GPIO_PIN(PORT_D, 3),
.sclk_pin = GPIO_PIN(PORT_D, 1),
.cs_pin = GPIO_PIN(PORT_B, 12),
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR1_SPI2EN,
.apbbus = APB1,
},
{ /* Connected to STMOD+ 2 */
.dev = SPI3,
.mosi_pin = GPIO_PIN(PORT_D, 6),
.miso_pin = GPIO_PIN(PORT_G, 10),
.sclk_pin = GPIO_PIN(PORT_G, 9),
.cs_pin = GPIO_PIN(PORT_G, 12),
.mosi_af = GPIO_AF5,
.miso_af = GPIO_AF5,
.sclk_af = GPIO_AF5,
.cs_af = GPIO_AF5,
.rccmask = RCC_APB3ENR_SPI3EN,
.apbbus = APB3,
},
};
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
* @name I2C configuration
* @{
*/
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_APB1ENR1_I2C1EN,
.irqn = I2C1_ER_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_APB1ENR1_I2C2EN,
.irqn = I2C2_ER_IRQn,
},
};
#define I2C_0_ISR isr_i2c1_er
#define I2C_1_ISR isr_i2c2_er
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */

3
boards/common/stm32/dist/stm32u5.cfg vendored Normal file
View File

@ -0,0 +1,3 @@
source [find target/stm32u5x.cfg]
reset_config srst_only
$_TARGETNAME configure -rtos auto

View File

@ -33,7 +33,8 @@ static const timer_conf_t timer_config[] = {
{
.dev = TIM5,
.max = 0xffffffff,
#if defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32L5)
#if defined(CPU_FAM_STM32G4) || defined(CPU_FAM_STM32L5) || \
defined(CPU_FAM_STM32U5)
.rcc_mask = RCC_APB1ENR1_TIM5EN,
#else
.rcc_mask = RCC_APB1ENR_TIM5EN,