Few questions to working with SD.h library and SD card module

I am using SD card reader for the first time and I trying all possible options /info I can get to or from SD card reader.
I noticed that there are two possible ways to declare the SD card. In both you use SD.h library
The most common is:

SD.begin(chipSelect)

The other method is :
requires following declarations:


Sd2Card card;
SdVolume volume;
SdFile root;

card.init(SPI_HALF_SPEED, chipSelect))

In the second method I can then get the FAT type and volume size in this way.

 Serial.print("Volume size (Kb):  ");
 Serial.println(volume.blocksPerCluster()*
	         volume.clusterCount() /2);

 Serial.print("Volume type is:    FAT");
 Serial.println(volume.fatType(), DEC);

I am struggling to get the same information if I choose to declare SD card reader using the first method. Anybody knows how can I pull the FAT type and SD card size in this scenario?

the Arduino SD library wraps an old version of the SDFat library. the Arduino SD API doesn't have all the functions of the SdFat library so the very useful diagnostics sketch CardInfo uses the API of the SdFat library.
If you want to use the SdFat API, then it is better to install a current version of the SdFat library.

Thanks for the response. I have found some possts from the SdFat.h creator which explained this. I guess if you are after just IO operations then SD.h is enough

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.