summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-11-16 18:29:39 +1100
committerDamien George <damien@micropython.org>2023-11-17 14:17:37 +1100
commitc34941109fa9390c1b41200064eaa17c7aeb7961 (patch)
tree996a6fb5521ca94f298b5d524b9f0056b126078a
parent0cc100be2c08f6b4e53a208dea8ef7953dc29cea (diff)
stm32/sdcard: Add SD card support for H5 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/stm32/Makefile2
-rw-r--r--ports/stm32/dma.c2
-rw-r--r--ports/stm32/sdcard.c6
3 files changed, 5 insertions, 5 deletions
diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile
index edebd2db9..56b5a1020 100644
--- a/ports/stm32/Makefile
+++ b/ports/stm32/Makefile
@@ -408,7 +408,7 @@ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\
)
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_sd.c \
ll_sdmmc.c \
diff --git a/ports/stm32/dma.c b/ports/stm32/dma.c
index 0a5d25c16..af56d8123 100644
--- a/ports/stm32/dma.c
+++ b/ports/stm32/dma.c
@@ -156,7 +156,7 @@ static const DMA_InitTypeDef dma_init_struct_i2s = {
};
#endif
-#if ENABLE_SDIO && !defined(STM32H7)
+#if ENABLE_SDIO && !defined(STM32H5) && !defined(STM32H7)
// Parameters to dma_init() for SDIO tx and rx.
static const DMA_InitTypeDef dma_init_struct_sdio = {
#if defined(STM32F4) || defined(STM32F7)
diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c
index d09ee21d0..a903f79ed 100644
--- a/ports/stm32/sdcard.c
+++ b/ports/stm32/sdcard.c
@@ -40,7 +40,7 @@
#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
// 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_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_USE_GPDMA 0
#else
@@ -268,7 +268,7 @@ STATIC HAL_StatusTypeDef sdmmc_init_sd(void) {
// SD device interface configuration
sdmmc_handle.sd.Instance = SDIO;
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;
#endif
sdmmc_handle.sd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_ENABLE;