Go Down

Topic: Help on understanding sdfat library (Read 4940 times) previous topic - next topic

arduinoenthusiast1

Hi,

Thanks to the detailed discussions here, I was never required to post a thread until now.
First of all I would like to thank the Arduino Community and its makers for bringing micro controllers and programming to everyone.

Having said that, after spending a few days trying to figure out from the documentation and forum entries on the SDfat library here, I have a few questions to start with, which remain unanswered:-

1) Is it necessary to have a background on the older SD library (bundled with IDE) to start working with the SDfat library.

2) The second one arises after skimming through the various examples provided. At times the file object is created from the from the  "SDBasefile" class and elsewhere from the "SDFile" class. Looking at the header files, all I can figure out is they inherit different parent classes. Is there a fundamental difference between them?

3) How do I set the Chip Select(CS) pin permanently. There are a few examples which let you define the CS pin as a variable from within the sketch and a few don't. Same question regarding setting up SPI speed.

4) Are there any suggestions on working with the library, if I intend working parallelly with nrf24L01+ modules. Yes, there are a few threads out there that discuss similar scenarios, but my setup requires logging every 10 odd milliseconds. (Skimmed through the "Low Latency Logger example" but its its implementation seems too complex for my limited comprehension).

5) My last question (for now) is specifically on the "Low Latency Logger" example bundled with the library. I understand that it implements a buffer wherein the samples are stored and then written to the file in binary format when the buffer is almost full, or full. So, when writing of SD card takes place, with write latencies of the order of tens of milliseconds (max), does that mean that the the process of storing the sampling is on hold during that duration?

Appreciate the help.

PaulS

Quote
1) Is it necessary to have a background on the older SD library (bundled with IDE) to start working with the SDfat library.
No.

Quote
Is there a fundamental difference between them?
Between SDBaseFile and SDFile? SDBaseFile derives from FatFile. SDFile derives from PrintFile which derives from FatFile and Print. So, fundamentally? No.

Quote
3) How do I set the Chip Select(CS) pin permanently.
The Chip Select pin is a function of your hardware. If the hardware doesn't define a specific pin, you can use any pin. I'm not sure what you mean by permanently.

Quote
4) Are there any suggestions on working with the library
Starting with realistic expectations, just do it.


arduinoenthusiast1

Between SDBaseFile and SDFile? SDBaseFile derives from FatFile. SDFile derives from PrintFile which derives from FatFile and Print. So, fundamentally? No.
As they they have a different path to genesis, a quick note on how their use case may differ would be even more helpful.

I'm not sure what you mean by permanently
Apologies for the ill formed question there. By permanently I meant how to hardcode in the library that the CS pin will be say pin#10. As i mentioned earlier there are a few examples with CS set to pin#10 and other to pin#4.

Starting with realistic expectations, just do it.
I think having a little knowledge on the working of the library will help me start off better prepared.

This one again is a derivative of question 5 of my previous post. Does a write to an SD card pushed to background (task) and the arduino can resume the normal program meanwhile? Or does the program execution halt during the writing operation. Thanks again

PaulS

Quote
As i mentioned earlier there are a few examples with CS set to pin#10 and other to pin#4.
Some hardware has a defined CS pin. Some does not. The library should NOT force the use of a single pin.

Quote
Does a write to an SD card pushed to background (task) and the arduino can resume the normal program meanwhile? Or does the program execution halt during the writing operation.
A PC can do things "in the background" because it has multiple processors or an operating system that apportions access to the single processor. An Arduino has neither multiple processors or an operating system. So, nothing happens "in the background".

The Arduino is writing to the card, or it isn't. When it is, it can do nothing else. When it isn't, it can do something else.

Go Up