GameO SD card usage

Hello,

Does anyone know how to bring the SD card on FEZ GameO online?

SDCard sdCard = new SDCard(*);

I tried socket numbers from 0-20 and not one is working it Returns only the error “InvalidSocketException”.

Background:
I’am wrinting currently on a simple loader application for plug-in architecture and therefore it’s needed, for games and my robot tools at the same time, without flashing.
There will be also some GUI stuff available. (works on a different project also on EMX / G120 with Glide UI)
When the application loader is finished it will be available for free.

Greetings from Nordrach
André Spitzner

@ bcplanet - Welcome to the community!

The Game-O does not have a SD card socket? Are really asking about the Game-O?

Yes it does. You can use it through nermf directly. Do not use anything gadgeteer.

Ooops. I looked at my Game-O and did not see a slot for the SD. I forgot it was internal.

having to unscrew the case is easier than flashing?

ups sorry, yes i mean the MICRO SD on board.

Thanks for answer Gus!

Ok, i will try it today evening directly via NETMF and will write a driver.
That should save some memory usage.

I will respond my results imediately.

In future its eaysier for me to unsrew than flashing. I want to write more than one plugin, currently i have written 3 for GameO. Or i write an application addon to transport files via USB onto the memory card.

thx
André

PS: And yes, its a nice developper toy.

@ Gus -

I have tried many things, but does also not working on GameO with NETMF directly.
(on using PersistentStorage throws NotSupported exception, thats may be ok)

Did you have or someone else an idea?

  • 2 different Transcent MicroSD 2 GB (tried with 16/32/64k blocksize)
  • VST 2012 / Win8
  • .NETMF and Gadgeteer Package 2013 R2
  • .NET MF 4.3 (RTM)
  • GameO aktualized with FEZ_Config_v013.exe (no options changed)

here is some of my test code:

using System;
using Microsoft.SPOT;
using System.IO;
using Microsoft.SPOT.IO;

namespace TestMicroSD
{
public class Program
{
public static void Main()
{
// The event never occurs
RemovableMedia.Eject += RemovableMedia_Eject;
RemovableMedia.Insert += RemovableMedia_Insert;

        string currentDirectory = Directory.GetCurrentDirectory();
        // Output: >> "\\"

        string[] fileSystems = VolumeInfo.GetFileSystems();
        // Output: >> "FAT"
                    
        VolumeInfo[] volumeInfos = VolumeInfo.GetVolumes();
        // Output: >> returns VolumeInfo[0] = empty ???

        // Throws System.IO.IOException
        StreamWriter writer = new StreamWriter("\\test.txt");
        writer.WriteLine("Hello Disc");
        writer.Flush();
        writer.Close();
    }

    static void RemovableMedia_Insert(object sender, MediaEventArgs e)
    {
        // Never occurs on eject
    }

    static void RemovableMedia_Eject(object sender, MediaEventArgs e)
    {
        // Never occurs on insert
    }
}

}

Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)

Thx for button info, it’s very early in the morning here.

Here formatted


 using System;
 using Microsoft.SPOT;
 using System.IO;
 using Microsoft.SPOT.IO;

 namespace TestMicroSD
 {
 public class Program
 {
 public static void Main()
 {
 // The event never occurs
 RemovableMedia.Eject += RemovableMedia_Eject;
 RemovableMedia.Insert += RemovableMedia_Insert;

 string currentDirectory = Directory.GetCurrentDirectory();
 // Output: >> "\\"

 string[] fileSystems = VolumeInfo.GetFileSystems();
 // Output: >> "FAT"

 VolumeInfo[] volumeInfos = VolumeInfo.GetVolumes();
 // Output: >> returns VolumeInfo[0] = empty Huh

 // Throws System.IO.IOException
 StreamWriter writer = new StreamWriter("\\test.txt");
 writer.WriteLine("Hello Disc");
 writer.Flush();
 writer.Close();
 }

 static void RemovableMedia_Insert(object sender, MediaEventArgs e)
 {
 // Never occurs on eject
 }

 static void RemovableMedia_Eject(object sender, MediaEventArgs e)
 {
 // Never occurs on insert
 }
 }
 }

you must wait for the media insert event and the mount the file system.

you are not waiting, and then exiting main which ends the program.

I suggest you read the following documentation:
https://www.ghielectronics.com/docs/51/netmf-file-system

@ andre.m - OP is not using gadgeteer.

@ Mike - @ andre.m

Thats right in the last i have not waiting. That was false.

But when i’m waiting how long? I have waiting 3 time up to 2 hours. The events for eject and insert never occurs. I tried also the other examples but they are not compatible (System.NotSupportedException), it’s not a EMX (there is the code working)

Do have anyone a working solution?


using System;
using Microsoft.SPOT;
using System.IO;
using Microsoft.SPOT.IO;
using System.Threading;

namespace TestMicroSD
{
    public class Program
    {
        public static void Main()
        {
            // The event never occurs
            RemovableMedia.Eject += RemovableMedia_Eject;
            RemovableMedia.Insert += RemovableMedia_Insert;

            Thread.Sleep(Timeout.Infinite);
        }

        static void RemovableMedia_Insert(object sender, MediaEventArgs e)
        {
            Debug.Print("Insert");
        }

        static void RemovableMedia_Eject(object sender, MediaEventArgs e)
        {
            Debug.Print("Eject");
        }

    }
}


You need StorageDev.MountSD(); found in oshw libs and then the event will fire.

@ andre.m & @ Mike:

Ohh Jesus. I found a working solution.

Call first:

GHI.OSHW.Hardware.StorageDev.MountSD();

found on:
https://www.ghielectronics.com/docs/45/fez-cerbuino-bee-developer

Direct window Output does now:
VolumeInfo.GetVolumes()[0]
{Microsoft.SPOT.IO.VolumeInfo}
DeviceFlags: 0
FileSystem: “FAT”
FileSystemFlags: 0
IsFormatted: 1
Name: “SD”
RootDirectory: “\SD”
SerialNumber: 0
TotalFreeSpace: 1965752320
TotalSize: 1965751808
VolumeID: 0
VolumeLabel: "NO NAME "
VolumePtr: 536961520

The streamwriter does now his job.

Many thanks for your Support and help. When i finished the dynamic application loader for GameO i will upload it for everyone.

@ Gus - thanks, you was a little bit faster than me.
The mobile internet in the current train here in germany is not the best, so i doesn’t see your answer earlier.
I’m now very happy.