Main Site Documentation

Access SD card through USB


#1

Hello,

We have build an system in which we need to access the SD-card through the USB-port. This would be the USB-port we use to program the ChipworkX Dev. System. I this possible?

Kind Regards.


#2

Yes, it is possible.

Look for USBC_MassStorage:

http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/607ac9a8-62a0-ad43-cd1c-3034863c1b46.htm


#3

Hi,

Thank you for you’re answer. But if I wanna use this, I need to change the debug interface. Can I change this to the ethernet connector? and how?


#4

Look here:

http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/034453e8-7ce5-92a4-501e-8fdf8822dbda.htm


#5

Thank you Architect for helping Nick.
I would like to add that this is one of the exclusive features you get when using GHI (.NET FEZ) products.


#6

Hi,

I was not done yet. Thank you for you’re quick response! I still have a little problem. I have the following code:


public static void Main()
        {
            //NI.EnableStaticIP("192.168.1.99", "255.255.255.0", "192.168.1.1");

            if (Configuration.DebugInterface.GetCurrent() != Configuration.DebugInterface.Port.USB1)
                Configuration.DebugInterface.Set(Configuration.DebugInterface.Port.Sockets1, Configuration.DebugInterface.Port.USB1);

            USBC_MassStorage MS = USBClientController.StandardDevices.StartMassStorage();
            PersistentStorage PS = new PersistentStorage("SD");

            // Attach SD-Card to USB Mass Storage
            MS.AttachLun(0, PS, " ", " ");

            // Enable SD-Card for host PC
            MS.EnableLun(0);

            // Mount the file system
            PS.MountFileSystem();

            while (true)
            {
                Debug.Print("Het werkt");
                Thread.Sleep(1000);
            }

            
        } 

This code almost works. The compiler gives me an error when I want to mount the filesystem. Also when I reset my ChipworkX Dev. System it starts in Tinybooter mode, but I need the other mode.

Kind Regards.


#7

You can’t have it mounted and enabled as mass storage at the same time.


#8

OK… Thank you for the information


#9

Are you getting an error or a run-time exception?

I suggest that you erase the flash and update the firmware.