Main Site Documentation

Panda 2 : UsbHost - help please


#1

Hi,
I Just tried adding the USBHost code from wiki to my program as I wanted to try out using a USB keyboard. In my program I have a serial display connected to COM2 which worked fine before I added the USB stuff. The code I added was


public static void Main()
{
      USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;
      USBHostController.DeviceDisconnectedEvent += DeviceDisconnectedEvent
      ...
}
 static void DeviceConnectedEvent(USBH_Device device)
 {
       Debug.Print("Device connected...");
       Debug.Print("ID: " + device.ID + ", Interface: " +
                        device.INTERFACE_INDEX + ", Type: " + device.TYPE);        
}

static void DeviceDisconnectedEvent(USBH_Device device)
{
      Debug.Print("Device disconnected...");
      Debug.Print("ID: " + device.ID + ", Interface: " +
                     device.INTERFACE_INDEX + ", Type: " + device.TYPE);
}


;

Now when I try and deploy my code I get an error message

An unhandled exception of type ‘System.InvalidOperationException’ occurred in GHIElectronics.NETMF.USBHost.dll

and the message “ERROR starting up” is displayed on my serial display. I don’t know what is happening. Do I have to get and run the driver for a virtual com channel? I assumed that because I was using COM2 connected to the panda I wouldnt need to.

Thanks for any help

Alan


#2

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