G400HDR SD card hangs in PeristentStorage constructor


I am still testing my new G400. At the moment I look at SD card performance. Therefore I wrote a small test application that I shared on Codeshare: https://www.ghielectronics.com/community/codeshare/entry/864

It runs well on my G120 with different SD cards.

I had some issues with my G400 + SD Card Module last week, so I was excited to try the new firmware that shipped with the 2014 R1 package today.

But now my application hangs at the line

The thread just hangs and does not respond any more. I tried this with different SD cards, all of which work with my FEZ Cobar II.

Do you have any hint or advice?


@ Peter B -

  • What kind of that card?
  • Try to format by Window


I tried a Sandisk Ultra 16GB and an Transcend SDHC 16GB. I formatted them on Windows with Fat32.

Both cards work with the same program on my 2 FEZ Cobra II.

Can anyone with an G400HDR and a SD Card Module do me a favoiur?

Can you download my SD Speed Test from Codeshare ( https://www.ghielectronics.com/community/codeshare/entry/864 ) and let it run on a G400 with the new Firmware (v4.2.11.2).

On my module and with both my SD-cards the test hangs at the line

Can anyone reproduce that behavior?

Thanks a lot in advance

@ Peter B -

I just run your test program

below is result:

Look like G400 is faster than G120 too much. Test on SDHC 16 GB Extreme Speed class 10

This is result from your program. With my program that I usually use to test speed, G400 is usually faster than g120, EMX 2X if same card.

@ Dat: Thanks a lot for testing. So my program isn’t wrong. I have to dig further.

Which firmware did you use?

I had the same times that you see using G120 and G400

With the speed on a G120 dropped to ~1:20 and the program stopped working on the G400.

I will try to get oher SD cards and run the test again tomorrow.

@ Peter B -

On G400 I tested on

Did you mean on G400 the SDCard work, but G400, it doesn’t?


@ Dat

Yes, that is what I am saying, BUT!!!

The problem is me!

I was just re installing my computer since I got a new SSD :slight_smile:

And during that I think I found the problem. I installed the new SDK, but I did not exchange the references in my Visual Studio Solution. I still referenced GHI.Premium.IO and GHI.Premium.System

Sorry that I keep bothering you with such stupid mistakes. I will test again with the correct references when I go to work tomorrow.

Sorry again

@ Dat:

Not I was wrong. That was not the problem.

Today I downgraded to the 2013R3 firmware and I get the same errors. So I think that my hardware has some problems.

I will try to get a new board and run my tests again.

@ Peter B -

you said works fine, so try to go back to see what happen.

I don’t think there is different about SD between and

@ Dat

That’s what I ment with 2013R3 firmware.

I downgraded to and I have the same problem with that firmware. So I concluded, that my hardware must have some issues, because worked before - even though it was not very stable.

I will order a new G400 and try it with that again.

Thanks so far for your help

@ Peter B -

I still don’t think the problem is G400 board. It is not easy to be damaged, (unless we deliberate to do that :stuck_out_tongue: )

Check your cable, make sure everything connected well.

@ Peter B - check power supply and voltage on the sd card, it’s quite critical if v drops too much

Thanks for those hints. I already changed all Gadgeteer cables. That didn_t help.

I checked 3.3V and 5V with a multimeter. They seemed OK. But I could try to use an Oszi.

I did not look for the voltage at the SD card. I will give that a try on Monday.

I solved my problem - at least partially.

Manually uninstalling all GHI products and installing the 2014 R1 SDK fixed my major problem.

Now I can run the SdTest program on my G400. It succeeds for 2 out of 5 SD cards. With the other cards I get various exceptions. Please see the attached image for details.

I tried to format the cards again and I also tried FAT as well as FAT32 for the 2GB cards. That didn’t change the result.

An interesting result: the exception varies from card to card. All cards worked with the G120.

Can you suggest a 16Gb SD card that works reliably with G400?

@ Peter B -

1st exception:
try with these:

 FileStream stream;
                // For write

                stream = new FileStream(rootDirectory
                           + @ "\abc.txt", FileMode.Create);

I usually just keep FileMode.Create for param
2nd and 3th exception:
- Try with shorter cable, any different?
- Does it write few blocks then that exception is raised? reduce the block size or delay some ms between 2 blocks?

Can you suggest a 16Gb SD card that works reliably with G400?[/quote]

I had 2 different kind of 16 SD, both work well, one of them now is “SDHC Extremespeed class 10 16G Micro Center”

some problem can be happened with small and old SD such as 128MB, 32MB, 16MB, … but from 1G to 32 it should work.

Because of many kind of SD card, so we will check your SD on G400

@ Dat

Thanks for your tips. I tried them today. Unfortunately without much success.

I already use the shortest Gadgeteer cable from your Gadgeteer Assorted Cables package.

Reducing the the buffer size did not improve the performance. Same for adding a Thread.Sleep(2) after stream.Write.

However I once got it working with all cards! Once all SD cards worked, but it took about 1 minute per 4mb. That is the same speed I see for G120. But I cannot reproduce that. Redeploying the same project made it break again.

Today I ordered some other SD cards. Maybe I find one that works.

Thanks for your help so far

@ Peter B -

We will make an improvement on G400 and EMX with SD card issues. If you can not wait, I have an idea if you are interested, using G400 + ALFAT module then you can reach up to 350KB/s for writing. And same as G120, ALFAT is happy with many cards, even more.

We can share you NETMF test code driver if you like. Just in case the speed is important to you

@ Dat:

Thanks for your reply. That might be an option. Even more important than speed is stability. We are about to build an device that has to run for months in one go. It has to buffer up to 100MB per day. That is not to much,

The NetMF device shall control other devices. The important thing is, that we do not lose data from those devices. In normal operation the data is just forwarded over ethernet. Only if the network or the database is not available, the data has to be buffered up to 24 hours.

What solution would you propose for that scenario?

@ Dat:

I ordered 7 MicroSD cards. 6 of them work with my G400 and the SpeedTest program.

It seems that the Samsung cards work best. I think I will stick with them.

Thanks for your support