Main Site Documentation



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?


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


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?


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


We added this post that details this to make it more clear.


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)


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?"


Okay. I did want you suggested. I include all the assemblies proposed in the FAQ.

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);
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:


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

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 .