Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 93f1060

Browse filesBrowse files
authored
SDMMC frequency selection based on board type (espressif#5688)
* SDMMC frequency selection based on board type On Olimex ESP32 EVB I/O operations with SD card can cause error when LAN is used in same time. Problem is disappearing if SD MMC frequency lower down from SDMMC_FREQ_HIGHSPEED to SDMMC_FREQ_DEFAULT. No problem if WiFi used instead LAN. * Code rewritten according to espressif#5688 (review)
1 parent 67583e8 commit 93f1060
Copy full SHA for 93f1060

File tree

3 files changed

+11
-3
lines changed
Filter options

3 files changed

+11
-3
lines changed

‎libraries/SD_MMC/src/SD_MMC.cpp

Copy file name to clipboardExpand all lines: libraries/SD_MMC/src/SD_MMC.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SDMMCFS::SDMMCFS(FSImplPtr impl)
3636
: FS(impl), _card(NULL)
3737
{}
3838

39-
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed)
39+
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed, int sdmmc_frequency)
4040
{
4141
if(_card) {
4242
return true;
@@ -46,7 +46,7 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
4646
sdmmc_host_t host;
4747
host.flags = SDMMC_HOST_FLAG_4BIT;
4848
host.slot = SDMMC_HOST_SLOT_1;
49-
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
49+
host.max_freq_khz = sdmmc_frequency;
5050
host.io_voltage = 3.3f;
5151
host.init = &sdmmc_host_init;
5252
host.set_bus_width = &sdmmc_host_set_bus_width;

‎libraries/SD_MMC/src/SD_MMC.h

Copy file name to clipboardExpand all lines: libraries/SD_MMC/src/SD_MMC.h
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
#include "driver/sdmmc_types.h"
2222
#include "sd_defines.h"
2323

24+
// If reading/writing to the SD card is unstable,
25+
// you can define BOARD_MAX_SDMMC_FREQ with lower value (Ex. SDMMC_FREQ_DEFAULT)
26+
// in pins_arduino.h for your board variant.
27+
#ifndef BOARD_MAX_SDMMC_FREQ
28+
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_HIGHSPEED
29+
#endif
30+
2431
namespace fs
2532
{
2633

@@ -31,7 +38,7 @@ class SDMMCFS : public FS
3138

3239
public:
3340
SDMMCFS(FSImplPtr impl);
34-
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false);
41+
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false, int sdmmc_frequency=BOARD_MAX_SDMMC_FREQ);
3542
void end();
3643
sdcard_type_t cardType();
3744
uint64_t cardSize();

‎variants/esp32-evb/pins_arduino.h

Copy file name to clipboardExpand all lines: variants/esp32-evb/pins_arduino.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ static const uint8_t MISO = 15;
2929
static const uint8_t SCK = 14;
3030

3131
#define BOARD_HAS_1BIT_SDMMC
32+
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_DEFAULT
3233

3334
#endif /* Pins_Arduino_h */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.