M5StickCPlus Card Mount Failed
-
Trying to connect SD Card Module via External SPI. Keep getting Card Mount Failed. Tried with both 3.3 and 5v external power. Can someone please tell me what I'm doing wrong?
#include <M5StickCPlus.h>
#include "SD.h"
SPIClass SPI_EXT;
// PIN配置
enum { spi_sck = 0, spi_miso = 36, spi_mosi = 26, spi_ss = -1 };
void setup()
{
// M5StickC initialize
M5.begin();
M5.Lcd.setRotation(3);
// SPI initialize
SPI_EXT.begin(spi_sck, spi_miso, spi_mosi, spi_ss);
// SD initialize
if (!SD.begin(spi_ss, SPI_EXT)) {
M5.Lcd.println("Card Mount Failed");
return;
}
// SD check
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
M5.Lcd.println("None SD Card");
return;
}
M5.Lcd.print("SD Card Type: ");
if (cardType == CARD_MMC) {
M5.Lcd.println("MMC");
} else if (cardType == CARD_SD) {
M5.Lcd.println("SDSC");
} else if (cardType == CARD_SDHC) {
M5.Lcd.println("SDHC");
} else {
M5.Lcd.println("UNKNOWN");
}
// SD volume
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
M5.Lcd.printf("SD Card Size: %lluMB\n", cardSize);
}
void loop() {
}
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login