SD Cards

I’m using the following code:

                                if (PersistentStorage.DetectSDCard()) {
                                    PersistentStorage ps = new PersistentStorage("SD");



                                    try {
                                        if (!VolumeInfo.GetVolumes()[0].IsFormatted) throw new Exception();

                                        string root_dir = VolumeInfo.GetVolumes()[0].RootDirectory;

                                    } finally {
                                } else {
                                    Debug.Print("No SD card present.");

However, I keep getting this exception thrown:

#### Exception System.IO.IOException - CLR_E_FILE_IO (9) ####
#### Message: 
#### Microsoft.SPOT.IO.VolumeInfo::.ctor [IP: 0000] ####
#### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0022] ####

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

Any idea what is causing this?

your code?

Have you tried one of the sample code blocks from Those are known working… Then there are some other good posts here on this topic that are worth searching out too.

You also probably should say where the exception is thrown…

What card are you using ? (manufacturer, type, size)

There is a board specific card size limit. My Panda II will handle a 4Gb card, but my Domino coughs up the error you are seeing with the same card. I think the limit is 2Gb for the Domino. This bullet from the Panda II brochure seems to imply that.

2GB is a known limitation for a lot of devices out there are the SD standard changed after 2GB, that is SDHC. There is no limitations on GHI devices as we support old specification s and new ones as well.

I suppose 99% will work fine, but i still can’t run my 4GB Kingston card on Domino even with additional capacitor.

@ Gus - thanks for clarifying.

So it seems I was barking up the wrong tree. I just happen to have a card that doesn’t behave… not a board that has limitations :wink:

We have seen it where some cards work fine after we add +10uF capacitor to the power line going to SD card. See schematics please

I have 470uF instead of 10uF (the smallest i had). Should i try with 10uF nevertheless ?

This is the problem you stated:

In my case exception is thrown in PersistentStorage ctor so it doesn’t apply. I am no hardware guy so please tell me. If i change the 470 uF to 10uF as you recommed is there a chance that i might use my Kingston card? I need to know if my trip to electornics shop is worth any time :wink:

Which FEZ are you using?

I didn’t try soldering extra capacitor on other boards.

Fro domino, look at schematics above and connect the SD power directly to 3.3V, so T2 FET is no longer used. Does this make your SD card work better?

I’ve got exactly the same problem with my Domino -

I was checking the card in the card reader (on WinXp) and getting frustrated as I was just yanked the card from the reader without ejecting it in windows. And lo and behold, it worked on the Domino.

I can not explain it but I can reproduce it 100%

What are the steps to reproduce the problem and what is the problem? You said it worked so I am not sure.

If I eject the sd card in windows before I insert it in the domino I have exactly the problem described earlier in this thread - system.exception thrown without any stacktrace or anything at

PersistentStorage sdCardInterface = new PersistentStorage("SD");

but if I just pull the sd card from the reader without ejecting it in windows first it works just fine.

What kind of card reader on the xp box?

@ Gus - I’ll see if I can reproduce this tonight on a Win7 desktop using a USB card reader, with both a 2Gb and 4Gb cards.

@ ErikH
Using a Kingston 4GB MicroSD HC card with the usb-mini reader that came with it (so also Kingston) - WinXP UK with danish locale settings.

If you need more details please let me know, just wanted to pitch in now I could reproduce the working/ non working

I have exactly the same card as you Torben. I will try to reproduce your steps first thing in the morning!