stm32/sdcard: Add SD card support for H5 MCUs.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2023-11-16 18:29:39 +11:00
parent 0cc100be2c
commit c34941109f
3 changed files with 5 additions and 5 deletions

View File

@ -408,7 +408,7 @@ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\
) )
endif endif
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7 l4)) ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h5 h7 l4))
HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\
hal_sd.c \ hal_sd.c \
ll_sdmmc.c \ ll_sdmmc.c \

View File

@ -156,7 +156,7 @@ static const DMA_InitTypeDef dma_init_struct_i2s = {
}; };
#endif #endif
#if ENABLE_SDIO && !defined(STM32H7) #if ENABLE_SDIO && !defined(STM32H5) && !defined(STM32H7)
// Parameters to dma_init() for SDIO tx and rx. // Parameters to dma_init() for SDIO tx and rx.
static const DMA_InitTypeDef dma_init_struct_sdio = { static const DMA_InitTypeDef dma_init_struct_sdio = {
#if defined(STM32F4) || defined(STM32F7) #if defined(STM32F4) || defined(STM32F7)

View File

@ -40,7 +40,7 @@
#if MICROPY_HW_ENABLE_SDCARD || MICROPY_HW_ENABLE_MMCARD #if MICROPY_HW_ENABLE_SDCARD || MICROPY_HW_ENABLE_MMCARD
#if defined(STM32F7) || defined(STM32H7) || defined(STM32L4) #if defined(STM32F7) || defined(STM32H5) || defined(STM32H7) || defined(STM32L4)
// The H7/F7/L4 have 2 SDMMC peripherals, but at the moment this driver only supports // The H7/F7/L4 have 2 SDMMC peripherals, but at the moment this driver only supports
// using one of them in a given build, selected by MICROPY_HW_SDCARD_SDMMC. // using one of them in a given build, selected by MICROPY_HW_SDCARD_SDMMC.
@ -104,7 +104,7 @@
#define SDIO_HARDWARE_FLOW_CONTROL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE
#define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_HARDWARE_FLOW_CONTROL_ENABLE #define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
#if defined(STM32H7) #if defined(STM32H5) || defined(STM32H7)
#define SDIO_TRANSFER_CLK_DIV SDMMC_NSpeed_CLK_DIV #define SDIO_TRANSFER_CLK_DIV SDMMC_NSpeed_CLK_DIV
#define SDIO_USE_GPDMA 0 #define SDIO_USE_GPDMA 0
#else #else
@ -268,7 +268,7 @@ STATIC HAL_StatusTypeDef sdmmc_init_sd(void) {
// SD device interface configuration // SD device interface configuration
sdmmc_handle.sd.Instance = SDIO; sdmmc_handle.sd.Instance = SDIO;
sdmmc_handle.sd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; sdmmc_handle.sd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
#ifndef STM32H7 #if !defined(STM32H5) && !defined(STM32H7)
sdmmc_handle.sd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; sdmmc_handle.sd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
#endif #endif
sdmmc_handle.sd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_ENABLE; sdmmc_handle.sd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_ENABLE;