Main Site Documentation

SD Cards


#1

I’m using the following code:


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

                                    Thread.Sleep(500);

                                    ps.MountFileSystem();

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

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

                                        Thread.Sleep(250);
                                    } finally {
                                        ps.UnmountFileSystem();
                                    }
                                     
                                    Debug.Print("Save");
                                } 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?


#2

your code?

Have you tried one of the sample code blocks from code.tinyclr.com? 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…


#3

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


#4

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.


#5

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.


#6

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


#7

@ 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:


#8

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


#9

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


#10

This is the problem you stated:
http://www.tinyclr.com/forum/1/2799/


#11

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:


#12

Which FEZ are you using?


#13

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


#14

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?


#15

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%


#16

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


#17

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.


#18

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.


#19

@ 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


#20

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