Skip to content

Change SD Card #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nemeier opened this issue Aug 1, 2015 · 3 comments
Closed

Change SD Card #641

nemeier opened this issue Aug 1, 2015 · 3 comments

Comments

@nemeier
Copy link

nemeier commented Aug 1, 2015

In some of my Projects I need to change the SD card. There is a simple allow this. I just require a single line in the SD.c library.

boolean SDClass::begin(uint8_t csPin) {
  /*
    Performs the initialisation required by the sdfatlib library.
    Return true if initialization succeeds, false otherwise.
   */
// ----> Line Added
  if (root.isOpen()) root.close();      // allows repeated calls
// <--- Line Added
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}

After changing the SD card all you need is to reinitialize the sd card.

Same Issue is posted in arduino as no 3607

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@gogela
Copy link

gogela commented Sep 20, 2016

SD lib would definitely need a mechanism to re-read card as suggested or better to correctly close SD object implementing 'end()' method as opposite to 'begin()'

@Interein2
Copy link

I've found this usefull, just because my SD card power and communication is mainly controlled by another mcu for logging. At sending data, host mcu releases lines, then ESP8266 module initializes SD, sends data and drops lines for the host to be able to communicate with SD card later. ESP restart in not an option.

@sirzeta
Copy link

sirzeta commented Feb 27, 2018

I created a PR #4444 that fixes this, is the same code applied here for this issue arduino-libraries/SD#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants