Error with SD Card

I’m trying to use a Micro SD Card with 2 GB. I’m using the following code:


static void try2mount() {
    try {
        RSS_Volumes.cardStorage = new PersistentStorage(„SD);
        RSS_Volumes.cardStorage.MountFileSystem();
    } catch {}
}

static void RemovableMedia_Insert(object sender, MediaEventArgs e) {

    if (e.Volume.IsFormatted) {
        getSystemInfo(e.Volume);
    } else {
        Debug.Print("Volume will be formated...");
        try {
            e.Volume.Format("FAT", 0);
        }
        catch { }
    }
    Debug.Print("Volume mounted");
}

Sometimes it works, sometimes I’m getting the following error:


 #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHIElectronics.NETMF.IO.PersistentStorage::.ctor [IP: 0000] ####
    #### Futus_RSS.RSS_SDKarte::try2mount [IP: 0008] ####
    #### Futus_RSS.RSS_SDKarte::init [IP: 0019] ####
    #### Futus_RSS.RSS_Volumes::init [IP: 002c] ####
    #### Futus_RSS.RSS_Controller::start [IP: 0010] ####
    #### Futus_RSS.Program::Main [IP: 0004] ####
Eine Ausnahme (erste Chance) des Typs "System.Exception" ist in GHIElectronics.NETMF.IO.dll aufgetreten.

Can somebody tell me what’s going wrong? Thank you!

These double quotes look weird to me.

Too much information missing to give you an intelligent answer.

What device? Was an SD card inserted?

Have you tried the code in the tutorial? http://wiki.tinyclr.com/index.php?title=File_System#SD_Cards

Thank you very much for the prompt answers. The double quotes are also in the sample (http://wiki.tinyclr.com/index.php?title=File_System#SD_Cards).

The device is the Dev-Kit for the Chipworkx Module. Card is always inserted. I took the code from the tutorial. I thought, that the most important thing is to mound the card. But for me it seems that the error occurs already in the constructor of PersistentStorage.

What locale are you in and using in Windows? The quotes that I can see in the code show this:

" and then the text SD and then "

ie both “normal”, but your cut/paste shows the first one as abnormal. Perhaps that’s just the formatting in the forum? Here’s just a text line…

PersistentStorage sdPS = new PersistentStorage(“SD”);

Thank you for your answer, Brett. I just checked it and it is only a formatting issue. In my code it’s “SD”. So this shouldn’t be the problem.

Does the sample code you referenced run with the SD card already installed?

sorry, but I don’t understand what you mean.
I tried both - my own code (published in this thread) and the code from the sample on this website (downloads and tutorials). Both don’t work perfect, because the already mentioned error occures sometimes.

try another SD?

How are you powering your board?

I’m just powering my board over USB. No additional power supply is available at the moment. Could this be the reason?

We also have this kind of problem. We are using a custom board based on EMX. For now we have produced 6 board based on the same schematic and same components. Boards can be power sourced by USB or through an external power supply (8-32V DC). We embedded on the boards linear regulators and traditionnal filtering and protection system to have a good quality of power source.

However 3 of the 6 boards can not works with Samsung 4GB SD cards. For them we need Sandisk µSD. The other boards works with Samsung but one of them do not work with a Sandisk… In our case sourcing with USB or a laboratory stabilized power supply do not impact this.

Please try a more reliable power source.

What do you exactly mean by that? Can I copy the power source from the Dev-Kit?

Use a power adapter or use a powered USB HUB.

I tried a powered USB Hub, but it’s still the same.

have you tried a different SD?