Skip to content

SDMMC frequency selection based on board type #5688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 3 deletions libraries/SD_MMC/src/SD_MMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SDMMCFS::SDMMCFS(FSImplPtr impl)
: FS(impl), _card(NULL)
{}

bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed)
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed, int sdmmc_frequency)
{
if(_card) {
return true;
Expand All @@ -46,7 +46,7 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
sdmmc_host_t host;
host.flags = SDMMC_HOST_FLAG_4BIT;
host.slot = SDMMC_HOST_SLOT_1;
host.max_freq_khz = SDMMC_FREQ_DEFAULT;
host.max_freq_khz = sdmmc_frequency;
host.io_voltage = 3.3f;
host.init = &sdmmc_host_init;
host.set_bus_width = &sdmmc_host_set_bus_width;
Expand All @@ -58,7 +58,6 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
host.io_int_enable = &sdmmc_host_io_int_enable;
host.io_int_wait = &sdmmc_host_io_int_wait;
host.command_timeout_ms = 0;
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
#ifdef BOARD_HAS_1BIT_SDMMC
mode1bit = true;
#endif
Expand Down
6 changes: 5 additions & 1 deletion libraries/SD_MMC/src/SD_MMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class SDMMCFS : public FS

public:
SDMMCFS(FSImplPtr impl);
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false);
#ifdef ETH_CAN_INTERFERE_WITH_SDMMC
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false, int sdmmc_frequency=SDMMC_FREQ_DEFAULT);
#else
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false, int sdmmc_frequency=SDMMC_FREQ_HIGHSPEED);
#endif
void end();
sdcard_type_t cardType();
uint64_t cardSize();
Expand Down
1 change: 1 addition & 0 deletions variants/esp32-evb/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ static const uint8_t MISO = 15;
static const uint8_t SCK = 14;

#define BOARD_HAS_1BIT_SDMMC
#define ETH_CAN_INTERFERE_WITH_SDMMC

#endif /* Pins_Arduino_h */