[Closed]EMX: Another SD card out of order

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?

Cards are 8GB samsung EVO series µSDHC UHS-I class 10.

Try to use more “low-level” software to format the SDCard.

E.g.: SD Memory Card Formatter | SD Association

This is exactly why I gave up on GHI’s SD implementation. FAT32 can get easily currupted, especially on power offs, and EMX cannot recover from 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.

FAT is guaranteed to get corrupted when writing data and power loss. This is expected and by design.

@ leforban - volume must be unmounted before card is removed. This applies to anything and everything FAT.

What about a recovery? When I put corrupted SD card in a PC, it kindly asks me if I want to fix it. Could EMX do that some time in the future?

@ 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.

Well you can handle FAT on ALFAT chip very nicely, so I’m not quite convinced with that “not the case in embedded systems” :slight_smile:

@ 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?

@ andre.m - correct. And that is why we have a special power loss feature in ALFAT.

Knowing that this can create big issues for most of designers; why not adding a note in documentation that says SD can be corrupted by the devices if power losses are not managed…

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.

it makes sense and we have already supercaps for this purpose on new designs. However writing it in the doc does not cost anything and may help other GHI customers.

This sounds also clear to me and definitely believe that this sould be added to the doc!

I did not see this on https://www.ghielectronics.com/downloads/man/EMX_User_Manual.pdf