Author Topic: using device-winusb_lvr with Microsoft OS 2.0 Descriptors under windows 10  (Read 560 times)

EG

  • Member
  • ***
  • Posts: 5
Hi,
I was trying to port your device-winusb_lvr project to my target (STM32F7).

I see that the code is using MICROSOFT_OS_DESCRIPTOR_INDEX (0xEE) that those not support by Microsoft OS 2.0 Descriptors as far as I understand.

Is there any other device reference code that support Microsoft OS 2.0 Descriptors?

Thanks,

Eyal

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2691
    • Lakeview Research

EG

  • Member
  • ***
  • Posts: 5
I do not see any WinUSB reference there, only CDC, MSD, HID, Bootloader & Audio
Can you please point me into the MLA tree where is the code you refer to?
Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2691
    • Lakeview Research
It's in usb_device_generic but it looks like they only implemented the original OS descriptors.

Odd that MS OS 2.0 examples are hard to find. Perhaps it never caught on.

EG

  • Member
  • ***
  • Posts: 5
Actually, I have no problem to use the 1.0 but I'm not sure my host side (that is my PC windows 10) support this.

How can I check this?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2691
    • Lakeview Research
Try it. I would be surprised if it's not supported. I don't think OS 2.0 replaces the original descriptors, just supplements it with another option.

EG

  • Member
  • ***
  • Posts: 5
After digging into this I found out that even if I uninstalled the device the 0xEE did not sent, only after I change the PID\VID I was able to see it, so this is working, thanks.
Now, I can see that data is arriving from the PC to the device and back both on the control EP and the bulk one.
But, I have a problem with trying to send more then one packet to the bulk EP.
I'm using WinUSB_cs sample C# project from this site. I can see that calling the first time to NativeMethods.WinUsb_WritePipe is working fine, the data arrives to the device and I send back data that is being display on the WinUSB_cs screen, this is working for the first time, the second time I try this I can see the call is being made at WinUsb_WritePipe but does not return. I can see that my device does not receive any data at all at this stage but if I'm sending control data it is being sent and received by the device.
If I'm looking on the recorded trace of the "HHD Device monitoring Studio" I can see that the second time I send data it is looks like it is being sent, but as I said I do not see it in the device.
Only after I restart the device I can resend again a packet, but again only one.
Looks like the Bulk EP is in a bad\stuck condition on the host PC.
Any idea what is wrong here?
Thanks,
Eyal

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2691
    • Lakeview Research
What is the error message for WinUsb_WritePipe?

https://msdn.microsoft.com/en-us/library/windows/hardware/ff540322(v=vs.85).aspx

On the device side, after receiving data, be sure the endpoint is configured to accept and ACK new received data. How to do this depends on the device hardware; see the data sheet.

EG

  • Member
  • ***
  • Posts: 5
Based on your reply I was able to read and write from both EP0 and EPn! Thanks
Now, After I had a based working project on both ends (FW and PC WIN10 C#) based on your WinUsb_cs I wanted to start to develop my proprietary data flow.
But, from unclear reason or action I suddenly have a problem when I call FindMyDevice(), its look like the FW side registered OK on the PC:

Quote
Description:   WinUsb Device
Instance Status:   0180600Ah   DN_DRIVER_LOADED
      DN_STARTED
      DN_DISABLEABLE
      DN_REMOVABLE
      DN_NT_ENUMERATOR
      DN_NT_DRIVER
Instance ID:   USB\VID_26F9&PID_7555\SSSSSSSSSSSSSSSSSSS1
Hardware IDs:   USB\VID_26F9&PID_7555&REV_0200
   USB\VID_26F9&PID_7555
Compatible IDs:   USB\MS_COMP_WINUSB
   USB\Class_FF&SubClass_00&Prot_00
   USB\Class_FF&SubClass_00
   USB\Class_FF
Service Name:   WINUSB
Setup Class:   USBDevice
Setup Class Description:   Universal Serial Bus devices
Setup Class GUID:   {88bae032-5a81-49f0-bc3d-a4ff138216d6}
Software Key:   {88bae032-5a81-49f0-bc3d-a4ff138216d6}\0037
Manufacturer:   WinUsb Device
Friendly Name:   WinUSBComm Device in HS Mode
Hardware Location:   Port_#0003.Hub_#0010
PDO Name:   \Device\USBPDO-21
But the call to FindDeviceFromGuid with {88bae032-5a81-49f0-bc3d-a4ff138216d6} fail to get any devices?!
What could be wrong?
I'm pretty sure that there is no change in the code that used to work, I suspect that something on Windows registry is causing this but I have no idea where to start looking for it.
I tried to uninstall the device from USBDview and delete the registry entry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\26F975550200 but this did not helped.
Thanks,
Eyal 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2691
    • Lakeview Research
I would go back to the previously working code and make incremental changes, testing after each.

If you change the device firmware, go to Windows Device Manager and uninstall the device, then reattach. Or change the Product ID each time.