Skip to content

Commit

Permalink
boards/stm32l496g-disco: add SDMMC support
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Jun 24, 2023
1 parent bbbf4c9 commit 7fa75af
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions boards/stm32l496g-disco/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ config BOARD_STM32L496G_DISCO
select HAS_PERIPH_RTC
select HAS_PERIPH_RTT
select HAS_PERIPH_PWM
select HAS_PERIPH_SDMMC
select HAS_PERIPH_SPI
select HAS_PERIPH_SPI_STMOD
select HAS_PERIPH_TIMER
Expand Down
11 changes: 11 additions & 0 deletions boards/stm32l496g-disco/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ ifneq (,$(filter periph_uart,$(USEMODULE)))
FEATURES_REQUIRED += periph_uart_hw_fc
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
1 change: 1 addition & 0 deletions boards/stm32l496g-disco/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ FEATURES_PROVIDED += periph_lpuart
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_sdmmc
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_spi_stmod
FEATURES_PROVIDED += periph_timer
Expand Down
2 changes: 1 addition & 1 deletion boards/stm32l496g-disco/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The main features of this board are:
| 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 | - | |
| SD Card Interface | - | SDMMC1 on PC8..PC13/PD2 |

## Board Configuration (sorted by peripheral):

Expand Down
34 changes: 34 additions & 0 deletions boards/stm32l496g-disco/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,40 @@ static const pwm_conf_t 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 IS_USED(MODULE_PERIPH_DMA)
.dma = 6,
.dma_chan = 7,
#endif
.irqn = SDMMC1_IRQn
},
};
/**
* @brief Number of available SDIO/SDMMC peripherals
*/
#define SDMMC_NUMOF ARRAY_SIZE(sdmmc_config)

/** @} */

/**
* @name SPI configuration
*
Expand Down

0 comments on commit 7fa75af

Please sign in to comment.