stm32/sdcard: Add support for UHS-I SD cards. by kwagyeman · Pull Request #19623 · micropython/micropython · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ports/stm32/boards/OPENMV_N6/board.c
8 changes: 7 additions & 1 deletion ports/stm32/boards/OPENMV_N6/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@

// SD Card SDMMC
// SD_VSELECT: low(default)=3.3V IO, high=1.8V IO
// SD_RESET: drive low to turn off SD VCC (pulled high by default)
// SD_RESET: drive low to turn off SD VCC (pulled high by default on UHS-I capable
// hardware, in which case it reads high at startup; reads low otherwise)
// SD_DETECT: pulled high in hardware, goes low when SD inserted
#define MICROPY_HW_SDCARD_SDMMC (1)
#define MICROPY_HW_SDCARD_VSELECT_PIN (pyb_pin_SD_VSELECT)
#define MICROPY_HW_SDCARD_RESET_PIN (pyb_pin_SD_RESET)
// UHS-I SDR104 at 200MHz (the SDMMC kernel clock is HCLK at 200MHz).
#define MICROPY_HW_SDCARD_UHS_SWITCH_PATTERN (SDMMC_SDR104_SWITCH_PATTERN)
#define MICROPY_HW_SDCARD_UHS_CLK_DIV (0)
#define MICROPY_HW_SDCARD_CK (pyb_pin_SD_SDIO_CK)
#define MICROPY_HW_SDCARD_CMD (pyb_pin_SD_SDIO_CMD)
#define MICROPY_HW_SDCARD_D0 (pyb_pin_SD_SDIO_D0)
Expand Down
3 changes: 3 additions & 0 deletions ports/stm32/boards/OPENMV_N6/stm32n6xx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define HSE_STARTUP_TIMEOUT (100)
#define LSE_STARTUP_TIMEOUT (5000)

// Enable the HAL's SD card 1.8V switch support, for UHS-I mode.
#define USE_SD_TRANSCEIVER (1)

#include "boards/stm32n6xx_hal_conf_base.h"

#endif // MICROPY_INCLUDED_STM32N6XX_HAL_CONF_H
2 changes: 2 additions & 0 deletions ports/stm32/boards/stm32n6xx_hal_conf_base.h
Loading
Loading