Author Topic: Windows and HID Device questions  (Read 11085 times)

jhinkle

  • Member
  • ***
  • Posts: 4
Windows and HID Device questions
« on: July 07, 2022, 08:57:44 am »
In the past, I used an FTDI device to provide a USB to controller (via a uart) to pass data back and forth.

I finally decided to understand USB and use the internal microcontroller's USB component.

After reading Jan's Second and Fifth USB editions, and others - I was left with the assumption that a HID class device (using my own defined report structures) would be easy.

Question 1:  If attempting to use a Windows provided HID driver - can the endpoint support 64 byte transfers or are they limited to 8?

I am developing on a STM32F103 device.  I have developed the device side code and it successfully enumerates.  I'm using a Beagle USB 12 tool to analyze the USB packets.

I wrote a test C++ application to communicate with the HID device but found windows failed to open the device.  Looking in "Device Manager", I found my HID device - it showed it enumerated properly but the third event stated "was not migrated due to partial or ambiguous match" - so I suspect a driver related issue.

Question 2:  I plan on having only my custom Win10 Application communicate with my device (not commercial - just a personal hobby project) - Which device class would be best/easiest to implement - HID - or a CDC (virtual com port)?

Depending on any reply to my questions above - I will ask more questions.  Thanks in advance for any reply/insight.

 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Windows and HID Device questions
« Reply #1 on: July 07, 2022, 06:33:34 pm »
Only low speed is limited to 8 byte packets.

For a custom HID you would need to use API calls or a third party tool. For CDC you can use. NET SerialPort class or similar. If the ftdi interface works for your project, nothing wrong with continuing to use it.

jhinkle

  • Member
  • ***
  • Posts: 4
Re: Windows and HID Device questions
« Reply #2 on: July 07, 2022, 07:46:29 pm »
Thanks Jan.  All the microcontrollers I use have a USB cell onboard but I have never used it.  The FTDI prices are going up and availability going down.  Just from a knowledge base, I want to get a total USB communication going and understand the complete implementation.  I spent today converting the USB device from HID to CDC.  I just need to test enumeration and host communication. 

I a very old fart and have never cared for C#.  All my embedded work is in assembler and C with the PC tools developed in C++.

Thanks for your reply.

bpaddock

  • Frequent Contributor
  • ****
  • Posts: 66
Re: Windows and HID Device questions
« Reply #3 on: July 08, 2022, 08:16:20 am »
If you've not already found it HDIPAI from the libusb project will be helpful for you, for the PC end.

https://github.com/libusb/hidapi