my M5StickC Plus can't read micro SD
-
Please help a beginer me.
I tried to set up my M5StickC Plus can read micro SD card.
However, it didn't work.
"Card Mount Failed" was displayed.This is the connection and my code.
M5StickCPlus >>>> SD card shield module
3V3 >>>> 3V3
GND >>>> GND
0 >>>> CLK
26 >>>> MISO
32 >>>> MOSI
33 >>>> CS// referred to below // https://lang-ship.com/blog/work/m5stickc-spi-sd/ #include <M5StickCPlus.h> #include "SD.h" // PIN assign enum { spi_sck = 0, spi_miso = 26, spi_mosi = 32, spi_ss = 33 }; void setup() { // M5Stick initialize M5.begin(); M5.Lcd.setRotation(3); // SPI initialize SPI.begin(spi_sck, spi_miso, spi_mosi, spi_ss); // SD card initialize if (!SD.begin(spi_ss)) { M5.Lcd.println("Card Mount Failed"); return; } // SD card classification 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 card volume uint64_t cardSize = SD.cardSize() / (1024 * 1024); M5.Lcd.printf("SD Card Size: %lluMB\n", cardSize); } void loop() { }
Perhaps, the issue caused by SD.begin(spi_ss).
Maybe it returned false everytime.
But I have no idea for fix it.
Give me a clue please.PS.
the SD card and SD card shield I use are below.
but, not only these, also I used any other I have, and same result.- micro SD card
KIOXIA KLMEA016G
https://www.amazon.co.jp/dp/B08PTP6KKS?ref=ppx_pop_dt_b_product_details&th=1 - SD card shield module
VKLSVAN Micro SD TF SPI card memory shield module
https://www.amazon.co.jp/dp/B086WV4VG9?psc=1&ref=ppx_pop_dt_b_product_details
- micro SD card
-
Check if the wiring is correct
new link
https://lang-ship.com/reference/unofficial/M5StickC/Device/SPI/SD/
-
Thank you for the advice.
and, I'm very sorry.
the connection and sketch I indicated was wrong.
confused.Finally I reffer and correct information are here.
Maybe, it is almost dead copy of the refference page.
https://lang-ship.com/blog/work/m5stickc-spi-sd-3wire/
M5StickCPlus >>>> SD
3V3 >>>> 3V3
GND >>>> GND
0 >>>> CLK
36 >>>> MISO
26 >>>> MOSI
GND >>>> CS#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() { }