Arm Mbed OS support forum

How do I read an SD card?

I’m trying to read an SD card for my blue pill. I’m using the online compiler. To be honest, the whole thing seems to be a mish-mash of new stuff, old stuff, and who knows what else.

Presumably (??) I want the FATFileSystem, although there seems so many file system libraries to choose from. So I do

#include “FATFileSystem.h”

but it says that there is no such file or directory. So presumably I need to import a library. There seem to be 9 implementations of the library (!), so I’m confused as to which one I should use. I think some of them are legacy stuff, too, so won’t work properly.

I don’t think I want mbed OS, which is presumably a fairly heavyweight RTOS system.

I’m confused. What do I need to do? How do I identify the “official” libraries?

So, I think I found something. So I found an “official” version at
https://os.mbed.com/teams/mbed-official/code/FATFileSystem/

It doesn’t quite seem to work, though and complains of
Error: Object of abstract class type “FATFileSystem” is not allowed in “main.cpp”, Line: 61, Col: 20

Hmmm.

But on second thoughts, I think that I shouldn’t import that library, but import the mbed 2 library instead. I’ll try that and see if that works.

Hello Blippy,

This thread might help.

Best regards, Zoltan

Now it’s saying “SDBlockDevice.h” file not found.

I started with the mbed-os-example-blinky, which includes mbed-os. I don’t even want threading.

Dunno, it’s all a bit of a mystery.

I have another project which says “mbed: Documentation not ready”. What’s that about?

So there seems to be “mbed 2”, which maybe legacy??

As the saying goes: you can solve any problem in computing by adding an extra layer of abstraction, except for the problem of having too many layers of abstraction.

OK, I found another variant of the library that seemed to compile. I haven’t gotten it working yet. I will need to investigate further. SD card libraries in general seem a bit hit-and-miss. The one from the Arduino library seems to work, though.

Hmm, back to the Arduino IDE for me, I think.