Go Down

Topic: SD Libraries (Read 1 time) previous topic - next topic


Hello everyone, I am trying to figure out how the sample data logger program works in detail, specifically what commands and data are written to the SD MOSI port, what is read from the MOSO port. Referencing the library's in the Arduino 0022 package which library files should I be looking at to see how the SD.begin(), SD.open(), println() and close() sends and receives data to the card's spi port.

Thanks in advance 


SD.begin() and SD.open() are defined in SD.h and implemented in SD.cpp. close() is defined in File.cpp.


thanks I'm going to take a look at them now


Sorry, I must have phrased my question incorrectly. I understand that the SD.h file defines the open command for example:

File open(char *filename, uint8_t mode = FILE_READ);

but what I want to figure out is what bytes are written to the MOSI pin when your c code in the data logger program has the values:

File dataFile = SD.open("datalog.txt", FILE_WRITE)

I am not a software ninja (I am an EE) so if I missed something in the SD.h or SD.cpp file I apologize. I imagine the bytes written to the mosi port would be something like:

58 hex for example (CMD24 or CMD25 write command), a response on MOSO, then the data block with the ascii code for d a t a l o g . t x t and some other stuff.   

What I want to know is where is this defined, any help with what line in the file it is defined in would be greatly appreciated.


may if you search in your arduino folder something like :

Sd2card.cpp ...

Go Up