I also had some issues with the M5Stack basic and SD cards. I was unable to read 9 out of 10 cards. In the end i ended up slowing down the SD card clock from 40Mhz to 10Mhz, this solved all the read issues for me. You can achieve this by editing the M5Stack.cpp file, in the function M5Stack begin SD is enabled using the following function:
// TF Card
if (SDEnable == true) {
SD.begin(TFCARD_CS_PIN, SPI, 40000000);
}
I changed this to:
// TF Card
if (SDEnable == true) {
SD.begin(TFCARD_CS_PIN, SPI, 10000000);
}
Since than i have had no more troubles reading from and writing to the SD card.