FEZ Hydra and SD Card

I’m having trouble with SD Card mounting. The card worked with other boards, but it seems weird on Hydra.

Probaby I’m using wrong procedure to mount it, but what is the correct procedure with Hydra ?



        public SdCardManager(Gadgeteer.Modules.GHIElectronics.SDCard sdCard)
        {
            _sdcard = sdCard;
            _sdcard.SDCardMounted += new SDCard.SDCardMountedEventHandler(sdCard_SDCardMounted);
            StartSDVolume();
        }

        private bool SdCardMountVoume()
        {
            isMounted = false;
            VolumeInfo[] vols = VolumeInfo.GetVolumes();
            if (vols.Length > 0)
            {
                Debug.Print("SD card voume mounted");
                _rootdir = vols[0].RootDirectory;
                isMounted = true;
            }
            return isMounted;
        }
        
        private void sdCard_SDCardMounted(SDCard sender, Gadgeteer.StorageDevice SDCard)
        {
            Debug.Print("SD Mounted event fired!");
            SdCardMountVoume();
        }
        bool StartSDVolume()
        {
            isMounted = false;
            try
            {
                if(_sdcard.IsCardInserted )
                {
                    _sdcard.MountSDCard();
                    isMounted = true;
                }
            }
            catch (Exception ex)
            {
                Debug.Print("ERROR SD: " + ex.Message);
                isMounted = false;
            }
            return isMounted;
        }


I’ve the SDCard board is in Visual Studio designer attached to socket F.
It seems code above really messup Hydra and need to reflash again.

@ dobova -

are these code above working on other boards?


public SdCardManager(Gadgeteer.Modules.GHIElectronics.SDCard sdCard)

When do you call this function? Why do you need _sdcard = sdCard ?

And debug to see what line of code make trouble?
Try a different SD?

@ Dat - Hi Dat thank you, but I can’t show nothing, because the Hydra is going to crash and connection with pc is broken and so I need to add some display functions on board.

Now I’ve completely got rid of SD but hydra still crash … so I’m investigating. I’m powering board externally with 12V/2.5A power supply.

But is it the correct method ?

The SdCardManager is my class that wrapper all the SD functions i need, here is shown just startup code. The constractor receive a SDCard class from main program. This is the SD board instanziated in the designer.

Start with simple project about SD

http://www.ghielectronics.com/docs/96/sd-card-module

@ dobova -

I don’t see any problem with your code but I think it is better if there have only one sdCard variable. If you want to assign more variable like that, be careful with its event. Because actually we have only one physic SD.

I’m trying to simplify code to understand where is the beef. The full code works fine on Spider and on Cobra II, so I suspect Hydra fw has some issue.
I have 3 main features attached to Hydra:
1.SD Card
2. Seeed Cell board (using K socket)
3. ENC28 with eth fw.
4. T35 display

Mainly this is going to be an SMS gateway machine to send and rx text messages.
I suspect that issue are more than one, strickly following the Murphy’s law.

Insulating all the code parts, i finally discovered that Hydra doesn’t like an sd inserted with the root dir with files during reset .
Probably it starts some sort of boot.ini procedure that finally fucks up the firmware … Very funny.

Other issue I found is that you can’t flash firmware on Win8-64 with GHI utility unless you first flash the boot it with SAMBA_CDC utility. Using SPI pin shorting, it shows the board as “GPS Camera detect on comxx”, but it doesn’t work with GHI utility in any case.

After some debuggung and investigating, it seems that if I don’t dismount SD the Hydra board get crazy at next reset. This is very awful becouse most of the time firmware get panic error, or at best the board doesn’t reset under vs2012 request for deploy.

I’ve attached Sim900 board but also leaving out the cell board and relative code and drivers the situation doesn’t change. This doesn’t happen on premium boards (EMX and G120). I didn’t test Cerberus, because it hasn’t enough memory.

PS: I checked power supply of the single boards and are all ok.

Any progress on this?

@ Duke Nukem - If you mean the SD on Hydra board problem, I didn’t solve the issue and I used G120 board that works fine. My Hydra (eth firmware) still has this problem but I will investigate better as soon as I have time.

Has anyone found a solution for this? I have the same issue when running on NETMF 4.3 with firmware 4.3.7.10

Hi @ Scott_F
I would suggest that you start a new thread as this one is 2 years old. It would also help us to help you if you post a short piece of code showing your your problem.