The best, fastest and most reliable way I've found to access the µSD card on the Tab5 is via the SD_MMC.h library. Try the below;
#include <M5Unified.h>
#include <SD_MMC.h>
#define sd_D0 GPIO_NUM_39
#define sd_D1 GPIO_NUM_40
#define sd_D2 GPIO_NUM_41
#define sd_D3 GPIO_NUM_42
#define sd_CLK GPIO_NUM_43
#define sd_CMD GPIO_NUM_44
#define GPS_RX_PIN 48 // CoreS3 GPIO RX
#define GPS_TX_PIN 2 // CoreS3 GPIO TX
#define sd_speed 20000
void setup() {
M5.delay(500);
M5.begin();
M5.Lcd.setTextColor(GREEN, BLACK);
M5.Lcd.setTextFont(2);
SD_MMC.setPins(sd_CLK, sd_CMD, sd_D0, sd_D1, sd_D2, sd_D3);
M5.Lcd.println("Mounting Tab5 µSD");
//M5.delay(5000);
if (!SD_MMC.begin("/sdcard", false, false, sd_speed)) { // SD_MMC.begin("/sdcard", false, false, sd_speed)
M5.Lcd.println("µSD mount failed!");
while (1);
} else {
M5.Lcd.println("µSD mounted.");
}
// List files on SD card root
File root = SD_MMC.open("/");
if (!root) {
M5.Lcd.println("Failed to open root dir");
} else {
M5.Lcd.println("Files:");
File file = root.openNextFile();
while (file) {
M5.Lcd.println(file.name());
file = root.openNextFile();
}
root.close();
}
}
void loop() {
M5.delay(50);
}