summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-12-30 01:28:34 +1100
committerDamien George <damien.p.george@gmail.com>2018-12-30 01:28:34 +1100
commitb33f108cdeb57c9d84e5a4eff5a46aa49c6dd558 (patch)
tree6ee52c178031a949ea07c0556e3df0e348c86de8
parentc93263906307f208f47cb5885ed091e9e1d617c4 (diff)
stm32/sdcard: Properly reset SD periph when SDMMC2 is used on H7 MCUs.
-rw-r--r--ports/stm32/sdcard.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c
index bb972bea9..1d49016e7 100644
--- a/ports/stm32/sdcard.c
+++ b/ports/stm32/sdcard.c
@@ -169,9 +169,14 @@ void HAL_SD_MspInit(SD_HandleTypeDef *hsd) {
#if defined(STM32H7)
// Reset SDMMC
+ #if defined(MICROPY_HW_SDMMC2_CK)
+ __HAL_RCC_SDMMC2_FORCE_RESET();
+ __HAL_RCC_SDMMC2_RELEASE_RESET();
+ #else
__HAL_RCC_SDMMC1_FORCE_RESET();
__HAL_RCC_SDMMC1_RELEASE_RESET();
#endif
+ #endif
// NVIC configuration for SDIO interrupts
NVIC_SetPriority(SDMMC_IRQn, IRQ_PRI_SDIO);