Main Site Documentation

Panda II - Cannot access USB memory stick


#1

Hi,
I have set up the panda (with ultimate kit) with a virtual USB, which I use for debugging. The serial USB works fine but I can not access a USB memory stick when connected to the Panda’s board USB port. (Firmware is uptodate)

I have tried various codes found on the TinyCLR, examples below, and I am don’t know what else to try. I am open to suggestions.

Thanks,
Michal

Code examples/source:
http://wiki.tinyclr.com/index.php?title=USB_Client
http://wiki.tinyclr.com/index.php?title=USB_Host


using System;
using System.IO;
using System.Threading;

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

using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.USBHost;

namespace Test
{
    class Program
    {
        // Hold a static reference in case the GC kicks in and disposes it automatically, note that we only support one in this example!
        static PersistentStorage ps;

        public static void Main()
        {
            // Subscribe to RemovableMedia events
            RemovableMedia.Insert += RemovableMedia_Insert;
            RemovableMedia.Eject += RemovableMedia_Eject;

            // Subscribe to USB events
            USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;

            // Sleep forever
            Thread.Sleep(Timeout.Infinite);
        }

        static void DeviceConnectedEvent(USBH_Device device)
        {
            if (device.TYPE == USBH_DeviceType.MassStorage)
            {
                Debug.Print("USB Mass Storage detected...");
                ps = new PersistentStorage(device);
                ps.MountFileSystem();
            }
        }

        static void RemovableMedia_Insert(object sender, MediaEventArgs e)
        {
            Debug.Print("Storage \"" + e.Volume.RootDirectory + "\" is inserted.");
            Debug.Print("Getting files and folders:");
            if (e.Volume.IsFormatted)
            {
                string[] files = Directory.GetFiles(e.Volume.RootDirectory);
                string[] folders = Directory.GetDirectories(e.Volume.RootDirectory);

                Debug.Print("Files available on " + e.Volume.RootDirectory + ":");
                for (int i = 0; i < files.Length; i++)
                    Debug.Print(files[i]);

                Debug.Print("Folders available on " + e.Volume.RootDirectory + ":");
                for (int i = 0; i < folders.Length; i++)
                    Debug.Print(folders[i]);
            }
            else
            {
                Debug.Print("Storage is not formatted. Format on PC with FAT32/FAT16 first.");
            }
        }

        static void RemovableMedia_Eject(object sender, MediaEventArgs e)
        {
            Debug.Print("Storage \"" + e.Volume.RootDirectory + "\" is ejected.");
        }
    }
}


#2

This should help http://ghielectronics.blogspot.com/2011/03/usb-host-support-is-added-on-fez-panda.html


#3

So it requires 2 hardware changes. I will try to modify the cable first, before touching the board.

Thanks,
Michal


#4

Thanks it works perfectly.
Hacked the USB cable, and mounted it on a bread board as shown on the attached picture.