SD Card - Error in Constructor of PersistantStorage

Hello! I’m just finishing my individual custom-board for the chipworkx module. I wrote my testcode on the dev-kit and everything worked fine. I’m also using SD card with the following, very simple code:


InputPort p = new InputPort(ChipworkX.Pin.PA29, true, Port.ResistorMode.Disabled);
while (p.Read() == true)
{
    Thread.Sleep(1000);
}

try
{
    sdPS = new PersistentStorage("SD");
    Thread.Sleep(2000);
    sdPS.MountFileSystem();
} ...

With the div-kit it works fine. I have 2 SD cards (2 GB no name and 8 GB San Disk) for testing. Both are working fine. I can insert them before or after power on, also while my application is running - it always works. Also formatting them is possible.

On my custom board both cards won’t work. the San Disk with 8 GB always throwing the following error.


    #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHIElectronics.NETMF.IO.PersistentStorage::.ctor [IP: 0000] ####
    #### Futus_RSS.Program::Main [IP: 0034] ####
Eine Ausnahme (erste Chance) des Typs "System.Exception" ist in GHIElectronics.NETMF.IO.dll aufgetreten.

No matter what I’m trying, it always fails when I’m calling the constructor of PersistensStorage.

The second one also fails, but there’s a way of using it. If board is still powered on, I have to take it out and give it back to the holder. Then I have to make a soft reboot with MFDeploy - Reboot CLR or starting to debug with visual studio. Then it works and I can mount, format, read, write,…
Everything works fine until the next restart with power off. After such a reset, always the same error occurs no matter what I’m doing. The only way is to take out the card and but it back and make a soft reboot. Only making a soft reboot doesn’t help, it’s very important to take it out and put it back before the soft reboot.

Has somebody an idea what could be the problem? Thank you for your help!

Usually power issues. Also note the pull up or pull down on the dev kit and compare to what you have.

Thank you for the prompt reply. I’m using PA0, PA1, PA2 and PA6. PA1 has a pull up. PA4 and PA5 are unused on my custom board. Is this ok? Or will I need pull ups or pull downs for other pins?
I have also connected a 22 uF capacitor to the power pin of the SD card. Is this enough?
Thank you!

I also have a problem when using such a simple code like this:

PersistentStorage SDCard = new PersistentStorage(“SD”);

When I built the code to deploy into my Fez Panda II, it thrown me an error of :

“The type ‘GHIElectronics.NETMF.USBHost.USBH_Device’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘GHIElectronics.NETMF.System, Version=4.1.8.0, Culture=neutral, PublicKeyToken=null’. c:\Documents and Settings.…\visual studio 2010\Projects\MFConsoleApplication2\MFConsoleApplication2\Program.cs”

I looked into the library and saw that there was three constructors for “PersistentStorage”.

One is “public PersistentStorage(GHIElectronics.NETMF.USBHost.USBH_Device usbDevice);”,

one is “public PersistentStorage(string DeviceID);”,

and the other one is “public PersistentStorage(GHIElectronics.NETMF.USBHost.USBH_Device usbDevice, byte massStorageLogicalUnit);”

However, in my library of “GHIElectronics.NETMF.USBHost” there was not a definition of class “USBH_Device”. But when I look on the GHI Electronics NETMF Library on the web site, there was. I downloaded the GHI NETMF v4.1from the support web page: Support – GHI Electronics.

I am looking for a solution for this problem. Any helps are appreciated. Thank you in advance!

When you find a class in library documentation, look at very top and you will see what DLL is needed.

@ Thaho - It could be good to create your own topic unless the problem is directly related with the initial post

@ Gus: I dont know axactly what to do with the .dll file. I’ve upload some pics of my program window for a good view of my problem at my new topic at http://www.tinyclr.com/forum/topic?id=7150.

@ leforban: I’m sorry for this inconvenient because I saw that the topic has an exact name of my problem. I also create my own topic at: http://www.tinyclr.com/forum/topic?id=7150. Hope you can help me to solve this problem.

The getting started ebook explains DLLs and shows how to add them.

I just checked my hardware and I did exactly the same of what is shown in the schematics of the dev-kit. on the dev-kit I can only see one pullup - is this enough? or is it necessary to do something else, which isn’t shown in the schematics of the dev kit?
What I can’t understand is the fact, that power source is ok after a soft reboot, but fails after a hard reboot.
Also the fact, that the sd card won’t work anymore after it fails for one time until i’ll take it our is strange - isn’t it?

I really hope, somebody can help me - thank you in advance!

last thing to check, find the pull up resistors on the deve board itself. maybe some of them changed to DNP but were not labeled on the schematics.

Thank you very much for you tip - I will check this.
You are always talking about resistorS (more than one) - i can only detect one on the schematics. Should there be more?