I’m trying to use the SD card on my chipworkx DevKit (http://www.ghielectronics.com/downloads/ChipworkX/ChipworkX-DevSys%20sch%20V1.5.pdf).
It works fine, but sometimes an error occurs and the microSD can’t be mounted again until i restart the chipworkx module over power or take the card out of the holder and re-insert it. A reboot via software is not enough and won’t work. In case of a manual restart (power off), I have to wait 3 seconds beforce giving power back to the module - i think this is because of the capacitors on the devKit.
In case of an error of the microSD, the filesystem of the card is unknown and I’m trying to format the card. The error always occurs when I’m trying to format the card again, but also if I’m trying to read or write on it. After restarting or re-plugin the micro SD card the filesystem is known (no formatting it required) and access is allowed. So I think the card is blocked and the only way to unblock, is to restart od re-plugin the card.
Am I right?
Is there a way of resetting or unblocking the card via software?
Further more I’m getting 2 different kinds of exceptions when trying to format the card (in case of unknown file system), depending on the parameters of the format command.
Trying to format with
Format("FAT", 0)
I’m getting the following exception:
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
#### Message:
#### Microsoft.SPOT.IO.NativeIO::Format [IP: 0000] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 003a] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 000a] ####
#### Visionlife.Assemble.Model.Compatibility.FlashMfc::InitializeBackupDevice [IP: 0012] ####
#### Visionlife.Assemble.Model.Compatibility.FlashMfc::InitializeFlash [IP: 0053] ####
#### Visionlife.Assemble.Micro.Framework.Framework::Start [IP: 002c] ####
#### Visionlife.Assemble.Micro.Program::Main [IP: 0003] ####
#### Exception System.IO.IOException - CLR_E_UNAUTHORIZED_ACCESS (4) ####
#### Message:
#### System.IO.FileSystemManager::LockDirectory [IP: 0066] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 0030] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 000a] ####
#### Visionlife.Assemble.Model.Compatibility.FlashMfc::InitializeBackupDevice [IP: 0012] ####
#### Visionlife.Assemble.Model.Compatibility.FlashMfc::RemovableMedia_Insert [IP: 0012] ####
#### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0041] ####
Trying to format with
Format(0)
I’m getting the following exception:
#### Exception System.IO.IOException - CLR_E_FILE_IO (5) ####
#### Message:
#### Microsoft.SPOT.IO.NativeIO::Format [IP: 0000] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 003a] ####
#### Microsoft.SPOT.IO.VolumeInfo::Format [IP: 0007] ####
#### Futus_RSS.RSS_Volumes::RemovableMedia_Insert [IP: 00fa] ####
#### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0041] ####
I have seen it before were SD cards go in an unknown state. Some designs have a circuit that controls the power on the SD card, to power down and back up if the card got into that state.
Is there a way to do this with software? Or is the only way to realize a hardware solution?
I do not think there is a way to do it in software but not sure.
What’s the correct or the better way to format the sd card?
Format(0) or Format(“FAT”, 0)?