Post History
Consider a device with a microSD card. The microcontroller writes to the SD card periodically. The operators have an ability to remove the microSD card at any time (they will be removing it every...
Question
SD-card
#2: Post edited
What happens when a microSD card is hot unplugged?
- What happens when a microSD card is hot-unplugged?
Consider a device with a microSD card. The microcontroller writes to the SD card periodically. The operators have an ability to remove the microSD card at any time (they will be removing it every few weeks). Nothing prevents the operators from hot yanking the microSD card while it’s being written to. Do the microSD cards or the FAT have provisions for such contingency? What provisions should I make in firmware or in hardware?The device has is a switch which puts it into a maintenance mode (the device is headless). The device stops writing to the microSD card in the maintenance mode. The operators are instructed about the switch, but they may forget to flip it before removing the microSD card.- **present hardware:**
- STM32G4 running [FatFs](http://elm-chan.org/fsw/ff/00index_e.html). SPI to the microSD card. The card socket is push-in-push-out type, and it has a card detection switch ([Hirose DM3AT](https://www.hirose.com/product/document?clcode=CL0609-0033-6-00&productname=DM3AT-SF-PEJ2M5&series=DM3&documenttype=Catalog&lang=en&documentid=D49662_en)).
- Consider a device with a microSD card. The microcontroller writes to the SD card periodically. The operators have an ability to remove the microSD card at any time (they will be removing it every few weeks). Nothing prevents the operators from hot-yanking the microSD card while it’s being written to. Do the microSD cards or the FAT have provisions for such contingency? What provisions should I make in firmware or in hardware?
- My device has a switch which puts it into a maintenance mode (the device is headless). The device stops writing to the microSD card in the maintenance mode. The operators are instructed about the switch, but they may forget to flip it before removing the microSD card.
- **present hardware:**
- STM32G4 running [FatFs](http://elm-chan.org/fsw/ff/00index_e.html). SPI to the microSD card. The card socket is push-in-push-out type, and it has a card detection switch ([Hirose DM3AT](https://www.hirose.com/product/document?clcode=CL0609-0033-6-00&productname=DM3AT-SF-PEJ2M5&series=DM3&documenttype=Catalog&lang=en&documentid=D49662_en)).
#1: Initial revision
What happens when a microSD card is hot unplugged?
Consider a device with a microSD card. The microcontroller writes to the SD card periodically. The operators have an ability to remove the microSD card at any time (they will be removing it every few weeks). Nothing prevents the operators from hot yanking the microSD card while it’s being written to. Do the microSD cards or the FAT have provisions for such contingency? What provisions should I make in firmware or in hardware? The device has is a switch which puts it into a maintenance mode (the device is headless). The device stops writing to the microSD card in the maintenance mode. The operators are instructed about the switch, but they may forget to flip it before removing the microSD card. **present hardware:** STM32G4 running [FatFs](http://elm-chan.org/fsw/ff/00index_e.html). SPI to the microSD card. The card socket is push-in-push-out type, and it has a card detection switch ([Hirose DM3AT](https://www.hirose.com/product/document?clcode=CL0609-0033-6-00&productname=DM3AT-SF-PEJ2M5&series=DM3&documenttype=Catalog&lang=en&documentid=D49662_en)).