Fez Raptor - SD Card Module

Hiiii :slight_smile:

Sorry, I am a french programer and I have a basic english :stuck_out_tongue:
I will explain my problem:

Today, I need to work with a Fez Raptor Card, I have 5 modules whose 1 SD card module.
I know I don’t need to mount the SD Card in my program, but when I “Start Debugging”, I have this error:

Using mainboard GHI Electronics FEZ Raptor version 1.0
    #### Exception System.Exception - 0xffffffff (1) ####
    #### Message: 
    #### GHI.IO.Storage.SDCard::NativeConstructor [IP: 0000] ####
    #### GHI.IO.Storage.SDCard::.ctor [IP: 0029] ####
    #### GHI.IO.Storage.SDCard::.ctor [IP: 0005] ####
    #### GHIElectronics.Gadgeteer.FEZRaptor::MountStorageDevice [IP: 0019] ####
    #### Gadgeteer.Modules.GHIElectronics.SDCard::Mount [IP: 0016] ####
    #### GadgeteerAppFranck1.Program::InitializeModules [IP: 0028] ####

I think the SD Card Format is the problem, but i don’t know what format is ok for the FEZ Raptor.
If anyone could help me, that will be really cool.

Thanks all,

Sorry for my late awnser (it’s cause of my new account)

I tried the 2 formats “FAT16” & “FAT32”, but i always have this error.

Voyez mon ‘Direct Message’ (Message privé), en français.

Thanks SouthernStars for your direct message. This is what you need =)

void ProgramStarted()
            Debug.Print("Program Started");
                //leGSM = new CellularRadio(4);
                cellularRadio.DebugPrintEnabled = true;
                cellularRadio.LineReceived += cellularRadio_LineReceived;
                cellularRadio.SignalStrengthRequested += cellularRadio_SignalStrengthRequested;
                cellularRadio.PinStateRequested += cellularRadio_PinStateRequested;
                cellularRadio.GsmNetworkRegistrationChanged += cellularRadio_GsmNetworkRegistrationChanged;
                cellularRadio.SmsReceived += cellularRadio_SmsReceived;
                //cellularRadio.IncomingCall += cellularRadio_IncomingCall;
                cellularRadio.OperatorRequested += cellularRadio_OperatorRequested;
                cellularRadio.PhoneActivityRequested += cellularRadio_PhoneActivityRequested;
                if (sdCard.StorageDevice.Volume.IsFormatted == false)
                    Debug.Print("Formattage en cours...");
                    sdCard.StorageDevice.Volume.Format("FAT", 0);
                //Création de deux timer, un qui tick toutes les 10 secondes, un autre qui tick chaque seconde
                //Tick toutes les 10 secondes, renvoyant l'état du signal et du réseau grace à tt_Tick
                GT.Timer tt = new GT.Timer(10000);
                tt.Tick += tt_Tick;
                //Tick chaque seconde, renvoyant l'état de l'écoute téléphonique
                GT.Timer Appel = new GT.Timer(1000);
                Appel.Tick += Appel_Tick;
                //Reset les Led
            catch (Exception ex)
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
  • Visual Studio 13,
  • SDK 4.0.30319
  • Firmware (TinyCLR) version information
  • SD Card: SDHC Panasonic 8Go.
  • I use Raptor Fez or Reaper, and I have the same error.

I hope you can help me ^^"

First, I suggest to upgrade to the last SDK and firmware, carefully following the instructions.

Next, try this (not perfect but is working for a simple test)

namespace YourNamespace
    public partial class Program

        public static VolumeInfo oSDVolumeInfo;
        //public static Gadgeteer.Modules.GHIElectronics.SDCard sdCard;
        //  this.sdCard = new GTM.GHIElectronics.SDCard(9);

        private bool m_bCardInserted;
        private bool m_bFileSystemMounted;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            sdCard.DebugPrintEnabled = true;
            sdCard.Mounted += SdCard_Mounted;
            sdCard.Unmounted += SdCard_Unmounted;

            if ((sdCard.IsCardInserted == true) && (sdCard.IsCardMounted == false))

        private void SdCard_Mounted(SDCard sender, GT.StorageDevice device)
            int nIndexFolder;
            int nUpperFolder;

            string[] sAFolder;

            Debug.Print("SDCard mounted");
            m_bCardInserted = true;
            oSDVolumeInfo = sdCard.StorageDevice.Volume;
            Debug.Print("IsFormatted     : " + oSDVolumeInfo.IsFormatted.ToString());

            if (oSDVolumeInfo.IsFormatted == false)
                // VolumeInfo is the class that contains volume information for a specific
                //      media.
                // .GetVolumes()[0] aquires the first volume on the device. Change the 
                //      index for different volumes.
                oSDVolumleInfo.Format("FAT", 0, "SDC00", true);
            }   //  oSDVolumleInfo.IsFormatted == false

            Debug.Print("SerialNumber    : " + oSDVolumeInfo.SerialNumber.ToString());
            Debug.Print("DeviceFlags     : " + oSDVolumeInfo.DeviceFlags.ToString());
            Debug.Print("FileSystem      : " + oSDVolumeInfo.FileSystem);
            Debug.Print("FileSystemFlags : " + oSDVolumeInfo.FileSystemFlags.ToString());
            Debug.Print("RootDirectory   : " + oSDVolumeInfo.RootDirectory);
            Debug.Print("TotalFreeSpace  : " + oSDVolumeInfo.TotalFreeSpace.ToString());
            Debug.Print("TotalSize       : " + oSDVolumeInfo.TotalSize.ToString());
            Debug.Print("VolumeID        : " + oSDVolumeInfo.VolumeID.ToString());
            Debug.Print("VolumeLabel     : " + oSDVolumeInfo.VolumeLabel);
            Debug.Print("VolumeName      : " + oSDVolumeInfo.Name);

            Debug.Print("Available folders : ");
            sAFolder = Directory.GetDirectories(device.Volume.RootDirectory);
            nUpperFolder = sAFolder.Length - 1;

            for (nIndexFolder = 0;
                nIndexFolder <= nUpperFolder;
            }   //  nIndexFolder

            m_bFileSystemMounted = true;
        }   //  SdCard_Mounted

        private void SdCard_Unmounted(SDCard sender, EventArgs e)
            Debug.Print("SDCard unmounted");

            m_bFileSystemMounted = false;
            oSDVolumeInfo = null;
        }   //  SdCard_Unmounted
    }   //  Program
}   //  YourNamespace

I tryed your following code, all is up to date, but nothing … i always have this error.
In the output, I have 2 times the error, withe the same Exception, the same Message.

I don’t know what happen … I use the sdCard Module 2 days without problems but yesterday and today I have this error …

I am distraught x’(

How is your board powered? I had an Issue with SD due to the bad power supply. The error was the same.

Insert the SDCard before launching the test, it is an excerpt from a huge program. The sample doesn’t monitor the card inserted event.
You say all is up to date, but describing how you performed the update is not explained.
Which SDK version, wich firmware version, bootloader, etc…are really installed.
Also, which line in the sample produces the error? Place breakpoints and run step by step.
Also disconnect and remove from the configuration all other devices, you don’t provide any information about what is connected, hence it is not proved the SD is the real culprit.
If you want some progress about the issue, you must keep the hardware and the software as simple as possible.
Of course see also the problem of the power supply as EvoMotors pointed.

The SDCard is always inserted before lauching the test, i tried to insert the sd card after and I have the same error.
I followed all of your instructions, I put some breakpoints in the program, the line who cause the error is in the Program.generated.cs:

My module is connected to the good port (port n°9) on the designer and on my Raptor Card.
I precise than i tried with the card inserted, and without the card inserted. I have the same error without sd card inserted, it's what i think it's not cause of sd card.
And I tryed whithout code in my program, I just have the basic:

public partial class Program
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");


and the error is always there…

And @ EvoMotors, I don’t know if I anwser at your question: my board is powerred by the USBClientDP Module.
But the worst … it’s worked well one day before I ask you help…

If you have connected the module in the designer then the initialization is handled for you in “Program.generated.cs”.

So you don’t need the line

In your code.

So here’s three things I can suggest you try.

  1. format your SD card again, in a PC.
  2. power the device from a suitable wall-based power supply, not by a USB PC supply. If you have other peripherals attached, disconnect them to minimise the possible power draw
  3. replace (or at least swap) the Gadgeteer cable around to see if that changes the behaviour