Main Site Documentation

Usbhost


#1

i copied your sample from the ebook chapter 20 to detect usb devices. It works perfect when i start debug. IIt can detect a mouse and a USB thumb drive. The next prog for HID compiles without errors “Compile complete – 0 errors, 0 warnings” but does nothing when i start debug altough it is deployed to the board.
Output of Debug:
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Programme\Microsoft .NET Micro Framework\v4.0\Assemblies\mscorlib.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Programme\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.Native.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded 'C:\Programme\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.Hardware.dll’
The program ‘[11] Micro Framework application: Managed’ has exited with code 0 (0x0).

What am i doing wrong?


#2

There are multiple examples there. Which one you are talking about? Probably stepping in code or some breakpoint will give you more info.


#3

I am talking about the HID Mouse sample in your Beginners guide to C# and .NET Micro Framework.
I must say that i have changed to your Software Development Kit (SDK) dated Apr.26,2010. I have also updated the firmware. In the meantime i get a very unpleasent error message that says:
Error 1 An error has occurred: please check your hardware.
when i press F5 to start debug. Is there any problem whit the firmware update?


#4

No errors. This is very common error. When you update the SDK and firmware, your project still uses the old libraries from last SDK. All you need to do is remove all assemblies from your project then add them back…all will work again


#5

We added this post that details this to make it more clear.
http://www.tinyclr.com/forum/1/154/


#6

Okay. I did all that you proposed and now i am having this message in the USB Mass Storage sample from the Beginners Ebook.

Error 1 The type or namespace name ‘USBH_Device’ could not be found (are you missing a using directive or an assembly reference?)

This is in my using clauses:
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.USBHost;

And this is the line where the error occurs:
static void DeviceConnectedEvent(USBH_Device device)


#7

This missing object is in GHIElectronics.NETMF.System
Add it and you will be good to go.

Please see the FAQ "What assemblies (libraries) do I need to add to my project?"


#8

Okay. I did want you suggested. I include all the assemblies proposed in the FAQ.
GHIElectronics.NETMF.Hardware
GHIElectronics.NETMF.IO
GHIElectronics.NETMF.System
Microsoft.SPOT.Hardware
Microsoft.SPOT.Native
Microsoft.SPOT.Hardware.SeriaPort
Microsoft.SPOT.IO
mscorlib
System
System.IO
and
FEZDomino_GHIElectronics.NETMF.FEZ.
GHIElectronics.NETMF.USBHost;

Now it is hanging here:
if (device.TYPE == USBH_DeviceType.MassStorage)
{
Debug.Print(“USB Mass Storage detected…”);
ps = new PersistentStorage(device.ID, device.INTERFACE_INDEX);
ps.MountFileSystem();
}
with these Error Messages:
Error 1 The best overloaded method match for ‘GHIElectronics.NETMF.IO.PersistentStorage.PersistentStorage(GHIElectronics.NETMF.USBHost.USBH_Device, byte)’ has some invalid arguments
Error 2 Argument ‘1’: cannot convert from ‘uint’ to ‘GHIElectronics.NETMF.USBHost.USBH_Device’

This is a sample from the new Beginners Ebook.
What the hell am i doing wrong?:frowning:


#9

This is not the mouse example! Did that work as expected? Joystick too?

You are using an old copy of the book. Get the new one please
http://www.tinyclr.com/dl/

This changed…
// was like this
new PersistentStorage(device.ID, device.INTERFACE_INDEX);
// change to
new PersistentStorage(device);

We made it easier. Note that what we have now is the final firmware so no worries about changes in future.

Let us know if you have any other issues, we are always here to help .