Author Topic: custom stm-based HID/CDC-VCOM work on Win10 not on Win7  (Read 566 times)

anotherstevest

  • Member
  • ***
  • Posts: 8
custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« on: March 01, 2019, 07:51:10 pm »
Greetings,

I've got an stm32l4 based device that has a USB stack based on modified stcube code.  I've had it running with HID on Win7/10 and CDC VCOM on Win7/10 (on win7 it needs an .inf but not on Win10).  However, when I created an HID & CDC-VCOM device it works fine on Win10 but on Win7 it only pretends to work.  By pretend, I mean it likes the modified .inf (based on the previous CDC VCOM .inf) and it enumerates without errors.  Both the HID and VCOM device show up as expected.  Everything I know how to look at in device manager looks fine *but* it doesn't actual pass data correctly.

I've looked at bus transactions with a Beagle and assorted debug logs and, best I can tell, from the device side perspective,  after enumerations it sends application level data to the host (which I see on the bus) and the responses it gets (I do see responding OUT transactions) are either wrong or late (I don't own the sending/receiving code on either end so it's a little opaque here...).  Same code on both side on the Win10 machines run fine.

I'm pretty .inf and Win10 vs Win7 ignorant but I'm guessing my screw up in in there somewhere.  I'll be doing more studying of the Bible this weekend (like reading the .inf pages etc.).  If anyone can provide suggestions, they will be gratefully appreciated!

Thanks,
Steve.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2844
    • Lakeview Research
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #1 on: March 03, 2019, 09:07:53 am »
I would check:

Device Manager: be sure the same drivers are assigned in both cases.

Traffic: look for any differences in the data the device sends to the host.

Also look for any differences in assigned drivers, etc. in the setupapilog files:

https://technet.microsoft.com/en-us/ff550863(v=vs.96)

anotherstevest

  • Member
  • ***
  • Posts: 8
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #2 on: March 05, 2019, 03:17:44 pm »
Thanks for the suggestions (which I've followed).  In summary - no smoking gun found yet.  I've confirmed with device manager and the logs that the same drivers are being loaded in both the Win7 CDC-Vcom only case and the Win7 HID/CDC-Vcom case.  The logs did not show any issues or abnormalities (best I can tell).

When I look at the bus transactions they start out the same.  When the host application attempts to connect to the device, I see a corresponding OUT transaction and a responding IN transaction.  However, in the HID/VCOM case this IN transaction is delayed by more than a second (which is not the case with the CDC only case).  The device *appears* to timeout (sadly, the application code on both the host and device is more-or-less opaque and is owned by another company), and it responds by retrying (and, seemingly, ignoring the late response).  It never recovers.

So, other than the unacceptably large response delay by the Win7 Host (when the HID/CDC-vcom device config is used) it *appears* the Win7 host is responding correctly...  but too slowly to do me any good.

Thanks in advance for any additional ideas you have.

Steve.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2844
    • Lakeview Research
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #3 on: March 06, 2019, 11:07:26 am »
Can you post your inf file?

anotherstevest

  • Member
  • ***
  • Posts: 8
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #4 on: March 06, 2019, 12:08:45 pm »
I've attached the .inf.  I appreciate your help.


Steve.


anotherstevest

  • Member
  • ***
  • Posts: 8
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #5 on: March 06, 2019, 05:50:33 pm »
Here's another clue...  Looking closely at the bus transactions as captured by the Beagle - The device responds within about 20 ms to the (presumed) connect request from the host.  However, looking at the serial port stream (using freeserialanalyzer's com analyzer) the host doesn't see the reply for about 2 seconds...  Very strange...

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2844
    • Lakeview Research
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #6 on: March 07, 2019, 09:28:25 pm »
Re-reading what you've posted:

All of these work?

HID on Win7
HID on Win10
CDC on Win7 with INF
CDC on Win10
HID + CDC on Win10

This doesn't work?

HID + CDC on Win7


As for the INF, see "FakeModemCopyFileSection":

https://support.microsoft.com/en-us/help/837637/how-to-use-or-to-reference-the-usbser-sys-driver-from-universal-serial

Example INF:

https://community.cypress.com/thread/32283?start=0&tstart=0

But since the INF works with CDC only, perhaps the problem is with the descriptors, since those were changed when you placed both functions in one device. Can you post those?

anotherstevest

  • Member
  • ***
  • Posts: 8
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #7 on: March 11, 2019, 03:20:11 pm »
re HID on Win7, HID on Win10: We don't have an HID only configuration.  However we do have an HID + WinUSB configuration (which was the starting point for the HID + CDC-Vcom configuration).  HID + WinUSB works on both Win7 and Win10.

And, as you stated, HID + CDC-VCom does not work on Win7.

As soon as I post this, I'll read and ponder the microsoft "how-to-use..." page you referenced. 

Here are the descriptors as interpreted by the Beagle:


 Device Descriptor           Radix: 
bLength   18
bDescriptorType   DEVICE (0x01)
bcdUSB   2.01 (0x0201)
bDeviceClass   Miscellaneous (0xef)
bDeviceSubClass   Common (0x02)
bDeviceProtocol   Interface Association Descriptor (0x01)
bMaxPacketSize0   64
idVendor   0x05a7
idProduct   0x40fc
bcdDevice   2.00 (0x0200)
iManufacturer   Not Requested (1)
iProduct   bmap over HID - simulink over com (2)
iSerialNumber   123456789ABCD (3)
bNumConfigurations   1

  Configuration Descriptor           Radix: 
bLength   9
bDescriptorType   CONFIGURATION (0x02)
wTotalLength   107
bNumInterfaces   3
bConfigurationValue   1
iConfiguration   None (0)
bmAttributes.Reserved   0
bmAttributes.RemoteWakeup   RemoteWakeup Not Supported (0b0)
bmAttributes.SelfPowered   Self Powered (0b1)
bMaxPower   100mA (0x32)

 Interface Descriptor           Radix: 
bLength   9
bDescriptorType   INTERFACE (0x04)
bInterfaceNumber   0
bAlternateSetting   0
bNumEndpoints   2
bInterfaceClass   Human Interface Device (0x03)
bInterfaceSubClass   None (0x00)
bInterfaceProtocol   None (0x00)
iInterface   None (0)

 HID Descriptor           Radix: 
bLength   9
bDescriptorType   HID (33)
bcdHID   1.11 (0x0111)
bCountryCode   0x00
bNumDescriptors   1
bDescriptorType   REPORT (34)
wDescriptorLength   38

  Endpoint Descriptor           Radix: 
bLength   7
bDescriptorType   ENDPOINT (0x05)
bEndpointAddress   1 OUT (0b00000001)
bmAttributes.TransferType   Interrupt (0b11)
wMaxPacketSize.PacketSize   64
wMaxPacketSize.Transactions   One transaction per microframe if HS (0b00)
bInterval   1

  Endpoint Descriptor           Radix: 
bLength   7
bDescriptorType   ENDPOINT (0x05)
bEndpointAddress   1 IN (0b10000001)
bmAttributes.TransferType   Interrupt (0b11)
wMaxPacketSize.PacketSize   64
wMaxPacketSize.Transactions   One transaction per microframe if HS (0b00)
bInterval   1

 Interface Association Descriptor           Radix: 
bLength   8
bDescriptorType   INTERFACE_ASSOCIATION (0x0b)
bFirstInterface   1
bInterfaceCount   2
bFunctionClass   Communications and CDC Control (0x02)
bFunctionSubClass   Abstract Control Model (0x02)
bFunctionProtocol   AT Commands: V.250 etc (0x01)
iFunction   None (0)

 Interface Descriptor           Radix: 
bLength   9
bDescriptorType   INTERFACE (0x04)
bInterfaceNumber   1
bAlternateSetting   0
bNumEndpoints   1
bInterfaceClass   Communications and CDC Control (0x02)
bInterfaceSubClass   Abstract Control Model (0x02)
bInterfaceProtocol   AT Commands: V.250 etc (0x01)
iInterface   None (0)

 Class-Specific Descriptor Header Format           Radix: 
bFunctionLength   5
bDescriptorType   CS_INTERFACE (0x24)
bDescriptorSubtype   Header Functional Descriptor (0x00)
bcdCDC   1.10 (0x0110)

  Call Management Functional Descriptor           Radix: 
bFunctionLength   5
bDescriptorType   CS_INTERFACE (0x24)
bDescriptorSubtype   Call Management Functional Descriptor (0x01)
bmCapabilities.CallManagement   Does not handle call management (0b0)
bmCapabilities.DataClass   Call Management over Comm Class interface (0b0)
bDataInterface   1

  Abtract Control Management Functional Descriptor           Radix: 
bFunctionLength   4
bDescriptorType   CS_INTERFACE (0x24)
bDescriptorSubtype   Abstract Control Management (0x02)
bmCapabilities.CommFeature   Unsupported (0b0)
bmCapabilities.LineStateCoding   Supported (0b1)
bmCapabilities.SendBreak   Unsupported (0b0)
bmCapabilities.NetworkConnection   Unsupported (0b0)

 Union Interface Functional Descriptor           Radix: 
bFunctionLength   5
bDescriptorType   CS_INTERFACE (0x24)
bDescriptorSubtype   Union Functional Descriptor (0x06)
bControlInterface   1
bSubordinateInterface0   2

  Endpoint Descriptor           Radix: 
bLength   7
bDescriptorType   ENDPOINT (0x05)
bEndpointAddress   3 IN (0b10000011)
bmAttributes.TransferType   Interrupt (0b11)
wMaxPacketSize.PacketSize   8
wMaxPacketSize.Transactions   One transaction per microframe if HS (0b00)
bInterval   16

 Interface Descriptor           Radix: 
bLength   9
bDescriptorType   INTERFACE (0x04)
bInterfaceNumber   2
bAlternateSetting   0
bNumEndpoints   2
bInterfaceClass   CDC Data (0x0a)
bInterfaceSubClass   Unknown (0x00)
bInterfaceProtocol   No class specific protocol required (0x00)
iInterface   None (0)

  Endpoint Descriptor           Radix: 
bLength   7
bDescriptorType   ENDPOINT (0x05)
bEndpointAddress   2 OUT (0b00000010)
bmAttributes.TransferType   Bulk (0b10)
wMaxPacketSize.PacketSize   64
bInterval   0

  Endpoint Descriptor           Radix: 
bLength   7
bDescriptorType   ENDPOINT (0x05)
bEndpointAddress   2 IN (0b10000010)
bmAttributes.TransferType   Bulk (0b10)
wMaxPacketSize.PacketSize   64
bInterval   0

 Report Descriptor           Radix: 
Usage Page   Vendor-defined (0xff00)
Usage   Undefined (0x01)
Collection   Application (0x01)
  Report ID   12
  Logical Minimum   -128
  Logical Maximum   127
  Usage   Undefined (0x02)
  Report Size   8
  Report Count   1022
  Output   Data (0x02)
  Report ID   13
  Logical Minimum   -128
  Logical Maximum   127
  Usage   Undefined (0x02)
  Report Size   8
  Report Count   259
  Input   Data (0x02)
End Collection   

Steve.

anotherstevest

  • Member
  • ***
  • Posts: 8
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #8 on: March 13, 2019, 04:27:10 pm »
Your links to the recommended (by Microsoft) .inf approach, and, even more helpfully to me, the example .inf, appears to have done the trick.  My mangled version of the example .inf resulted in the elimination of my composite device problems.

Many thanks!

I'm re-reading Chapter 9 in the hopes I might actually learn something related to the Windows side of all of this...

Best regards,
Steve.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2844
    • Lakeview Research
Re: custom stm-based HID/CDC-VCOM work on Win10 not on Win7
« Reply #9 on: March 13, 2019, 05:02:36 pm »
Excellent! Thanks for reporting back.