Issue with GHI SD Card Module & G400D / TH

Please help me with the Gadgeteer SD Card Module connection to G400D / TH module
[url]https://www.ghielectronics.com/catalog/product/271[/url]
I’m getting following error. I already wasted long time on this and don’t know what else to do. What am I doing wrong?

Step into: Stepping over non-user code ‘GHI.IO.Storage.SDCard.SDCard’
#### Exception System.Exception - 0xffffffff (3) ####
#### Message:
#### GHI.IO.Storage.SDCard::NativeConstructor [IP: 0000] ####
#### GHI.IO.Storage.SDCard::.ctor [IP: 0029] ####
#### GHI.IO.Storage.SDCard::.ctor [IP: 0005] ####
#### G400Device.Utilities.SDCardHelper::SDMountThread [IP: 0033] ####
A first chance exception of type ‘System.Exception’ occurred in GHI.Hardware.dll

Exception was thrown: System.Exception
GHI.IO.Storage.SDCard::NativeConstructor
GHI.IO.Storage.SDCard::.ctor

This is the code I’m using to test


SDCard SD = null;
try
{
        SD = new SDCard();
        SD.Mount();
}
catch(Exception ex)
{
        // error...
}

Your PC17 connection for the SD_CLK is wrong. It should be connected to PA17

Thanks, I corrected the pin, still not working. :wall:

Just to be sure, GND and VCC are also connected?

Connected.

Ok, it was my fault. It wasn’t properly connected.

Now is another issue. I cannot get filesfrom it:

VolumeInfo.GetVolumes()[0].IsFormatted returns false. I tried with several cards.

@ EvoMotors - perhaps Reply 11 of this thread helps:
https://www.ghielectronics.com/community/forum/topic?id=23312&page=2

@ RoSchmi - I did check it out and lo luck

if (sdPS.Mounted) returns true but vol.IsFormatted returns false… :wall:
tried with 8MHz, 12MHz, 16MHz, and 24 MHz

Tried with 2 cards, both are 16GB SanDisk class10 45MB/s


            SDCard sdPS = new SDCard();
            sdPS.Mount(12000); // try at 8MHz - 12MHz - 16MHz - 24 MHz
            VolumeInfo vol = VolumeInfo.GetVolumes()[0];

            if (sdPS.Mounted)
                Debug.Print("Mounted");

            if (!vol.IsFormatted)
                Debug.Print("Mount Failed...!");
            else
            {
                Debug.Print("Mount OK....");
                Debug.Print("Label = " + vol.VolumeLabel);
                Debug.Print("Size = " + vol.TotalSize);
            }

EDIT:
Just found old 8GB PNY 20MB/s and it worked using 24 MHz.
If I cannot rely on the card reader to work with new cards this is not acceptable!

@ EvoMotors - Just tried your code on a raptor with a 4 GB Kingston Class4 and a Samsung 32GB EVO Class 10 48 MB/s and it worked.

Only work for me with on SD Card (about 5 years old 8GB PNY 20MB/s)

I got 2 SD card modules from GHI and tried on both of them with the same results. Is the problem is in G400D / TH? I’m using VS2013, Microsoft .NET Micro Framework 4.3 (QFE2) and GHI Electronics NETMF SDK 2016 R1.

On FEZ Cobra III I’m able to use any cards that I have in the house, but they are MicroSD, so I cannot test them with GHI SD card module. None of them worked with MicroSD to SD adapter.

Anyway, right now I’m just glad it works with one of my cards. I’ll buy another card and test with it later.

How does this look wired up on your bench? The wiring is critical due to the speeds. Is there any decoupling cap on the power pins near the card socket?

I’ve never had any issues reading any MicroSD cards with the G400 and a custom PCB. Same with G120. Any card from 2 to 32GB just works.

Looks like the GHI SD Card Module already have decoupling capacitor.
At this point all components are on the large breadboard. And since the SD Card module is for the gadgeteer I also use the gadgeteer socket break-out.

I’m lucky that anything works with this type of set-up? :smiley:

Can you recommend the SD Card module? I can’t use the gadgeteer module for the final design.

I spoke to soon when I said it is working on my old 8GB PNY 20MB/s. This is the only one card that actually been detected as formatted. However, I can’t even get list of files on it. Always returns 0 files. So I’m back to square one…

I do believe it could be because of the bad connection on the breadboard. But breadboard is good quality, no the cheep one.

Breadboards are really crappy sometimes, and they all look the same, so on first (and mostly not on second or third) view you can’t see if it is one from a ‘good’ or a ‘bad’ producer. I have one that works fine with normal wires and resistors but if I insert a module with these thicker pins, the connectors inside the board begin to touch each other, what causes shortcurcuits everywhere. Another one has such tight contacts, that I can’t even insert a resistor without (nearly) destroying the board or the component. I can only use three of the six boards I have at all. I think many things, especially when working with digital devices don’t work property on a breadboard. I began to solder the critical connections and just do the basic stuff on the breadboards, and everything works nicer.

It is a breadboard issue. I replaced all jumpers wires to solid core wires and SD card reader stated working reliably.

How long are your wires from the breakout to the G400TH?

I still think this is down to the wiring. I’ve run an SD card some 30cm away from the G400D on a PCB with good grounding and it works fine. With your prototyping setup you can’t guarantee that ground protection.

The jumpers between G400 and breakout are 15cm long + long gadgeteer cable from the breakout to the SD Card module. I replaced jumpers with 5cm solid core wire soldered to the break-out board. So far all cards are working (except microSD with SD adapter)

I don’t think its a wire length issue (in my case), I think its a connection between jumpers and breadboard. I noticed a voltage drop on the SD card module when it was connected with jumper wires.

1 Like