I have successfully implemented the MBED SD card example (mbed-os-example-sd-driver) on an NXP LPC54114 with an added Sparkfun SD card holder. The example program successfully writes to the card and then reads the created file. The problem is, the SD card is then no longer readable by my Windows PCs (I tried several, both Win 7 and Win 10). Each time the PC wants to reformat the card. I allow this and follow the recommended settings in the SD card example (FAT32, 4096 cluster size, Quick Format.) Of course the data on the SD card is now unreadable by the PC. I have verified this issue with multiple SD cards of different sizes from Kinston and SanDisk.
On rerunning the SD card program on the MBED board, I get the following errors:
lfs error:494: Corrupted dir pair at 0 1
lfs error:2222: Invalid superblock at 0 1
lfs error:494: Corrupted dir pair at 0 1
lfs error:2222: Invalid superblock at 0 1
Mounting the filesystem… No filesystem found, formatting… done.
As noted in the last line, the card is now reformatted and works on the MBED board. So really the big question is, how do I format the SD card or configure the MBED SD card example, so that the card is readable by both Windows and the MBED board?
Thank you for your comments. I’m using a downloaded version of the MBED OS, version is 5.14.1, on the online compiler. The code I am using is the one you linked above, based on the LittleFileSystem. I did not see the comment on using the FatFileSystem instead and will try that.