SDfat methods to handle card removal and reinsertion without cycling power?

Hi y'all :slight_smile: I've got a PJRC microSD breakout hooked up to my arduino. It's for a little POV stick so the microSD can become momentarily disconnected while moving it around or on impacts (just like with your smartphone). When this happens, needless to say it starts glitching out and reinsertion doesn't fix the glitch unless you turn the power off and on again. But the arduino itself doesn't crash, it keeps printing debug info so I know it's running. So I'm wondering if there is a method I could use to unmount the SDVol, or close the SD2Card instance so I can reinitialize it without the user having to cycle power on the device. Or do I just call init() on the card and volume and it automatically cleans up the state of the card and fat volume?

Thanks for any suggestions!

Have you jumpered the PJRC adapter to connect the SWitch pin which indicates whether a card is present?
I haven't tried tried closing and then opening the uSD card on-the-fly, but when a card insertion is detected I force the processor (Teensy++2) to reboot.

Pete

Cool, rebooting from software seems like a good way to recover. I don't want it to restart on minor impacts so I guess the SW pin could trigger an interrupt that saves the current file location to eeprom or something so it loads back up seamlessly. Thanks for the idea!