New SdFat Beta with support for multiple SD cards

I have posted SdFatBeta20110810 here

Here are the main changes:

Added support for multiple SD cards.

Change the name of SdFat::cwd() to SdFat::vwd() since the volume working directory is not the current working directory with multiple SD cards.

Added the static function SdBaseFile::cwd() to return a pointer to the current working directory.

Added the TwoCards.pde example to demonstrate use of multiple SD cards.

Added readCSV.pde example to demonstrate iostream extractors.

Added bool SdBaseFile::timestamp(SdBaseFile* file) to copy one file's timestamps to another file.

Improved messages in the QuickStart.pde example.

Added maximum latency test to the bench.pde example.

Rearanged class hierarchy to fix conflicts with Flash.h and other Adruino libraries. Print is no longer a private parent of file stream classes.

Added high speed multiple block read functions to Sd2Card.

Changes for Arduino 1.0.


Can I download, unzip, move, etc, and then re-use my Sd2Fatpins.c file (name is something like that) from the July release?


The modified Sd2PinMap.h for your board should work with this version of SdFat.

In the future Sd2PinMap.h will only be needed for software SPI.

Hardware SPI will be setup using just the avr port/bit for SPI. For example PB7 is SCK on your ATmega1284.

I only need the processor ID to setup SS, MOSI, MISO, and SCK.

The Arduino files will only be used for chip select.

I will also produce a version of SdFat that runs without any Arduino core stuff, just what comes with WinAVR.

In the Arduino free version, chip select will be specified by port/bit like this:

  if (!sd.init("D3")) sd.initErrorHalt();

Assuming chip select is connected to PD3.

I want to use both hardware SPI to talk to an SD card and Ethernet, as well as a software SPI to simulate an external device to test my shield plugged into a Robotdyn MEGA2560 + Ethernet +SD. The attached block diagram should help you visualize this.

I have my software working (including Html and javascript server, and reading an SD card) , but not my shield which interfaces to the external device. So I need to add Software SPI to simulate the external device and plug the software spi pins back into the external device connector.

This would help me - an example showing software SPI reading and writing… AND uses the hardware SPI to read the SD card and Ethernet. I have not seen an example which does both in the same sketch.

Previously I used the SD.h (based on a 10 year old version of SDFat) and added the DigitalIO.h ( has SoftSPI.h ) libraries, but they had conflicts in naming, hence my interest in this new Beta release of SdFat that Bill Greiman says he plans to release soon.

PW1 SoftSPI.pdf (207 KB)

That beta release is from 2011 (as is this thread).

Did you try the current SdFat library?

Yes I did try the very latest SdFat Beta library. I chose this topic because its subject matched SdFat Beta. I will go post a new topic, perhaps that will help.

The latest commit of greiman/SdFat on github is from March 2019. So that should basically contain the changes in the 2011 beta.

I'm not quite sure how you ended in this thread (possibly a google for 'arduino sd software SPI') but I think that you're on the wrong track with the SD library ;) A quick google for arduino software spi gives gives you a few options to look at for software SPI.