Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

75%
+4 −0
Q&A 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...

1 answer  ·  posted 6mo ago by misk94555‭  ·  edited 6mo ago by misk94555‭

Question SD-card
#2: Post edited by user avatar misk94555‭ · 2024-05-04T18:19:05Z (6 months ago)
  • 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 by user avatar misk94555‭ · 2024-04-28T16:49:47Z (6 months ago)
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)).