SD Card not working

Yeah, but like any electronic component yours might be a different revision than his. Touch to troubleshoot these things with a moving target.

@ Gus and Team:
You guys should really do some examples which 1. show the correct way of using the modules and 2. can be used to test the hardware.

This way it would be way easier to talk about such issues here…
As I have the same error as the OP it would be cool if we can solve this :slight_smile:

I boughtTranscend SDHC 8GB, recieve it in 3 days I tell you the result.

If you do something like this, does it get any happier?


	bool firstDismount = true;

	void ProgramStarted()
	{
		sdCard.DebugPrintEnabled = true;
		sdCard.SDCardMounted += sdCard_SDCardMounted;
		sdCard.SDCardUnmounted += sdCard_SDCardUnmounted;

		if (sdCard.IsCardMounted)
			sdCard.UnmountSDCard();
	}
 
	void sdCard_SDCardMounted(SDCard sender, Gadgeteer.StorageDevice SDCard)
	{
		Debug.Print("Mounted !");
	}

	void sdCard_SDCardUnmounted(SDCard sender)
	{
		Debug.Print("Unmounted !");
		if (firstDismount)
		{
			Debug.Print("remounting card!");
			firstDismount = false;
			sdCard.MountSDCard();
		}
	}

I recieved Transcend SDHC 8GB, don’t work either.
ddurant, I tried your code. Not happy. ;(

Every socket’s pin are working, so I will command a new SDCard module in few days and try again.

What are you using for power?

Have one:
[url]http://code.tinyclr.com/project/400/spider-basic-storage-tests/[/url]

I noticed during my testing that the SDCard module doesn’t honor the write-protect switch.
I’m seeking a way to soft-detect this state

Yes we do not detect write protect.

I think i’ve got a similar issue here:

1-When using Sandisk 2Gb microSD , my code runs fine and is able to mount the SD.
2-When using a brand new Kingston 4Gb (class 4) microSD, my code fails with the following error:

Here is the error:

Mounting SD…

#### Exception System.Exception - 0xffffffff (1) ####
#### Message: 
#### GHIElectronics.NETMF.IO.PersistentStorage::.ctor [IP: 0000] ####
#### wifi_adhoc_host.Program::Main [IP: 00f5] ####

Here is my code:


// Mount SD card
            Debug.Print(">> Mounting SD...");
            _sd = new PersistentStorage("SD");
            _sd.MountFileSystem();
            Debug.Print(">> SD MOUNTED");
            VolumeInfo _sdvolumeinfo = new VolumeInfo("SD");
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;

Using a FEZ Cobra 1.3, with latest firmware SDK.

One thing i notice under Ubuntu (DiskManager) is the the model number and firmware date for the cards:

Model SU02G , Firmware version 06/2010 == Sandisk 2Gb (Works in my application)
Model SA04G , Firmware version 09/2011 == Kingston 4Gb (Does not work in my application)

It is not a hardware issue but a software issue. Both cards have been formatted FAT32 on the same computer.

Please help
Jean-Francois

I got farther down the code by having my 4Gb microSD card formatted by the SDFormatter 3.1 software (and not Windows XP formatter). But now, cannot write to the card when i get to the iFile.Write(b, 0, b.Length); (length of the file permission.inf is 0x361)


// Copy default settings & permissions from resource string to file on drive
            string sFile = Strings.NormalizeDirectory(rootDirectory) + "permissions.inf";
            if (!File.Exists(sFile))
            {
                byte[] b = Encoding.UTF8.GetBytes(Resources.GetString(Resources.StringResources.DefaultSettings));
                FileStream iFile = new FileStream(sFile, FileMode.CreateNew, FileAccess.Write);
                iFile.Write(b, 0, b.Length);
                iFile.Close();              
            }

Here is the Output Log:

Mounting SD…
SD MOUNTED

#### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
#### Message: 
#### Microsoft.SPOT.IO.NativeFileStream::Write [IP: 0000] ####
#### System.IO.FileStream::Write [IP: 002a] ####
#### wifi_adhoc_host.Program::Main [IP: 0156] ####

A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll

Double check your power source.

I think NETMF4.2 (which we are working on) has some improvements for file system.

Hi Gus,

I found a post on this board that suggested to solder a 10uF capacitor in parallel with C2 (FEZ Cobra) which is 4.7uF. in order to provide more power to the SD PWR line.

I soldered a 10uF on C2 , and bingo! It works! My Kingston 4Gb microSD card works. I used a oscilloscope to check the voltage on pin 4 (SD PWR) while stepping through the code. When i hit line iFile.Write(b, 0, b.Length); I saw the voltage drop from 3.3V to 2.5 volts DC… Putting a 10uF capacitor solved my problem.

I suggest telling folks to do the same on their FEZ boards, since newer SD card seem to draw more power.

Cheers!
JF

We will improve this. Thanks

So I just got my Spider Start Kit and I love it, but I’ve had a few bumps. This program helped me see that my USB storage works, but also that my SD storage does not (using MiniSD with Adatper or an MMC card.

Interestingly I also couldn’t use my LED from socket 5 (F) either (for Hello World - it said it couldn’t detect the LED). So I wonder if something is bad with my board.

#### Exception System.Exception - 0xffffffff (1) ####
#### Message: 
#### GHI.Premium.IO.PersistentStorage::.ctor [IP: 0000] ####
#### GHIElectronics.Gadgeteer.FEZSpider::MountStorageDevice [IP: 0005] ####
#### Gadgeteer.Modules.GHIElectronics.SDCard::MountSDCard [IP: 000f] ####
#### System.Reflection.MethodBase::Invoke [IP: 0000] ####
#### Gadgeteer.Program::DoOperation [IP: 001a] ####
#### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
#### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
#### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
#### Gadgeteer.Program::Run [IP: 0020] ####

A first chance exception of type ‘System.Exception’ occurred in GHI.Premium.IO.dll
SDCard ERROR : Error mounting SD card - no card detected.

The downside is I can’t use my camera and USB at the same time as they both want socket 3.

Any help or advice would be greatly appreciated.

USB hub will get you past the hurdle of having multiple devices on USB. Not sure how Gadgeteer handles that, but code-wise it’s as simple as that.