SD Card Mounts but errors when accessed

Board Cerb40, latest available firmware.

Ok, I give up trying to figure out why this is inconsistent, now I’m just not sure. Anyone see / hear of this mess before?

Volume Count:  1
A first chance exception of type 'System.NotSupportedException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.NotSupportedException' occurred in System.IO.dll
An unhandled exception of type 'System.NotSupportedException' occurred in System.IO.dll
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;
using GHI.OSHW.Hardware;
using GHI.OSHW.Native;

namespace SDTest
    public class Program
        public static void Main()




            VolumeInfo[] info = VolumeInfo.GetVolumes();

            Debug.Print("Volume Count:  " + info.Length);
            for (int i = 0; i < info.Length; i++)


            string[] files = Directory.GetFiles(info[0].RootDirectory);

            foreach (string str in files)

            byte[] data = File.ReadAllBytes(@ "\SD\readme.txt");



Check out example 3 in this tutorial:

it took me while to find this information, since standard MF info is included as part of a Gadgeteer tutorial. Might be worthwhile to include pointer to this document in standard MF tutorial listings. Dat?

Thank you, but I’m not entirely sure how this helps me. I’ve read that page thoroughly.

I am using the Cerb40 OSHW board and do not have access to the premium libraries, also I don’t understand what I am doing differently than that example in the context of OSHW. Additionally I am not using (and would greatly prefer not to use) the Gadgeteer libraries.

Any information debugging help here would be useful. I’ve read all the threads about adding capacitors to the card, lowering clock rate, trying different brand / low capacity cards, so on… I have no idea how to continue debugging this

Apologies, I did also try putting a Sleep immediately after the MountSD command, before using GetVolumes. This did not help.

Gadgeteer methods also fail as “Failed to mount, is this FAT32?” hoohah

this code worked for me on a cerbuino Bee:

string _root;
 if (VolumeInfo.GetVolumes()[0].IsFormatted)
        _root = VolumeInfo.GetVolumes()[0].RootDirectory;
         string[] files = Directory.GetDirectories(_root);
         for (int i = 0; i < files.Length; i++)
            Debug.Print("Cannot use SD-Card");

Err I guess I should’ve left a bit more detail on the hardware configuration.

I have 2 GHI Cerb40 II’s.
I also have 2 SanDisk microSD to SD Adapters

I soldered wires to each of the adapters, one with

One Cerb40 has .1" header pins
I attached the adapter using equal ~3" long wires and crimps with power coming directly from the 3.3V pin.
This one works and mounts correctly maybe 70% of the time.

The other Cerb40 is soldered directly to an adapter using 2" long data leads (D0-3, CLK, CMD) and ~7" total length for 3.3V and GND (was routing power through a distrib board so left them long for organizational purposes later).
This configuration never mounts. I’ve taken a volt meter to it, nothing seems off. I tested the adapter with an SD reader prior to soldering to it and it works fine, all contacts are good.

I’m baffled as to why A) the first configuration works most of the time and B) the second doesn’t work at all.

What brand / size / class of SD card are you using?

SanDisc 1 GB Micro SD

I remember that I had problems with other SD-Cards.
Did you get the same exceptions with my code?

I think that it is important to use very short cables.
I remember that I had Problems with a large SD-Card Module. After I soldered a 6.8 uF Tantal capacitor between GND and VCC directly on the SD-Card module it worked reliable.

@ RoSchmi -

After I soldered a 6.8 uF Tantal capacitor between GND and VCC directly on the SD-Card module it worked reliable.[/quote]

I copied too :smiley:

@ Dat
Hi Dat
I’m not sure what you mean with your ambiguous comments. Are you going to make a fool out of me? If you think that my observations or comments are not reasonable, please tell me in a unmistakable way.

@ RoSchmi - I would look at Dat’s comment in a positive light and say he is saying that he copied what you did. Ie. What you did was a good idea.

I might be wrong, but at least I feel good… Ignorance is bliss :slight_smile:

I agree, that’s the way I read it too - Dat just copied your formula for success and had good results

:open_mouth: Where’d all this come from lol, thats totally how I read it as well. Flattery not passive aggressive shenanigans heh.

I copied you too :slight_smile:

No no, I meant your way is really good and I need to learn, as you know, we still have something to do with SD and what you tell here, that is really good for me or somebody here to try!

Sorry because it was not clear for you!

I think Dat is saying he copied the solution and it worked for him. English a bit of a barrier for Dat but I assure you he is the nicest guy I have ever met! We apologies for any confusion.

@ Dat @ taylorza @ Brett @ MitchT @ Gus
Hi, thank you all for clearing this up. It seems that I became a victim of my own paranoia and my incompetence in the nuances of the english language. :-[ For me it’s always better to ask than to remain in doubt.

@ RoSchmi - I am certain it has happened to all of us, I can definately say I have fallen afoul of my own, as you put it, paranoia.