Main Site Documentation

SD card driver error after several operations


#1

I am getting a fairly consistent exception when doing allot of IO to a SD card.

After reading and then deleting about dozen 170kB files I get an IOException with the IOExceptionErrorCode of "InvalidDriver"
Subsequent IO on the SD card will throw an exception with IOExceptionErrorCode of VolumeNotFound.

If remount the volume it works fine until the same exception occurs again.

Any Ideas ?

Here is the code :



try
{
	var fStream = File.Open(fileName, FileMode.Open, FileAccess.Read);
	byte[] fileBytes = new byte[fStream.Length];
	fStream.Read(fileBytes, 0, fileBytes.Length);
	fStream.Close();

	var result = uploader.UploadFile(_uploadUrl, ref fileBytes, fileName);

	if (result)
	{
		File.Delete(fileName);
	}

}
finally
{
	if (fStream != null)
		fStream.Dispose();
}




#2

Have you tried to format the card on pc with fat16 and again with fat32?
Have you tried different sd cards?


#3

No and no, I’ll try that next.

Thanks for the advice.


#4

Also, does anyone have any recommendations on any particular make/model of SD card that is known to work with the EMX module? Something in the 1gb to 2gb range?


#5

Sandisk seem to have good reputation. I have seen problems with kingstone. Defiantly do not use the nobrand card found on eBay and such


#6

Solved!! Total rookie mistake.

I was not keeping a reference to the PersitantStorage object after mounting the SD card. :frowning: