Main Site Documentation

SD card object initialization problem


#1

Hello,
I have EMX module with SD card connector. When I’m starting my program, it causes exceprion at

GHI.Premium.IO.PersistentStorage

when initializing

_sd

object. Here is my code:

if (PersistentStorage.DetectSDCard())
            {
                
                 _sd = new PersistentStorage("SD");//Here is the exception
                Thread.Sleep(3000);
                _sd.MountFileSystem();
            }

Debug output:

>> Mounting SD...
    #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHI.Premium.IO.PersistentStorage::.ctor [IP: 0000] ####
    #### FTPServer.Program::Main [IP: 002d] ####

My SDK Version is 1.0.2, .NET MF is 4.2.9

Any ideas?


#2

@ andre.m - Here is it:

 public class Program
    {
      static  PersistentStorage _sd;
       static SPI MySPI;
        static NetworkManager nm;
        static NameService ns;
        static FTPServer ftp;
        private static EthernetBuiltIn eth0 = new EthernetBuiltIn();
        public static void Main()
        {
            

            Debug.Print("");
            Debug.Print("Micro FTP Server FTPcko");
            Debug.Print("---------------------");

            // Mount SD card
            Debug.Print(">> Mounting SD...");


            if (PersistentStorage.DetectSDCard())
            {
                
                 _sd = new PersistentStorage("SD");
                Thread.Sleep(3000);
                _sd.MountFileSystem();
            }

#3

What kind of File System has your SD-Card?

EMX only support:
Note: Only FAT32/FAT(FAT16)

Link:
http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation%20v4.2/Premium/Index.html


#4

@ Uuuups - I’m using FAT 32


#5

@ andre.m -
At this line:

_sd = new PersistentStorage("SD");

I have EMX on custom board, it’s Freescale Tower System adapted board. Which pins you want to know?


#6

@ andre.m - Yes, you were right, one of the SD pins was broken. Thank you.