Micro Controller HID device

HI,

Can we connect and use USB Micro Controller HID device with PIC32 to a host?
USB Micro Controller HID device works fine in windows7 but not in wince.
Kindly let us know if we have to change some settings

Dear @Sarika

Your first attempt was writing a regular stream driver (not a USB driver). This will not work to communicate with your device, even though you can communicate between your application and the driver.
You should not use Prefix=HID, this is reserved for the General HID driver, use for example Prefix=PIC instead.

Now for your questions:

  1. Your driver must provide a function HIDDeviceAttach() which is called when you connect a USB device.
  2. As stated in the beginning of my email, this was the wrong approach.
    Have a look at the USB Keyboard implementation for reference instead.
    • Driver registration in
      [HKLM\Drivers\HID\ClientDrivers\Keyboard] and [HKLM\Drivers\HID\LoadClients]
    • Driver Sources at
      D:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\HID\CLIENTS\KBDHID\
  3. That’s the correct place to look for an example
  4. The platform builder generates a .lib file in a first step. Only by doing a SYSGEN afterwards will create a .dll out of the .lib.
    I attached a sample sources file which shows how to directly generate the .dll without SYSGEN
  5. Yes, you can build the driver with Visual Studio 2005 / 2008. The driver is a regular DLL. The manual work you will need to do is collect the relevant libraries and header files from the platform builder installation and include them in your VS2005 project. The sources file I attached can help.
  6. Your custom HID driver is an add-on to the USBHID.dll.

Regards, Andy

Hi andy,

First of all thanks for the feedback given… I built the class driver with the source file u had sent and i am able to get my .dll file.

Now the problem is, when i try to connect USB mouse, USB keyboard and my pic32 controller HID together and power up the colibri vybrid board none of them works.

But USB mouse and USB keyboard works without any issues when i remove pic32 controller HID.

Do we need to change any configuration?

My Driver registration is in
[HKLM\Drivers\HID\LoadClients\Default\Default\VID_PID\MyDriver]

Kindly suggest.

Dear @Sarika

Do you have a display connected to see whether there is a dialog popping up?

WinCe loads USB devices one after the other. If it doesn’t find a driver for one device, a dialog pops up to ask for the driver location.
Until this dialog is answered (which is difficult without mouse/kbd), no other USB devices are loaded.

Your driver is probably not loaded, because your registry path is wrong. It must contain the actual Vendor ID (VID) and Product ID (PID) of your device, and the path has a different format:
[HKEY_LOCAL_MACHINE\Drivers\HID\LoadClients\<VID>_<PID>\Default\Default\MyDriver]

Have a look at the USB HID touch driver to see an example:

Regards, Andy

hello andy,

There is no dialogue pop up when the device(PIC HID COntroller) is connected.

  1. How will we know when the drivers are loaded?
  2. Will wince support USB 2.0?

And also

\3. our PIC HID microcontroller is just emulating the keyboard interrupts… but why is it not able to communicate with already existing keyboard hid driver?

My attempt started with the following steps:

  • I created a new dll project in
    C:\WINCE600\PLATFORM\COLIBRIVYBRIDBIN\SRC\DRIVERS\MyHidDrv

  • Included the dll in platform.bib and platform.reg

  • Registry settings is as follows.

    [HKEY_LOCAL_MACHINE\Drivers\Builtin\MyHidDrv]
    “Prefix”=“HID”
    “Dll”=“MyHidDrv.dll”
    “Index”=dword:1

  • I compiled and linked everything and got “MyHidDrv.dll” which will be loaded during boot up.

  • works fine wheni try to communicated with my application.

Now I reached a point where I need your help!

So my questions are:

  1. How do we get to know when HID device is connected to one of the USB ports?

  2. Is it the right thing which i ve done so far?

  3. Later stage I learned, that I have to develop my own HID driver to access our HID device
    and have to look at the sample-drivers in the platformbuilder-folder:
    C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\HID\CLIENTS

  4. when i tried to do so, was not able to get the “MyHidDrv.dll”. Do i miss some settings to get “MyHidDrv.dll”?

  5. Is it possible to write a custom HID driver without the Platform Builder,
    e.g. only with Visual Studio 2005 VC++?

  6. Is my custom HID driver an addon to the USBHID.dll or does it replace the
    USBHID.dll?

Dear @Sarika

Can you eplain in more detail, what doesn’t work.

HID devices are supported in WinCe, but HID is a very generic specification, therefore you might need additional software to make full use of the PIC32 functions.

Regards, Andy

Dear @Sarika

  1. Please see section 1. in my first answer above.
  2. Yes
  3. Because the device does not announce itself as a HID keyboard.
    Open a text editor on a PC and connect the PIC - if it is a keyboard you should see text in the editor identical as if you type it manually on any other keyboard.

Regards, Andy

HI andy,

We are able to see the keyboard interrupts when we connect the PIC to PC. But not when we connect it to toradex evaluation board.
alt text

Dear @Sarika
I cannot say whether …

  1. your PIC acts like a regular HID keyboard
    In this case no driver is required on WinCe, and you should also be able to type in the Windows CE notepad, exactly like on your Windows PC.
  2. Your Windows PC installs a special driver for your PIC to emulate a keyboard.

To track this down, could you please install a tool like the USB Device Tree Viewer on your PC, and send me the USB descriptor information of your PIC USB device as text (simply copy the right text pane within the tool and paste it here in a comment).

Regards, Andy

pfa for link textUSB descriptor information

Dear @Sarika
The USB Descriptor shows a number of errors:

  • Status : 0x01806400 (DN_HAS_PROBLEM ...
  • Error reading descriptor : ERROR_GEN_FAILURE
  • String descriptors are not available (because the device has problem code CM_PROB_NOT_CONFIGURED)

So there seems to be an issue with the implementation on your PIC device. I know Windows Desktop is very forgiving, and might use the device anyway. But I assume this initial problem causes Windows CE to refuse the device.

Regards, Andy