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

boards/stm32l496g-disco: add SDMMC support

This commit is contained in:
Gunar Schorcht 2023-05-10 13:43:36 +02:00
parent ae4ba633d9
commit 2c2e70fb17
5 changed files with 63 additions and 14 deletions

View File

@ -25,6 +25,7 @@ config BOARD_STM32L496G_DISCO
select HAS_PERIPH_RTC select HAS_PERIPH_RTC
select HAS_PERIPH_RTT select HAS_PERIPH_RTT
select HAS_PERIPH_PWM select HAS_PERIPH_PWM
select HAS_PERIPH_SDMMC
select HAS_PERIPH_SPI select HAS_PERIPH_SPI
select HAS_PERIPH_SPI_STMOD select HAS_PERIPH_SPI_STMOD
select HAS_PERIPH_TIMER select HAS_PERIPH_TIMER
@ -43,6 +44,7 @@ config BOARD_STM32L496G_DISCO
select HAVE_SAUL_GPIO select HAVE_SAUL_GPIO
select HAVE_FT5X06 select HAVE_FT5X06
select HAVE_MTD_SDMMC_DEFAULT
select HAVE_ST7789 select HAVE_ST7789
select HAVE_LCD_PARALLEL_16BIT if MODULE_ST7789 select HAVE_LCD_PARALLEL_16BIT if MODULE_ST7789
select HAVE_LCD_PARALLEL_LL_MCU if MODULE_ST7789 select HAVE_LCD_PARALLEL_LL_MCU if MODULE_ST7789

View File

@ -31,3 +31,14 @@ ifneq (,$(filter st7789,$(USEMODULE)))
USEMODULE += lcd_parallel_ll_mcu USEMODULE += lcd_parallel_ll_mcu
FEATURES_REQUIRED += periph_fmc_nor_sram FEATURES_REQUIRED += periph_fmc_nor_sram
endif endif
# default to using fatfs on SD card
ifneq (,$(filter vfs_default,$(USEMODULE)))
USEMODULE += fatfs_vfs
USEMODULE += mtd
endif
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += mtd_sdmmc_default
USEMODULE += periph_sdmmc
endif

View File

@ -13,6 +13,7 @@ FEATURES_PROVIDED += periph_lpuart
FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_sdmmc
FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_spi_stmod FEATURES_PROVIDED += periph_spi_stmod
FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_timer

View File

@ -38,7 +38,7 @@ The main features of this board are:
| SAI audio codec | - | | | SAI audio codec | - | |
| External PSRAM | x | Connected to FMC peripheral | | External PSRAM | x | Connected to FMC peripheral |
| External Quad-SPI Flash | - | QSPI peripheral is not yet supported | | External Quad-SPI Flash | - | QSPI peripheral is not yet supported |
| SD Card Interface | - | | | SD Card Interface | - | SDMMC1 on PC8..PC13/PD2 |
## Board Configuration (sorted by peripheral): ## Board Configuration (sorted by peripheral):

View File

@ -106,7 +106,7 @@ static const adc_conf_t adc_config[] = {
{ .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 13 }, /* A5, ADC12_IN13, SB28 closed */ { .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 13 }, /* A5, ADC12_IN13, SB28 closed */
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 0 }, /* V_REFINT, ADC1_IN0 */ { .pin = GPIO_UNDEF, .dev = 0, .chan = 0 }, /* V_REFINT, ADC1_IN0 */
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 18 }, /* V_BAT, ADC1_IN18 */ { .pin = GPIO_UNDEF, .dev = 0, .chan = 18 }, /* V_BAT, ADC1_IN18 */
#ifndef MODULE_PERIPH_DAC #if !MODULE_PERIPH_DAC
{ .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 9 }, /* STMOD+_ADC, ADC12_IN9 */ { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 9 }, /* STMOD+_ADC, ADC12_IN9 */
#else #else
{ .pin = GPIO_UNDEF, .dev = 1, .chan = 17 }, /* DAC1, ADC2_IN17 */ { .pin = GPIO_UNDEF, .dev = 1, .chan = 17 }, /* DAC1, ADC2_IN17 */
@ -153,7 +153,7 @@ static const adc_conf_t adc_config[] = {
*/ */
static const dac_conf_t dac_config[] = { static const dac_conf_t dac_config[] = {
{ GPIO_PIN(PORT_A, 4), .chan = 0 }, /* STMod+_ADC pin */ { GPIO_PIN(PORT_A, 4), .chan = 0 }, /* STMod+_ADC pin */
#ifndef MODULE_PERIPH_SPI #if !MODULE_PERIPH_SPI
{ GPIO_PIN(PORT_A, 5), .chan = 1 }, /* Arduino D13, conflicts with SPI_DEV(0) */ { GPIO_PIN(PORT_A, 5), .chan = 1 }, /* Arduino D13, conflicts with SPI_DEV(0) */
#endif #endif
}; };
@ -397,6 +397,41 @@ static const pwm_conf_t pwm_config[] = {
#define PWM_NUMOF ARRAY_SIZE(pwm_config) #define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */ /** @} */
/**
* @name SDIO/SDMMC configuration
* @{
*/
/**
* @brief SDIO/SDMMC static configuration struct
*/
static const sdmmc_conf_t sdmmc_config[] = {
{
.dev = SDMMC1,
.bus = APB2,
.rcc_mask = RCC_APB2ENR_SDMMC1EN,
.cd = GPIO_UNDEF, /* CD is connected to MFX GPIO8 */
.clk = { GPIO_PIN(PORT_C, 12), GPIO_AF12 },
.cmd = { GPIO_PIN(PORT_D, 2), GPIO_AF12 },
.dat0 = { GPIO_PIN(PORT_C, 8), GPIO_AF12 },
.dat1 = { GPIO_PIN(PORT_C, 9), GPIO_AF12 },
.dat2 = { GPIO_PIN(PORT_C, 10), GPIO_AF12 },
.dat3 = { GPIO_PIN(PORT_C, 11), GPIO_AF12 },
#if MODULE_PERIPH_DMA
.dma = 6,
.dma_chan = 7,
#endif
.irqn = SDMMC1_IRQn
},
};
/**
* @brief Number of configured SDIO/SDMMC peripherals
*/
#define SDMMC_CONFIG_NUMOF 1
/** @} */
/** /**
* @name SPI configuration * @name SPI configuration
* *
@ -422,14 +457,14 @@ static const spi_conf_t spi_config[] = {
.cs_af = GPIO_AF5, .cs_af = GPIO_AF5,
.rccmask = RCC_APB2ENR_SPI1EN, .rccmask = RCC_APB2ENR_SPI1EN,
.apbbus = APB2, .apbbus = APB2,
#if IS_USED(MODULE_PERIPH_DMA) #if MODULE_PERIPH_DMA
.rx_dma = 0, /* DMA1 Channel 2 */ .rx_dma = 0, /* DMA1 Channel 2 */
.rx_dma_chan = 1, /* CxS = 1 */ .rx_dma_chan = 1, /* CxS = 1 */
.tx_dma = 1, /* DMA1 Channel 3 */ .tx_dma = 1, /* DMA1 Channel 3 */
.tx_dma_chan = 1, /* CxS = 1 */ .tx_dma_chan = 1, /* CxS = 1 */
#endif #endif
}, },
#if IS_USED(MODULE_PERIPH_SPI_STMOD) #if MODULE_PERIPH_SPI_STMOD
{ /* Pmod/STMod+ connector if solder bridges SB4, SB5, SB9 are closed */ { /* Pmod/STMod+ connector if solder bridges SB4, SB5, SB9 are closed */
.dev = SPI2, .dev = SPI2,
.mosi_pin = GPIO_PIN(PORT_B, 15), .mosi_pin = GPIO_PIN(PORT_B, 15),
@ -442,7 +477,7 @@ static const spi_conf_t spi_config[] = {
.cs_af = GPIO_AF5, .cs_af = GPIO_AF5,
.rccmask = RCC_APB1ENR1_SPI2EN, .rccmask = RCC_APB1ENR1_SPI2EN,
.apbbus = APB1, .apbbus = APB1,
#if IS_USED(MODULE_PERIPH_DMA) #if MODULE_PERIPH_DMA
.rx_dma = 2, /* DMA1 Channel 4 */ .rx_dma = 2, /* DMA1 Channel 4 */
.rx_dma_chan = 1, /* CxS = 1 */ .rx_dma_chan = 1, /* CxS = 1 */
.tx_dma = 3, /* DMA1 Channel 5 */ .tx_dma = 3, /* DMA1 Channel 5 */
@ -503,13 +538,13 @@ static const uart_conf_t uart_config[] = {
.tx_af = GPIO_AF7, .tx_af = GPIO_AF7,
.bus = APB1, .bus = APB1,
.irqn = USART2_IRQn, .irqn = USART2_IRQn,
#if IS_USED(MODULE_PERIPH_UART_HW_FC) #if MODULE_PERIPH_UART_HW_FC
.cts_pin = GPIO_UNDEF, /* CTS is not connected */ .cts_pin = GPIO_UNDEF, /* CTS is not connected */
.rts_pin = GPIO_UNDEF, /* RTS is not connected */ .rts_pin = GPIO_UNDEF, /* RTS is not connected */
#endif #endif
.type = STM32_USART, .type = STM32_USART,
.clk_src = 0, /* Use APB clock */ .clk_src = 0, /* Use APB clock */
#if IS_USED(MODULE_PERIPH_DMA) #if MODULE_PERIPH_DMA
.dma = 4, /* DMA1 Channel 7 */ .dma = 4, /* DMA1 Channel 7 */
.dma_chan = 2, /* CxS = 2 */ .dma_chan = 2, /* CxS = 2 */
#endif #endif
@ -523,19 +558,19 @@ static const uart_conf_t uart_config[] = {
.tx_af = GPIO_AF8, .tx_af = GPIO_AF8,
.bus = APB12, .bus = APB12,
.irqn = LPUART1_IRQn, .irqn = LPUART1_IRQn,
#if IS_USED(MODULE_PERIPH_UART_HW_FC) #if MODULE_PERIPH_UART_HW_FC
.cts_pin = GPIO_UNDEF, /* CTS is not connected */ .cts_pin = GPIO_UNDEF, /* CTS is not connected */
.rts_pin = GPIO_UNDEF, /* RTS is not connected */ .rts_pin = GPIO_UNDEF, /* RTS is not connected */
#endif #endif
.type = STM32_LPUART, .type = STM32_LPUART,
.clk_src = 0, /* Use APB clock */ .clk_src = 0, /* Use APB clock */
#if IS_USED(MODULE_PERIPH_DMA) #if MODULE_PERIPH_DMA
.dma = 5, /* DMA2 Channel 6 */ .dma = 5, /* DMA2 Channel 6 */
.dma_chan = 4, /* CxS = 4 */ .dma_chan = 4, /* CxS = 4 */
#endif #endif
}, },
#if !IS_USED(MODULE_PERIPH_SPI_STMOD) #if !MODULE_PERIPH_SPI_STMOD
{ /* Pmod/STMod+ connector if solder bridges SB6, SB7, SB8 are closed (default) */ { /* Pmod/STMod+ connector if solder bridges SB6, SB7, SB8 are closed (default) */
.dev = USART1, .dev = USART1,
.rcc_mask = RCC_APB2ENR_USART1EN, .rcc_mask = RCC_APB2ENR_USART1EN,
@ -545,7 +580,7 @@ static const uart_conf_t uart_config[] = {
.tx_af = GPIO_AF7, .tx_af = GPIO_AF7,
.bus = APB2, .bus = APB2,
.irqn = USART1_IRQn, .irqn = USART1_IRQn,
#if IS_USED(MODULE_PERIPH_UART_HW_FC) #if MODULE_PERIPH_UART_HW_FC
.cts_pin = GPIO_PIN(PORT_G, 11), .cts_pin = GPIO_PIN(PORT_G, 11),
.rts_pin = GPIO_PIN(PORT_G, 12), .rts_pin = GPIO_PIN(PORT_G, 12),
.cts_af = GPIO_AF7, .cts_af = GPIO_AF7,
@ -553,12 +588,12 @@ static const uart_conf_t uart_config[] = {
#endif #endif
.type = STM32_USART, .type = STM32_USART,
.clk_src = 0, /* Use APB clock */ .clk_src = 0, /* Use APB clock */
#if IS_USED(MODULE_PERIPH_DMA) #if MODULE_PERIPH_DMA
.dma = 2, /* DMA1 Channel 4 */ .dma = 2, /* DMA1 Channel 4 */
.dma_chan = 2, /* CxS = 2 */ .dma_chan = 2, /* CxS = 2 */
#endif #endif
}, },
#endif /* !IS_USED(MODULE_PERIPH_SPI_STMOD) */ #endif /* !MODULE_PERIPH_SPI_STMOD */
}; };
#define UART_0_ISR (isr_usart2) #define UART_0_ISR (isr_usart2)