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:
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.");
}
}
}