Skip to content

Commit c38ee43

Browse files
committed
Make UHS-I SDR the default for ESP-P4 SD_MMC
1 parent d39181b commit c38ee43

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libraries/SD_MMC/src/SD_MMC.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ bool SDMMCFS::begin(const char *mountpoint, bool mode1bit, bool format_if_mount_
227227
host.flags = SDMMC_HOST_FLAG_4BIT;
228228
#if defined(CONFIG_IDF_TARGET_ESP32P4) && defined(BOARD_SDMMC_SLOT) && (BOARD_SDMMC_SLOT == 0)
229229
host.slot = SDMMC_HOST_SLOT_0;
230+
host.flags &= ~SDMMC_HOST_FLAG_DDR;
230231
// reconfigure slot_config to remove all pins in order to use IO_MUX
231232
// Use 0 instead of GPIO_NUM_NC (-1) because ESP-IDF's s_check_pin_not_set()
232233
// function uses !pin which doesn't work correctly with -1 (GPIO_NUM_NC)
@@ -244,7 +245,7 @@ bool SDMMCFS::begin(const char *mountpoint, bool mode1bit, bool format_if_mount_
244245
.cd = SDMMC_SLOT_NO_CD,
245246
.wp = SDMMC_SLOT_NO_WP,
246247
.width = 4,
247-
.flags = 0,
248+
.flags = SDMMC_SLOT_FLAG_UHS1,
248249
};
249250
#else
250251
host.slot = SDMMC_HOST_SLOT_1;

libraries/SD_MMC/src/SD_MMC.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@
3030
// you can define BOARD_MAX_SDMMC_FREQ with lower value (Ex. SDMMC_FREQ_DEFAULT)
3131
// in pins_arduino.h for your board variant.
3232
#ifndef BOARD_MAX_SDMMC_FREQ
33+
#ifdef SOC_SDMMC_UHS_I_SUPPORTED
34+
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_SDR50
35+
#else
3336
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_HIGHSPEED
3437
#endif
38+
#endif
3539

3640
namespace fs {
3741

0 commit comments

Comments
 (0)