-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
SD_MMC update #8294
SD_MMC update #8294
Conversation
@PilnyTomas If you postpone this PR for 3.0.0 you can simplify the getPins function to just return _pin_clk for example. Look at the 5.1-libs branch for latest changes or PR #8289. |
This should be easy change for the 3.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PilnyTomas PTAL.
const char* ssid = "Viks"; | ||
const char* password = "Mordornumber1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should replace the Wifi ssid and password with the place-holders.
// If you are using any other ESP32-S3 board than ESP32-S3-USB-OTG which has preset default pins, you will | ||
// need to specify the pins with the following example of SD_MMC.setPins() | ||
// If you want to use only 1-bit mode, you can use the line with only one data pin (d0) begin changed. | ||
// Please note that ESP32 does not allow pin change and will always fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As its not that true that the setPins() will always fail, because if you use the right pins its not gonna fail, but it don't make sense to call it as it won't make any difference. I would rather write that ESP32 has dedicated pins for SDMMC so there is no need to call setPin as it won't have any effect. Something like that :)
*/ | ||
|
||
#include "FS.h" | ||
#include "SD_MMC.h" | ||
|
||
// Default pins for ESP-S3 | ||
// Warning: ESP32-S3-WROOM-2 is using most of the default GPIOs (33-37) to interface with on-board OPI flash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add SDMMC to avoid misunderstanding.
ESP32-S3-WROOM-2 is using most of the default SDMMC GPIOs (33-37).
* D0 2 (add 1K pull up after flashing) | ||
* D1 4 | ||
* For more info see file README.md in this library or on URL: | ||
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD_MMC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no README.md file in the SDMMC library.
// 3.3V pin - SD pin 4 | ||
// GND pin - SD pin 3 | ||
int cmd = 40; // SD pin 2 - add 10k Pullup | ||
int d3 = 41; // SD pin 1 - add 10k Pullup to card's pin even when using 1-bit mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this tested? That it is necessary to pull up this pin when you won't use it? Just to be sure :)
|
||
// If you are using any other ESP32-S3 board than ESP32-S3-USB-OTG which has preset default pins, you will | ||
// need to specify the pins with the following example of SD_MMC.setPins() | ||
// If you want to use only 1-bit mode, you can use the line with only one data pin (d0) begin changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... one data pin (d0) being changed.
// If you are using any other ESP32-S3 board than ESP32-S3-USB-OTG which has preset default pins, you will | ||
// need to specify the pins with the following example of SD_MMC.setPins() | ||
// If you want to use only 1-bit mode, you can use the line with only one data pin (d0) begin changed. | ||
// Please note that ESP32 does not allow pin change and will always fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As its not that true that the setPins() will always fail, because if you use the right pins its not gonna fail, but it don't make sense to call it as it won't make any difference. I would rather write that ESP32 has dedicated pins for SDMMC so there is no need to call setPin as it won't have any effect. Something like that :)
//if(! SD_MMC.setPins(clk, cmd, d0)){ // 1-bit line version | ||
if(! SD_MMC.setPins(clk, cmd, d0, d1, d2, d3)){ // 4-bit line version | ||
Serial.println("Pin change failed!"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to use use_1_bit_mode
so no need for user to comment/uncomment code :)
if(use_1_bit_mode) {
if(!SD_MMC.setPins(clk, cmd, d0)) {
Serial.println("Pin change failed!");
return;
}
}
else {
if(!SD_MMC.setPins(clk, cmd, d0, d1, d2, d3)) {
Serial.println("Pin change failed!");
return;
}
}
//if(! SD_MMC.setPins(clk, cmd, d0)){ // 1-bit line version | ||
if(! SD_MMC.setPins(clk, cmd, d0, d1, d2, d3)){ // 4-bit line version | ||
Serial.println("Pin change failed!"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous, if(use_1_bit_mode)
can be used there.
* For more info see file README.md in this library or on URL: | ||
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD_MMC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same, there is no README.md file in the SDMMC library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be
Added getter methods for pins
both examples: