I have an Adafruit music maker shield with a micro-SD card socket. I plug a SanDisk micro-SD card (I've tried 32GB, 16GB, and a 4GB card "guaranteed to work" from Adafruit, same results) into that socket and try sample code excerpted here:
if (!card.init(SPI_HALF_SPEED, CARDCS)) {
Serial.println("SD card init failed.");
} else {
Serial.println("Found an SD card.");
}
uint32_t volumesize;
Serial.print("\nVolume type is FAT");
Serial.println(volume.fatType(), DEC);
Serial.println();
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
root.openRoot(volume);
// list all files in the card with date and size
root.ls(LS_R | LS_DATE | LS_SIZE);
My serial monitor output looks like this:
Found an SD card.
Volume type is FAT32
Files found on the card (name, date and size in bytes):
TRACK0~1.MP3 2014-06-02 18:46:10 46446
TRACK0~2.MP3 2014-06-02 18:46:22 7990
EXAMPL~1.TXT 2014-06-16 13:32:44 51
Those tilde's are the problem. There really are 3 files on that SD card, which was formatted by the official SDFormatterV4 recommended by the Arduino web site, and their real names are TRACK001.MP3, TRACK002.MP3, and EXAMPLE.TXT. Anyone have any clues as to what might be causing Arduino to misread these filenames?
I also tried changing the code to have the Arduino open a file for writing on the SD card, with a name like TRACK007.MP3. That works, but then, I can't put what I want in the file, which lives on my windows PC.