-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: add stm32l496g-disco support
- Loading branch information
Showing
11 changed files
with
1,044 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (c) 2020 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 "stm32l496g-disco" if BOARD_STM32L496G_DISCO | ||
|
||
config BOARD_STM32L496G_DISCO | ||
bool | ||
default y | ||
select CPU_MODEL_STM32L496AG | ||
|
||
# Put defined MCU peripherals here (in alphabetical order) | ||
select HAS_PERIPH_ADC | ||
select HAS_PERIPH_DAC | ||
select HAS_PERIPH_DMA | ||
select HAS_PERIPH_I2C | ||
select HAS_PERIPH_LPUART | ||
select HAS_PERIPH_RTC | ||
select HAS_PERIPH_RTT | ||
select HAS_PERIPH_PWM | ||
select HAS_PERIPH_SPI | ||
select HAS_PERIPH_SPI_MOD | ||
select HAS_PERIPH_TIMER | ||
select HAS_PERIPH_UART | ||
select HAS_PERIPH_UART_HW_FC | ||
select HAS_PERIPH_USBDEV | ||
|
||
# Put other features for this board (in alphabetical order) | ||
select HAS_ARDUINO | ||
select HAS_RIOTBOOT | ||
select HAS_TINYUSB_DEVICE | ||
|
||
# Clock configuration | ||
select BOARD_HAS_LSE | ||
|
||
select HAVE_SAUL_GPIO | ||
select HAVE_FT5X06 | ||
|
||
select MODULE_PERIPH_LPUART if MODULE_PERIPH_UART | ||
select MODULE_PERIPH_UART_HW_FC if MODULE_PERIPH_UART && !MODULE_PERIPH_SPI_STMOD | ||
|
||
source "$(RIOTBOARD)/common/stm32/Kconfig" | ||
|
||
config HAS_PERIPH_SPI_MOD | ||
bool | ||
help | ||
Indicates that SPI2 can be connected to STMod+/Pmod connector | ||
|
||
config MODULE_PERIPH_SPI_STMOD | ||
bool "SPI2 connected to STMod+/Pmod connector" | ||
depends on HAS_PERIPH_SPI_MOD | ||
default n | ||
help | ||
By default, solder bridges SB6, SB7, SB8 are closed and USART1 is | ||
connected to the Pmod/STMmod+ connector. If these solder bridges are | ||
open and solder bridges SB4, SB5 and SB6 are closed instead, SPI2 is | ||
connected to the STMmod+/Pmod connector. Say yes to use SPI2 with this | ||
board configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MODULE = board | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ifneq (,$(filter saul_default,$(USEMODULE))) | ||
USEMODULE += saul_gpio | ||
endif | ||
|
||
ifneq (,$(filter stdio_uart,$(USEMODULE))) | ||
USEMODULE += periph_uart | ||
endif | ||
|
||
ifneq (,$(filter touch_dev,$(USEMODULE))) | ||
USEMODULE += ft5x06 | ||
endif | ||
|
||
ifneq (,$(filter periph_uart,$(USEMODULE))) | ||
USEMODULE += periph_lpuart | ||
ifeq (,$(filter periph_spi_stmod_plus,$(USEMODULE))) | ||
# if STMod+ is not used with SPI (default), the UART interface uses HW FC | ||
USEMODULE += periph_uart_hw_fc | ||
endif | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
CPU = stm32 | ||
CPU_MODEL = stm32l496ag | ||
|
||
# Put defined MCU peripherals here (in alphabetical order) | ||
FEATURES_PROVIDED += periph_adc | ||
FEATURES_PROVIDED += periph_dac | ||
FEATURES_PROVIDED += periph_dma | ||
FEATURES_PROVIDED += periph_i2c | ||
FEATURES_PROVIDED += periph_lpuart | ||
FEATURES_PROVIDED += periph_rtc | ||
FEATURES_PROVIDED += periph_rtt | ||
FEATURES_PROVIDED += periph_pwm | ||
FEATURES_PROVIDED += periph_spi | ||
FEATURES_PROVIDED += periph_spi_stmod | ||
FEATURES_PROVIDED += periph_timer | ||
FEATURES_PROVIDED += periph_uart | ||
FEATURES_PROVIDED += periph_uart_hw_fc | ||
FEATURES_PROVIDED += periph_usbdev | ||
|
||
# Put other features for this board (in alphabetical order) | ||
FEATURES_PROVIDED += arduino | ||
FEATURES_PROVIDED += riotboot | ||
FEATURES_PROVIDED += tinyusb_device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# we use shared STM32 configuration snippets | ||
INCLUDES += -I$(RIOTBOARD)/common/stm32/include | ||
|
||
# this board uses openocd with st-link | ||
PROGRAMMER ?= openocd | ||
# this board has an on-board ST-link adapter | ||
OPENOCD_DEBUG_ADAPTER ?= stlink | ||
|
||
# openocd programmer is supported | ||
PROGRAMMERS_SUPPORTED += openocd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/** | ||
* @defgroup boards_stm32l496g-disco STM32L496G-DISCO | ||
* @ingroup boards | ||
* @brief Support for the STM32L496G-DISCO board. | ||
|
||
## Overview | ||
|
||
The ST [STM32L496G-DISCO](https://www.st.com/en/evaluation-tools/32l496gdiscovery.html) | ||
is an evaluation board with the ARM Cortex-M4 based ultra-low power | ||
microcontroller STM32L496AG with 320KB of RAM and 1MB of ROM Flash. | ||
|
||
The main features of this board are: | ||
- 1.54 RGB 240 x 240 pixel TFT color LCD display with capacitive touch screen, | ||
- SAI audio codec, with stereo output, including analog microphone input | ||
- Stereo digital microphones | ||
- 8-Mbit external PSRAM | ||
- 64-Mbit external QSPI flash | ||
- USB OTG FS port | ||
- 8-bit camera interface | ||
- Stereo headset jack | ||
- micso-SD card connector | ||
|
||
## Current Hardware Support: | ||
|
||
| Feature | Support | Remark | | ||
|------------------------ |:-:| --------------------- | | ||
| ADC | X | 8 channels | | ||
| DAC | X | 1 or 2 channels | | ||
| I2C | X | 2 devices (I2C1 and I2C2) | | ||
| PWM | X | 3 devices with a total og 6 channels | | ||
| SPI | X | 1 or 2 devices (SPI1 and SPI2) | | ||
| Timers | X | 2 devices (TIM2 and TIM3) | | ||
| UART | X | 3 devices (USART2, LPUART1 and USART1) | | ||
| USB OTG FS | X | 1 device | | ||
| TFT color LCD 240 x 40 | - | ST7789H2 used as driver IC (not supported yet) | | ||
| Capacitive Touch Screen | - | FT3267 used as driver IC (not supported yet) | | ||
| Stereo microphones | - | | | ||
| SAI audio codec | - | | | ||
| External PSRAM | - | Connected to FMC peripheral (not supported yet) | | ||
| External Quad-SPI Flash | - | QSPI peripheral is not yet supported | | ||
| SD Card Interface | - | | | ||
|
||
## Board Configuration (sorted by peripheral): | ||
|
||
| RIOT Peripheral | GPIO | Connector pin | Remark | | ||
|:------------------|:----:|:--------------|:----------| | ||
| ADC_LINE(0) | PC4 | Arduino A0 | ADC1 IN13 | | ||
| ADC_LINE(1) | PC1 | Arduino A1 | ADC1 IN2 | | ||
| ADC_LINE(2) | PC3 | Arduino A2 | ADC1 IN4 | | ||
| ADC_LINE(3) | PF10 | Arduino A3 | ADC3 IN13 | | ||
| ADC_LINE(4) | PA1 | Arduino A4 | ADC1 IN6 | | ||
| ADC_LINE(5) | PC0 | Arduino A5 | ADC2 IN13 | | ||
| ADC_LINE(6) | - | V_REF_INT | ADC1 IN0 connected to V_REFINT | | ||
| ADC_LINE(7) | PA4 | STmod+ ADC | ADC1 IN9 if `periph_dac` is not used | | ||
| ADC_LINE(7) | - | - | ADC2 IN17 connected to DAC1 if `periph_dac` is used | | ||
| DAC_LINE(0) | PA4 | STmod+ ADC | DAC1 if `periph_dac` is used | | ||
| DAC_LINE(1) | PA5 | Arduino D13 | DAC2 if `periph_spi` is not used | | ||
| I2C_DEV(0) SCL | PB8 | Arduino D15 | I2C1 SCL, also connected to STmod+ SCL | | ||
| I2C_DEV(0) SDA | PB7 | Arduino D14 | I2C1 SDA, also connected to STmod+ SDA | | ||
| I2C_DEV(1) SCL | PH14 | - | I2C2 SCL, used for MFX_x, CODEC_x, CTP_x, DCMI_x | | ||
| I2C_DEV(1) SDA | PB14 | - | I2C2 SDA, used for MFX_x, CODEC_x, CTP_x, DCMI_x | | ||
| PWM_DEV(0) CH0 | PH15 | Arduino D3 | TIM8_CH3N | | ||
| PWM_DEV(0) CH1 | PI6 | Arduino D6 | TIM8_CH2 | | ||
| PWM_DEV(0) CH2 | PH13 | Arduino D9 | TIM8_CH1N | | ||
| PWM_DEV(1) CH0 | PB9 | Arduino D5 | TIM4_CH4 | | ||
| PWM_DEV(2) CH0 | PA0 | STmod+ PWM | TIM5_CH1 | | ||
| SPI_DEV(0) SCK | PA5 | Arduino D13 | SPI1 SCK | | ||
| SPI_DEV(0) MISO | PB4 | Arduino D12 | SPI1 MISO | | ||
| SPI_DEV(0) MOSI | PB5 | Arduino D11 | SPI1 MOSI | | ||
| SPI_DEV(0) CS | PA15 | Arduino D10 | SPI1 NSS | | ||
| SPI_DEV(1) SCK | PI1 | STmod+ CLK, Pmod CLK | SPI2 SCK (*1) | | ||
| SPI_DEV(1) MISO | PI2 | STmod+ MISO, Pmod MISO | SPI2 MISO (*1) | | ||
| SPI_DEV(1) MOSI | PB15 | STmod+ MOSI, Pmod MOSI | SPI2 MOSI (*1) | | ||
| SPI_DEV(1) CS | PG1 | STmod+ CS, Pmod CS | SPI2 NSS (*1) | | ||
| UART_DEV(0) RX | PD6 | ST-Link | USART2 RX | | ||
| UART_DEV(0) TX | PA2 | ST-Link | USART2 TX | | ||
| UART_DEV(1) RX | PD6 | Arduino D0 | LPUART1 RX | | ||
| UART_DEV(1) TX | PA2 | Arduino D1 | LPUART1 TX | | ||
| UART_DEV(2) RX | PG10 | STmod+ RX, Pmod RX | USART1 RX (*2) | | ||
| UART_DEV(2) TX | PB6 | STmod+ TX, Pmod TX | USART1 TX (*2) | | ||
| UART_DEV(2) CTS | PG11 | STmod+ CTS, Pmod CTS | USART1 CTS (*2) | | ||
| UART_DEV(2) RTS | PG12 | STmod+ RTS, Pmod RTS | USART1 RTS (*2) | | ||
<br> | ||
|
||
@note | ||
- (*1) SPI2 is only available if module `periph_spi_stmod` is used. | ||
SB4, SB5, SB9 must be closed to connect SPI2 to STmod+ and Pmod. | ||
- (*2) USART1 is only available if module `periph_spi_stmod` is not used. | ||
SB6, SB7, SB8 must be closed to connect USART1 to STmod+ and Pmod | ||
(default). | ||
|
||
## Board Configuration (sorted by connectors): | ||
|
||
| Connector | RIOT Peripheral | GPIO | Remark | | ||
|:----------------|:------------------|:----:|:-----------| | ||
| Arduino A0 | ADC_LINE(0) | PC4 | ADC1 IN13 | | ||
| Arduino A1 | ADC_LINE(1) | PC1 | ADC1 IN2 | | ||
| Arduino A2 | ADC_LINE(2) | PC3 | ADC1 IN4 | | ||
| Arduino A3 | ADC_LINE(3) | PF10 | ADC3 IN13 | | ||
| Arduino A4 | ADC_LINE(4) | PA1 | ADC1 IN6 | | ||
| Arduino A5 | ADC_LINE(5) | PC0 | ADC2 IN13 | | ||
| Arduino D0 | UART_DEV(1) RX | PD6 | LPUART1 RX | | ||
| Arduino D1 | UART_DEV(1) TX | PA2 | LPUART1 TX | | ||
| Arduino D3 | PWM_DEV(0) CH0 | PH15 | TIM8_CH3N | | ||
| Arduino D6 | PWM_DEV(0) CH1 | PI6 | TIM8_CH2 | | ||
| Arduino D5 | PWM_DEV(1) CH0 | PB9 | TIM4_CH4 | | ||
| Arduino D9 | PWM_DEV(0) CH2 | PH13 | TIM8_CH1N | | ||
| Arduino D10 | SPI_DEV(0) CS | PA15 | SPI1 CS | | ||
| Arduino D11 | SPI_DEV(0) MOSI | PB5 | SPI1 MOSI | | ||
| Arduino D12 | SPI_DEV(0) MISO | PB4 | SPI1 MISO | | ||
| Arduino D13 | SPI_DEV(0) SCK | PA5 | SPI1 SCK | | ||
| Arduino D13 | DAC_LINE(1) | PA5 | DAC2 if `periph_spi` is not used | | ||
| Arduino D14 | I2C_DEV(0) SDA | PB7 | I2C1 SDA | | ||
| Arduino D15 | I2C_DEV(0) SCL | PB8 | I2C1 SCL | | ||
| Pmod SPI CLK | SPI_DEV(1) SCK | PI1 | SPI2 SCK (*1) | | ||
| Pmod SPI CS | SPI_DEV(4) CS | PG1 | SPI2 NSS (*1) | | ||
| Pmod SPI MISO | SPI_DEV(2) MISO | PI2 | SPI2 MISO (*1) | | ||
| Pmod SPI MOSI | SPI_DEV(3) MOSI | PB15 | SPI2 MOSI (*1) | | ||
| Pmod UART CTS | UART_DEV(2) CTS | PG11 | USART1 CTS (*2) | | ||
| Pmod UART RTS | UART_DEV(2) RTS | PG12 | USART1 RTS (*2) | | ||
| Pmod UART RX | UART_DEV(2) RX | PG10 | USART1 RX (*2) | | ||
| Pmod UART TX | UART_DEV(2) TX | PB6 | USART1 TX (*2) | | ||
| STmod+ ADC | ADC_LINE(7) | PA4 | ADC1 IN9 if `periph_dac` is not used | | ||
| STmod+ ADC | DAC_LINE(0) | PA4 | DAC1 if `periph_dac` is used | | ||
| STmod+ PWM | PWM_DEV(2) CH0 | PA0 | TIM5_CH1 | | ||
| STmod+ I2C SCL | I2C_DEV(0) SCL | PB8 | I2C2 SCL | | ||
| STmod+ I2C SDA | I2C_DEV(0) SDA | PB7 | I2C2 SDA | | ||
| STmod+ SPI CLK | SPI_DEV(1) SCK | PI1 | SPI2 SCK (*1) | | ||
| STmod+ SPI CS | SPI_DEV(1) CS | PG1 | SPI2 NSS (*1) | | ||
| STmod+ SPI MISO | SPI_DEV(1) MISO | PI2 | SPI2 MISO (*1) | | ||
| STmod+ SPI MOSI | SPI_DEV(1) MOSI | PB15 | SPI2 MOSI (*1) | | ||
| STmod+ UART CTS | UART_DEV(2) CTS | PG11 | USART1 CTS (*2) | | ||
| STmod+ UART RTS | UART_DEV(2) RTS | PG12 | USART1 RTS (*2) | | ||
| STmod+ UART RX | UART_DEV(2) RX | PG10 | USART1 RX (*2) | | ||
| STmod+ UART TX | UART_DEV(2) TX | PB6 | USART1 TX (*2) | | ||
| ST-Link | UART_DEV(0) RX | PD6 | USART2 RX | | ||
| ST-Link | UART_DEV(0) TX | PA2 | USART2 TX | | ||
<br> | ||
|
||
@note | ||
- (*1) SPI2 is only available if module `periph_spi_stmod` is used. | ||
SB4, SB5, SB9 must be closed to connect SPI2 to STmod+ and Pmod. | ||
- (*2) USART1 is only available if module `periph_spi_stmod` is not used. | ||
SB6, SB7, SB8 must be closed to connect USART1 to STmod+ and Pmod | ||
(default). | ||
|
||
## Flashing the device | ||
|
||
The STM32L496G-DISCO board includes an on-board ST-LINK programmer and can be | ||
flashed using OpenOCD. The board can be flashed with: | ||
|
||
``` | ||
make BOARD=stm32l496g-disco flash | ||
``` | ||
|
||
and debug via GDB with | ||
``` | ||
make BOARD=stm32l496g-disco debug | ||
``` | ||
|
||
## Supported Toolchains | ||
|
||
For using the STM32L496G-DISCO board we recommend the usage of the | ||
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded) | ||
toolchain. | ||
|
||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2017 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_stm32l496g-disco | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific configuration for the Arduino API | ||
* | ||
* @author Alexandre Abadie <[email protected]> | ||
*/ | ||
|
||
#ifndef ARDUINO_BOARD_H | ||
#define ARDUINO_BOARD_H | ||
|
||
#include "arduino_pinmap.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Look-up table for the Arduino's digital pins | ||
*/ | ||
static const gpio_t arduino_pinmap[] = { | ||
ARDUINO_PIN_0, | ||
ARDUINO_PIN_1, | ||
ARDUINO_PIN_2, | ||
ARDUINO_PIN_3, | ||
ARDUINO_PIN_4, | ||
ARDUINO_PIN_5, | ||
ARDUINO_PIN_6, | ||
ARDUINO_PIN_7, | ||
ARDUINO_PIN_8, | ||
ARDUINO_PIN_9, | ||
ARDUINO_PIN_10, | ||
ARDUINO_PIN_11, | ||
ARDUINO_PIN_12, | ||
ARDUINO_PIN_13, | ||
ARDUINO_PIN_14, | ||
ARDUINO_PIN_15, | ||
ARDUINO_PIN_A0, | ||
ARDUINO_PIN_A1, | ||
ARDUINO_PIN_A2, | ||
ARDUINO_PIN_A3, | ||
ARDUINO_PIN_A4, | ||
ARDUINO_PIN_A5, | ||
}; | ||
|
||
/** | ||
* @brief Look-up table for the Arduino's analog pins | ||
*/ | ||
static const adc_t arduino_analog_map[] = { | ||
ARDUINO_A0, | ||
ARDUINO_A1, | ||
ARDUINO_A2, | ||
ARDUINO_A3, | ||
ARDUINO_A4, | ||
ARDUINO_A5, | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ARDUINO_BOARD_H */ | ||
/** @} */ |
Oops, something went wrong.