8 Replies Latest reply on Dec 8, 2016 4:23 PM by content.librarian

    Looking for FX3 descriptors that work with WinUSB




      We are looking to use our FX3 device through Windows' built-in WinUSB driver. 


      We currently have the FX3 up and running as a "Cypress USB StreamerExample" device with 4 endpoints.


      Is there any FX3 firmware example available of how I would need to change the descriptors to get it to identify with WinUSB?


      Would all these changes be limited to the descriptor file "cyfxslfifousbdscr.c"?


      If at all possible, we would like a WinUSB solution that works across Windows XP, 7, 8 and 10.


      Kind regards,



        • 1. Re: Looking for FX3 descriptors that work with WinUSB



          You need to add the Microsoft OS String descriptor, Extended Compat ID Descritptor and Extended Properties Descriptor. Ref: https://msdn.microsoft.com/en-in/library/windows/hardware/ff537430(v=vs.85).aspx




          -Madhu Sudhan

          • 2. Re: Looking for FX3 descriptors that work with WinUSB

            After a lot of debugging, we finally got the FX3 to work with WinUsb on both Windows 7 and 8. I listed our code additions below. Hope this helps someone!


            - cyfxslfifosync.h:



            /* attempt at WinUSB support */ extern const uint8_t CyFxUsbOSDscr[]; extern const uint8_t CyFxUsbExtCompatIdOSFeatureDscr[]; extern const uint8_t CyFxUsbExtPropertiesOSFeatureDscr[];



            - cyfxslfifousbdscr.c:



            /* OS descriptor as per WinUSB requirement */ const uint8_t CyFxUsbOSDscr[] __attribute__ ((aligned (32))) = {     0x12,                           /* bLength: Length of the descriptor */     CY_U3P_USB_STRING_DESCR,        /* bDescriptorType: Descriptor type */     'M',0x00,                        /* qwSignature: Signature field */     'S',0x00,     'F',0x00,     'T',0x00,     '1',0x00,     '0',0x00,     '0',0x00,     0x00,                           /* bMS_VendorCode: Vendor code */     0x00                            /* bPad: Pad field */ };  /* Extended Compat ID OS Feature Descriptor as per WinUSB requirement */ const uint8_t CyFxUsbExtCompatIdOSFeatureDscr[] __attribute__ ((aligned (32))) = {     // Header Section     0x28,0x00,0x00,0x00,                     /* dwLength: 40 = 16 + 24 */     0x00,0x01,                               /* bcdVersion: The descriptor’s version number */     0x04,0x00,                                 /* wIndex: Extended compat ID descriptor */     0x01,                                    /* bCount: Number of function sections */     0x00,0x00,0x00,0x00,0x00,0x00,0x00,      /* RESERVED */     // Function Sections     0x00,                                    /* bFirstInterfaceNumber */     0x01,                                    /* RESERVED */     'W','I','N','U','S','B',0x00,0x00,       /* compatibleID */     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* subCompatibleID */     0x00,0x00,0x00,0x00,0x00,0x00            /* RESERVED */ };  /* Extended Properties OS Feature Descriptor as per WinUSB (USB 3.0) requirement */ const uint8_t CyFxUsbExtPropertiesOSFeatureDscr[] __attribute__ ((aligned (32))) = {     // Header Section     0x8E,0x00,0x00,0x00,                     /* dwLength: 142 = 10 + 132 */     0x00,0x01,                               /* bcdVersion: The descriptor’s version number */     0x05,0x00,                                 /* wIndex: Extended property OS descriptor */     0x01,0x00,                               /* bCount: Number of properties */     // Custom Property Section 1     0x84,0x00,0x00,0x00,                     /* dwSize: 132 = 14 + 40 + 78 */     0x01,0x00,0x00,0x00,                     /* dwPropertyDataType: A NULL-terminated Unicode String (REG_SZ) */     0x28,0x00,                               /* wPropertyNameLength: 40 */                                              /* bPropertyName: "DeviceInterfaceGUID" */     'D',0x00,'e',0x00,'v',0x00,'i',0x00,'c',0x00,'e',0x00,     'I',0x00,'n',0x00,'t',0x00,'e',0x00,'r',0x00,'f',0x00,'a',0x00,'c',0x00,'e',0x00,     'G',0x00,'U',0x00,'I',0x00,'D',0x00,     0x00,0x00,     0x4E,0x00,0x00,0x00,                     /* dwPropertyDataLength: 78 */                                              /* bPropertyData: "{01234567-2A4F-49EE-8DD3-FADEA377234A}" */     '{',0x00,     '0',0x00,'1',0x00,'2',0x00,'3',0x00,'4',0x00,'5',0x00,'6',0x00,'7',0x00,'-',0x00,     '2',0x00,'A',0x00,'4',0x00,'F',0x00,'-',0x00,     '4',0x00,'9',0x00,'E',0x00,'E',0x00,'-',0x00,     '8',0x00,'D',0x00,'D',0x00,'3',0x00,'-',0x00,     'F',0x00,'A',0x00,'D',0x00,'E',0x00,'A',0x00,'3',0x00,'7',0x00,'7',0x00,'2',0x00,'3',0x00,'4',0x00,'A',0x00,     '}',0x00,     0x00,0x00 };



            - cyfxslfifosync.c, inside CyFxSlFifoApplnUSBSetupCB function:


            1) Add variable for wLength amidst other variables:



                uint8_t  bRequest, bReqType;     uint8_t  bType, bTarget;     uint16_t wValue, wIndex, wLength;     CyBool_t isHandled = CyFalse;      /* Decode the fields from the setup request. */     bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);     bType    = (bReqType & CY_U3P_USB_TYPE_MASK);     bTarget  = (bReqType & CY_U3P_USB_TARGET_MASK);     bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);     wValue   = ((setupdat0 & CY_U3P_USB_VALUE_MASK)   >> CY_U3P_USB_VALUE_POS);     wIndex   = ((setupdat1 & CY_U3P_USB_INDEX_MASK)   >> CY_U3P_USB_INDEX_POS);     wLength  = ((setupdat1 & CY_U3P_USB_LENGTH_MASK)  >> CY_U3P_USB_LENGTH_POS);



            2) Add below the "if (bType == CY_U3P_USB_STANDARD_RQT) {}" section:



                else if ((bReqType == 0xC0) && (wIndex == 0x04)) {         /* Handle OS Feature Compatible IDs descriptor request. */          /* Make sure we do not send more data than requested. */         if (wLength > CyFxUsbExtCompatIdOSFeatureDscr[0])             wLength = CyFxUsbExtCompatIdOSFeatureDscr[0];          CyU3PUsbSendEP0Data (wLength, (uint8_t *)CyFxUsbExtCompatIdOSFeatureDscr);         isHandled = CyTrue;     }     //else if ((bReqType == 0xC1) && (wIndex == 0x05)) {     // attempted fix: some USB drivers incorrectly use bReqType 0xC0 to get OS Feature Extended Properties     //else if (((bReqType | 0x01) == 0xC1) && (wIndex == 0x05)) {     else if (wIndex == 0x05) {         /* Handle OS Feature Extended Properties descriptor request. */          /* Make sure we do not send more data than requested. */         if (wLength > CyFxUsbExtPropertiesOSFeatureDscr[0])             wLength = CyFxUsbExtPropertiesOSFeatureDscr[0];          CyU3PUsbSendEP0Data (wLength, (uint8_t *)CyFxUsbExtPropertiesOSFeatureDscr);         isHandled = CyTrue;      }



            Edit: so much the formatting... it looked better in the editor. 

            • 3. Re: Looking for FX3 descriptors that work with WinUSB



              Excellent work. Thank you so much.


              However, isn't there something missing? (when I tried this with my design that previously used the Cypress driver, it still loads the Cypress driver).
              The MS document that was pointed to above, was referring to a required string at index 0xEE, and I was wondering where that comes into play.
              Shouldn't there maybe be some calls in CyFxSlFifoApplnInit() function to 


              CyU3PUsbSetDesc(CY_U3P_USB_SET_FS_CONFIG_DESCR, 0, (uint8_t *) ...);






              CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 0xEE (I presume?), (uint8_t *) ...);


              Can you provide the code for that as well?


              Also, your formatting is just fine (if you copy, and paste your code above in a decent editor, it retains the tabs! ;-) )

              Kind regards,


              ~ Paul




              Update 1:


              I actually added these calls:


                  /* Extended Compat ID OS Feature Descriptor */
                  apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_SS_BOS_DESCR, 1, (uint8_t *)CyFxUsbExtCompatIdOSFeatureDscr);


                  /* Extended Properties OS Feature Descriptor as per WinUSB (USB 3.0) requirement */
                  apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_SS_BOS_DESCR, 2, (uint8_t *)CyFxUsbExtPropertiesOSFeatureDscr);


                  apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 0xEE, (uint8_t *)CyFxUsbOSDscr);




              but I get an error when adding that last string descriptor at index 0xEE: It gives me a CY_U3P_ERROR_BAD_INDEX error.


              Do I need to pad dummy strings to get to index 0xEE?


              Any ideas?

              • 4. Re: Looking for FX3 descriptors that work with WinUSB



                Information about USB device, Enumeration behavior and Registry variables can be found https://msdn.microsoft.com/en-us/library/windows/hardware/jj649944(v=vs.85).aspx


                I am faced with the following reported issue : http://www.microchip.com/forums/m802958.aspx


                Concerning the string 0xEE(238), you can handle the string descriptor request yourself in the USBSetupCB USB Setup Callback function. Look at the USB specification.


                I use the following tools to reset the Windows registry : Device Cleanup Tool and USBOblivion. I am able to test all the enumeration process and validate that with the USB3.0/2.0 Analyzer.

                • 5. Re: Looking for FX3 descriptors that work with WinUSB



                  I faced an issue regarding Renesas XHCI USB 3.0 Host Controller. Some versions of the driver cause the USB Extended Property OS Feature Descriptor to be missing.


                  System information : 

                  • Renesas Electronics USB 3.0 Host Controller :     
                    • Firmware Version : 4015
                    • PCIe Card : PCI\VEN_1033&DEV_0194&REV_04  PCI\VEN_1033&DEV_0194&SUBSYS_00000000&REV_04
                  • Driver Tested :     
                    • : Ext Prop OK
                    • : Ext Prop OK
                    • : Ext Prop Missing
                    • : Ext Prop Missing

                  It is quite annoying. The workaround is to connect the device to a USB 2.0 EHCI controller so the Ext Prop can be retrieved.
                  I hope there is not too much other issue like this. Implementing specification is hard enough without having to deal with a challenging environment equipment.

                  • 6. Re: Looking for FX3 descriptors that work with WinUSB

                    @Paul Claessen: The 0xEE ("Miscrosoft OS String") descriptor is handled in our "if (bType == CY_U3P_USB_STANDARD_RQT)" section, see below.


                    Since my previous post we also solved support for Win10 (and 8.1) by also adding MS OS 2.0 descriptors to our FX3, so I guess it's time to repost our solution:


                    Edit: code paste prevented by forum spam filter.. :(

                    • 7. Re: Looking for FX3 descriptors that work with WinUSB

                      Hi sbertrand,

                      Back when I was working on our issue, I read that some controller drivers use incorrect requests to get descriptors: e.g. wrong bType, bTarget, bRequest. If you have an USB analyzer, you can find out the details of your controller's descriptor requests. With this knowledge you can adapt your descriptor handling in the FX3, so it responds to this (incorrect) request with the expected descriptor, compensating for the controller bug?

                      • 8. Re: Looking for FX3 descriptors that work with WinUSB

                        Hi Daniel,


                        I looked at my analyzer recording but there is no request at all. The request for the Ext Prop are not happening with the recent driver.


                        With the analyzer, I did compensate for the request of the Ext Prop happening as a Device Request instead of a Interface Request.


                        The recent drivers are just not suitable. My card firmware may be old or not matching the driver.

                        • 9. Re: Looking for FX3 descriptors that work with WinUSB

                          I am facing a new issue regarding MSFT Extended Property OS Feature Descriptor and Renesas XHCI Host controller.
                          Unicode String Ext Prop are able to be reported correctly. I am defining DWORD Ext Prop for suspend idle configuration (DefaultIdleState, DefaultIdleTimeout, DeviceIdleEnabled, DeviceIdleIgnoreWakeEnable).


                          On Intel USB Host controllers ( EHCI and XHCI ), the registry values are correct and suspend/resume testing occurs correctly. However when the device is fully enumerated by the Renesas XHCI Host controller, the DWORD Ext Prop are reported to the system as unicode strings. My value of 500 ms of DefaultIdleTimeout shows up as "DefaultIdleTimeout"="Ǵ". "Ǵ" is 00 F4 01 or 500 in decimal.


                          Renesas Electronics USB 3.0 Host Controller Driver version