12 Replies Latest reply on May 13, 2019 4:10 AM by KandlaguntaR_36

    How to configure FX3 USB device with multiple interfaces/functions?

    IzMa_4105896

      Hello,

       

      I need to implement two functions on one USB device:

      1. USB-UART bridge (i.e. FX3 SDK cyfxusbuart example)
      2. synchronous slave FIFO protocol over GPIF II (i.e. FX3 SDK slfifosync example)

       

      Both these functions must be active at the same time.  For example the device must be able to send commands over the USB-UART bridge while receiving/sending through the FIFO.   

       

      What would the USB descriptors look like for this?   Is there a good online or textbook resource that would help get me going?  I could not find an SDK example with this kind of configuration.

       

      Thank you,

      Iztok

        • 1. Re: How to configure FX3 USB device with multiple interfaces/functions?
          KandlaguntaR_36

          We have an example project for CDC interface in the SDK. You may refer it and follow the below steps to integrate Slavefifo and CDC.

           

          1. Modify the usbdescriptor file of slavefifo project to add the CDC interface descriptors

          2. Handle CDC class requests in CyCx3AppUSBSetupCB() API.

          3. Create an Auto DMA channel from USB Out EP->UART Consumer and a Manual DMA channel from UART Producer-> USB In EP

          4. Comment out CyU3PUartTxSetBlockXfer() and CyU3PDebugInit() APIs

           

          Refer USBUart example provided in the SDK: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxusbuart

          • 2. Re: How to configure FX3 USB device with multiple interfaces/functions?
            IzMa_4105896

            Here is what I did:

            1. I started with slightly modified usbuart and slavefifo examples.   I had tests for both and the tests passed.
            2. I then added the slavefifo code to the app init and USB setup callbacks.  I confirmed that the tests I had against usbuart FW still passed after these changes.
            3. I then modified the USB descriptors by
              1. Appending the slavefifo interface to the config descriptors
              2. Modifying wTotalLength of the config descriptors to include the slavefifo interfaces
              3. Modifying bNumInterfaces from 2 to 3 in the config descriptors to include the slavefifo interfaces

             

            After modifying the descriptors the device fails enumeration with CM_PROB_FAILED_POST_START error.   

            The device manager says:

            Windows has stopped this device because it has reported problems. (Code 43)

             

            The USB device returned an invalid USB configuration descriptor.

             

            It seems my configuration descriptor has a problem but I can’t figure out what is wrong.

             

            Below is what USB device viewer has to say after the enumeration fails.  I’ve also included the descriptors file as well as dumps of the descriptors from USB device viewer and Thesyscon descriptor dumper after both a successful enumeration (usbuart only) and after a failed enumeration (usbuart and slavefifo).

             

            What did I do wrong?

            Iztok

                =========================== USB Port16 ===========================

             

            Connection Status        : 0x02 (Device failed enumeration)

            Port Chain               : 2-16

            Properties               : 0x03

            IsUserConnectable       : yes

            PortIsDebugCapable      : yes

            PortHasMultiCompanions  : no

            PortConnectorIsTypeC    : no

            ConnectionIndex          : 16

            CompanionIndex           : 0

            CompanionHubSymLnk      : USB#ROOT_HUB30#4&121546c5&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}

            CompanionPortNumber     : 5

             

                  ======================== USB Device ========================

             

                    +++++++++++++++++ Device Information ++++++++++++++++++

            Device Description       : Unknown USB Device (Invalid Configuration Descriptor)

            Device Path              : \\.\usb#vid_0000&pid_0006#5&109d12e&0&16#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

            Device ID                : USB\VID_0000&PID_0006\5&109D12E&0&16

            Hardware IDs             : USB\CONFIGURATION_DESCRIPTOR_VALIDATION_FAILURE

            Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0049 (GUID_DEVCLASS_USB)

            Driver Inf               : C:\WINDOWS\inf\usb.inf

            Legacy BusType           : PNPBus

            Class                    : USB

            Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)

            Interface GUID           : {a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)

            Enumerator               : USB

            Location Info            : Port_#0016.Hub_#0003

            Manufacturer Info        : (Standard USB Host Controller)

            Capabilities             : 0x64 (Removable, SilentInstall, RawDeviceOK)

            Status                   : 0x01806400 (DN_HAS_PROBLEM, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)

            Problem Code             : 43 (CM_PROB_FAILED_POST_START)

            Address                  : 16

            Power State              : D3 (supported: D0, D3, wake from D0)

             

                    ---------------- Connection Information ---------------

            Connection Index         : 0x10 (16)

            Connection Status        : 0x02 (DeviceFailedEnumeration)

            Current Config Value     : 0x00

            Device Address           : 0x15 (21)

            Is Hub                   : 0x00 (no)

            Number Of Open Pipes     : 0x00 (0)

            Device Bus Speed         : 0x02 (High-Speed) -> not true, see below in Connection Information V2

             

                    --------------- Connection Information V2 -------------

            Connection Index         : 0x10 (16)

            Length                   : 0x10 (16 bytes)

            SupportedUsbProtocols    : 0x04

            Usb110                  : 0 (no)

            Usb200                  : 0 (no)

            Usb300                  : 1 (yes)

            ReservedMBZ             : 0x00

            Flags                    : 0x01

            DevIsOpAtSsOrHigher     : 1 (Is operating at SuperSpeed or higher)

            DevIsSsCapOrHigher      : 0 (Is not SuperSpeed capable or higher)

            DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)

            DevIsSsPlusCapOrHigher  : 0 (Is not SuperSpeedPlus capable or higher)

            ReservedMBZ             : 0x00

             

                ---------------------- Device Descriptor ----------------------

            bLength                  : 0x12 (18 bytes)

            bDescriptorType          : 0x01 (Device Descriptor)

            bcdUSB                   : 0x310 (USB Version 3.10)

            bDeviceClass             : 0xEF (Miscellaneous)

            bDeviceSubClass          : 0x02

            bDeviceProtocol          : 0x01 (IAD - Interface Association Descriptor)

            bMaxPacketSize0          : 0x09 (9 bytes)

            idVendor                 : 0x04B4 (Cypress Semiconductor)

            idProduct                : 0x0008

            bcdDevice                : 0x0000

            iManufacturer            : 0x01 (String Descriptor 1)

            iProduct                 : 0x02 (String Descriptor 2)

            iSerialNumber            : 0x00 (No String Descriptor)

            bNumConfigurations       : 0x01 (1 Configuration)

             

                  -------------------- String Descriptors -------------------

            String descriptors are not available  (because the device has problem code CM_PROB_FAILED_POST_START)

            • 3. Re: How to configure FX3 USB device with multiple interfaces/functions?
              IzMa_4105896

              I figured out why the COM ports were not enumerating: when I added the FIFO interface I left its interface number as 0 which conflicted with UART example.  So now the UART virtual COM port enumerates and works as expected.

               

              The slavefifo interface, however, does not enumerate.  The slavefifo example device would enumerate as a "Cypress FX3 USB StreamerExample Device."  How would I expect to see the slavefifo interface in a composite device?

               

              I've attached the modified usb descriptors file.

              • 4. Re: How to configure FX3 USB device with multiple interfaces/functions?
                KandlaguntaR_36

                Yes, you should give the interface number 3 for slavefifo.

                Please share the screen shots of device manager of the composite device.

                • 5. Re: How to configure FX3 USB device with multiple interfaces/functions?
                  IzMa_4105896

                  I have confirmed that FX3 firmware image works as a slave FIFO or UART but I am not able to access both devices/functions at the same time.

                   

                  For the following tests the FIFO CY_U3P_USB_INTRFC_DESCR is first in the CY_U3P_USB_CONFIG_DESCR array (see attached USBDescriptors.c file).

                   

                   

                    1.  If (PID=0x4B4 VID=0x00F1 && CY_U3P_USB_CONFIG_DESCR.wTotalLength=just FIFO) then

                    

                  •   The StreamerExample device shows up in device manager.

                    

                  •   The StreamerExample device is enumerated by USBDeviceList(CyConst.DEVICES_CYUSB) my FIFO test passes.

                    

                  •   I don’t see the USB to UART device and associated COM port since it is not included in CY_U3P_USB_CONFIG_DESCR.wTotalLength.

                    2.  if (PID=0x4B4 VID=0x0008 && CY_U3P_USB_CONFIG_DESCR.wTotalLength=FIFO+UART) then

                    

                  •   The USB to UART device and associated COM port appears in device manager.

                    

                  •   I am able to open the COM port and my loopback test passes.

                    

                  •   The StreamerExample device does not show up in device manger and is not enumerated by USBDeviceList(CyConst.DEVICES_CYUSB).

                    3.  if (PID=0x4B4 VID=0x00F1 && CY_U3P_USB_CONFIG_DESCR.wTotalLength=FIFO+UART)

                    

                  •   The StreamerExample device does show up in device manager but cannot start (Code 10), invalid parameter was passed to a service or function.

                    

                  •   The USB to UART device and associated COM port do not appear in device manager.

                    

                  •   The StreamerExample device is not enumerated by USBDeviceList(CyConst.DEVICES_CYUSB).

                   

                  I’ve attached UsbDescriptors.c and device manager screen shots for tests 2 & 3 above.

                   

                  On Windows, what do I need to do to bind the correct drivers so I can access to both the Slave FIFO device/function and the USB to UART COM port at the same time?

                  • 6. Re: How to configure FX3 USB device with multiple interfaces/functions?
                    KandlaguntaR_36

                    Let us go step by step as follows:

                     

                    1. Modify the usbdescriptor file of slavefifo project to add the CDC interface descriptors

                    This is done.

                     

                    2. Handle CDC class requests in CyCx3AppUSBSetupCB() API.

                     

                    3. First Configure the endpoint. Create an Auto DMA channel from USB Out EP->UART Consumer and a Manual DMA channel from UART Producer-> USB In EP. Check whether the same endpoints are used in both the example. Avoid duplicate endpoints being used.

                     

                    4. Comment out CyU3PUartTxSetBlockXfer() and CyU3PDebugInit() APIs

                     

                    Please confirm whether you have done step 2, 3 and 4.

                    If yes, please share the entire project here, so that I can also test here.

                    • 7. Re: How to configure FX3 USB device with multiple interfaces/functions?
                      IzMa_4105896

                      I believe all 4 steps have been completed.  I've included the entire project.

                      • 8. Re: How to configure FX3 USB device with multiple interfaces/functions?
                        IzMa_4105896

                        By modifying the EZ-USB FX3 SDK\1.3\driver\bin\Win10\x64\cyusb.inf by adding "%VID_04B4&PID_00F1&MI_00.DeviceDesc%=CyUsb3, USB\VID_04B4&PID_00F1&MI_00" I was able to get the StreamerExample from the composite device to to bind to the correct driver.  I then manually bound the USB-UART device to the correct driver by updating the device driver with device manager. 

                         

                        How to bind the CDC USBUART device that comes up under "other devices" to a virtual COM port?

                         

                        • 9. Re: How to configure FX3 USB device with multiple interfaces/functions?
                          KandlaguntaR_36

                          Please do the following to bind driver to Serial devices. Firstly un-install the driver that bind to Serial devices and do the following.

                           

                          The following steps need to be followed only once, to force bind this interface to CDC driver:

                          1. Download and install CypressDriverInstaller_1.exe from the following link: http://www.cypress.com/documentation/software-and-drivers/usb-serialsoftware-development-kit Page 2 of 3 2. After default installation, 'Cypress USB-Serial Driver' folder will be created in the following path: C:\Program Files (x86)\Cypress

                          3. Right click on CX3-UVC under 'Other devices' section of Device Manager and choose 'Update Driver Software'.

                          4. In the pop-up window, choose 'Browse my computer for driver software'.

                          5. Choose 'Let me pick from a list of device drivers on my computer'.

                          6. Choose 'Show All Devices' and click Next.

                          7. Click on 'Have Disk...'

                          8. In the pop-up window, choose 'Browse...' and go to the following location: C:\Program Files (x86)\Cypress\Cypress USB-Serial Driver\DriverBinary\CDC_Driver\bin\win7\x64

                          9. Choose 'CypressSerial.inf' file and click Open.

                          10. Choose 'OK'. In the next window, select 'USB to UART Adapter' and click Next.

                          11. In the 'Update Driver Warning' pop-up window, choose Yes.Now, one of the CDC interface will come up as USB to UART Adapter in Device Manager.

                          12.Now, you will have another device 'Virtual Serial Port' under Other devices section of Device Manager. 13.Right click on this and choose 'Update Driver Software'.

                          14.Follow steps 3 to 8.

                          15.This time select 'USB Serial Port' and click Next. After you choose 'Yes' in the 'Update Driver Warning' pop-up window, you will get a USB Serial Port(COM x) under Ports (COM&LPT) section of Device Manager. ['x' can be any number]

                          • 10. Re: How to configure FX3 USB device with multiple interfaces/functions?
                            IzMa_4105896

                            > Firstly un-install the driver that bind to Serial devices and do the following.

                            Which serial device's driver should I uninstall?  Ports (COM & LPT) USB Serial Port or USB Controllers USB-Serial * or is there another device?

                            • 11. Re: How to configure FX3 USB device with multiple interfaces/functions?
                              IzMa_4105896

                              The instructions worked for the most part.  

                               

                              After following the above instructions all the devices showed up as expected in Device Manager but the Control Center app started blowing up when it enumerated the devices and got to the "Cypress FX3 USB StreamerExample Device".  My test app did the same.  To fix it I updated the driver for Cypress FX3 USB StreamerExample Device to C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\driver\bin\Win10\x64\cyusb3.inf (why was this necessary?).

                               

                              Both the USB-UART device and StreamerDevice are now accessible at the same time.

                               

                              • 12. Re: How to configure FX3 USB device with multiple interfaces/functions?
                                KandlaguntaR_36

                                >>   To fix it I updated the driver for Cypress FX3 USB StreamerExample Device to C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\driver\bin\Win10\x64\cyusb3.inf (why was this necessary?).

                                 

                                Yes, this is necessary for one time in one PC until you delete the driver for the device.