Main Site Documentation

Format SD card


Is it possible to format a SD card on a FEZ Domino?

On several occasions we encountered a corrupted filesystem on SD, because of a power failure.
The devices are “in the field” and depend heavily on the filesystem when running their program.
Ideal is they could recover from a power failure without any user action.


I had similar problems and made a UPS of a voltage regulator and big capacitor. The idea was that when the main power disappears the voltage regulator output pin would pull a IO pin low on the FEZ. Signaling the system to close any open file system and dismount the SD card. It seems to be working.


Currently there isn’t a way to format the SD card using the .NET micro framework. This is a candidate for RLP, but the program may be larger than RLP allows on the USBIzi based systems. If you want to look at the nitty-gritty details on how this is done, take a look at the FreeDOS source code under the apps\format-32\src directory, particularly the createfs.c, format.h, driveio.h, createfs.h, etc.


What Geir said is the best. But there is a format option hiding in VolumeInfo.Format


Interesting article about the big capacitor buffer. But the question is if it’s usable in our situation.
Currently the devices get their power via the USB port (5V). The Domino is equipped with a network interface and LCD display. The question is how much time the capacitor provides to shut down properly, before the voltage falls below the minimum voltage required for the board.

The VolumeInfo.Format has 4 overloads, but none of them describes very clearly what input the parameters expect.
What should be used for values for the parameters [italic]fileSystem[/italic] and [italic]parameter[/italic]? And what does the [italic]force[/italic] parameter exactly do?


I think it is Format(“FAT”, 0);
paramerters has some flags to force some FAT16/32 format options. Don’t use it…
force, I didn’t try it but it says it removes the namespace. So there will be no more “SD” after the call. So it is not necessary.


Didn’t realize NETMF went that far, and to think I was going to write it and add it to TinyCode :slight_smile: