Again one of our customers who uses our custom board based on EMX have troubles. After trying to copy configuration files on the SD card, system becomes unresponsive. SD has been corrupted by?
Using MSC the SD card shows correct files except one. This file is empty. Trying to delete using windows and MSC does not returns error but after refreshing screen (using F5) the file is again on the SD. Trying to format using windows and MSC fails. Now windows says that SD is not formatted.
How can it be possible that a GHI devices corrupt an SD card like that! Our devices in the embedded world can be switch off wildely during a writing process. It seems that it can causes some errors on SD card. Ok but how to solve that?
This is really problematic and I didn’t observe such kind of failure with other devices (RaspPi, OMAP, tons of FPGA, beagleboard…). An effort has to be made to achieve a better reliability. Is there’s something we can do at software level? I am flushing after each write.
At the hardware level, it will be really a pain to redesign the board with an emergency battery to allow the end of writing process and flush the filesystem properly.
@ Simon from Vilnius - Windows is a very large system with all kinds of resources, so it has drivers to recovery and it maybe even a bit smarter on handling a corrupted media. This is not the case in embedded systems. While sounds simple, a recovery tool is quite complex.
@ Gus - I don’t remove the card; the system is a kind of datalogger, SD is not reachable by customers and therefore not removable. But power can be switch off and this seems to be the root of this problem . In some cases (when power is switch off during a writing process), the system can not access to the SD card anymore and SD becomes corrupted.
I have tons of products that uses SD (camera, loggers, players) none of them seems to have such a problem. Maybe they are dealing with power loss detection to unmount quickly?
I can’t believe I am the only one to have this problematic
Common Gus, this is not an answer, power losses exist. If by software nothing can be done (your post goes in that way), this is done by hardware? why my picture camera do not kill SD cards but the GHI based product yes? Do you have some advice?
GHI could also add this note for free in the product documentation. Unexperienced designers then have the choice to subscribe for a GHI support or to design a smart power management feature. Customers have to be informed about this risk (as well as customers should be informed about known issues…)
Most devices with SD card are battery powered so they can handle power off in a controlled manner. They can fail if you pull out the battery if they happen to be writing at the time. Seen it before with an Android phone but as Simon hinted, they have repair code to handle this.
The only real way for you to handle this is to do the same. Maybe just having a power fail detection circuit with enough capacitance to hold power until you stop any SD writing?
When your system uses any type of memory card, you need to design this into the system. We have the very same issue on the odd occasion with a Windows XP Embedded system where the D: drive gets corrupt if they just power off without doing a shutdown. We now have a UPS fitted as standard and teach the operator to either use START and shutdown or press the power button to shutdown.