Skip to content
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

ESP32-S3 SDMMC support #6323

Merged
merged 1 commit into from
Mar 15, 2022
Merged

ESP32-S3 SDMMC support #6323

merged 1 commit into from
Mar 15, 2022

Conversation

igrr
Copy link
Member

@igrr igrr commented Feb 21, 2022

Summary

This PR adds SDMMC support for ESP32-S3.

Unlike ESP32, ESP32-S3 allows all SDMMC pins to be configured flexibly using GPIO matrix. A new function is added to SDMMC class to allow setting the pins.

Impact

Related links

SDMMC docs for S3: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/sdmmc_host.html

@igrr igrr changed the base branch from master to esp32-s3-support February 21, 2022 13:06
libraries/SD_MMC/src/SD_MMC.cpp Outdated Show resolved Hide resolved
@VojtechBartoska VojtechBartoska added this to the 2.0.3 milestone Feb 23, 2022
@igrr igrr changed the title Draft: ESP32-S3 SDMMC support ESP32-S3 SDMMC support Mar 14, 2022
@igrr igrr marked this pull request as ready for review March 14, 2022 13:02
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2022

Unit Test Results

0 files  ±0  0 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit a457204. ± Comparison against base commit 701fcad.

♻️ This comment has been updated with latest results.

@igrr
Copy link
Member Author

igrr commented Mar 14, 2022

There are still two issues on IDF side which need to be fixed in the IDF driver: espressif/esp-idf#8521 and espressif/esp-idf#8257. These will need to be fixed in IDF master and backported to release/v4.4. For the time being, 20 MHz frequency might work. 40 MHz for SD cards is likely to fail, and any frequency for eMMC is also likely to fail.

#define SDMMC_CLK 13
#define SDMMC_CMD 11
#define SDMMC_D0 14
#define SDMMC_D1 12
#define SDMMC_D2 10
#define SDMMC_D3 9
#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_DEFAULT
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be removed after the above mentioned IDF issues are fixed and fixes are included into Arduino.

@igrr igrr requested a review from me-no-dev March 14, 2022 13:18
@igrr
Copy link
Member Author

igrr commented Mar 14, 2022

To test on ESP32-S3-USB-OTG, apply the patch:

diff --git a/variants/esp32s3/pins_arduino.h b/variants/esp32s3/pins_arduino.h
index 5cd22fa5..f906bd3f 100644
--- a/variants/esp32s3/pins_arduino.h
+++ b/variants/esp32s3/pins_arduino.h
@@ -64,4 +64,15 @@ static const uint8_t T14 = 14;
 static const uint8_t DAC1 = 17;
 static const uint8_t DAC2 = 18;
 
+
+#define BOARD_HAS_SDMMC
+#define SDMMC_CLK  36
+#define SDMMC_CMD  35
+#define SDMMC_D0   37
+#define SDMMC_D1   38
+#define SDMMC_D2   33
+#define SDMMC_D3   34
+
+#define BOARD_MAX_SDMMC_FREQ SDMMC_FREQ_DEFAULT
+
 #endif /* Pins_Arduino_h */

@me-no-dev
Copy link
Member

I will actually add a whole board definition for ESP32-S3-USB-OTG, because it's an interesting case to have as example for board support.

@me-no-dev me-no-dev merged commit 75cac9c into esp32-s3-support Mar 15, 2022
@me-no-dev me-no-dev deleted the esp32-s3-support-sdmmc branch March 15, 2022 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants