SD.begin() fails second time When I remove the SD card and try to open a file, I can detect the error properly.

But how do I detect that the card has been replaced after an error? My first thought was to call SD.begin() again but it appears that this function returns true exactly once and false thereafter.

Simplified example:

void setup() {
  SD.begin(pin); // called exactly once. Works.
}
void loop() {
  // stuff
}


But this does not:

void setup() {
  SD.begin(pin); // first time calling this function: works.
}
void loop() {
  delay(1000);
  SD.begin(pin); // always fails
}


I'd rather not reset the microcontroller just for this.
I know this question is relatively old but still, if you wnat to run  SD.begin(chipselect); again first call if(root.isOpen()) root.close(); I added this to the library. This way SD.begin(chipselect) will return true if a card is present and false when it's not.