This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB 3.0 XHCI Windows 7 Driver Problem

Other Parts Discussed in Thread: TUSB7340

Hello, for a couple years now I've been having problems with the USB 3.0 XHCI Windows Driver, and I'm hoping someone can assist. I'm using Windows 7 64-bit, with a 32-bit client application. 

The problem I'm having is that advanced USB stack queries succeed without generating any USB traffic, and return as successful, but contain garbage data. 

For example, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, fails to generate any traffic on the USB bus, but returns garbage data in the structure. I've analyzed the traffic using an external USB analyzer. 

The problem is easily visible, as the TI driver causes the USBVIEW example from Microsoft to crash unless the TI device is disabled in device manager. 

Plugging a device into a USB 2.0 port on the same system and issuing the same query succeeds and generates traffic. 

I can provide substantially more information than this regarding this problem if it would be of use, just let me know what would be helpful.   

  • Hi Jonathan,

    What you are experiencing is weird. Actually in several application we have developed we use the same IOCTL you mentioned with no issues at all. What version of the TI's xHCI driver are you using? Are you using the latest available? Make sure to use the latest driver available at ti.com.

    Also, which usbview example are you using? Usbview has suffer lots of changes specially to handle USB3.0 devices, maybe you are using an older example and that is why it is crashing. I have used USBView with the TUSB7340 and TI's driver and everything works well.

    Could you provide more information about your particular application?

    Best Regards,

    Alexis Cortes.

  • Hi Alexis, I have tried several versions, including specifically 1.12.25.0 and 1.16.3.0. It's difficult for me to tell which version of USBView I'm using - one, marked 2.0.1 doesn't work, but I found a newer 6.1.7 that works correctly.

    The particular application is a tool that performs raw communication with USB printers. While the Microsoft USB Print subsystem is used to handle the printing operation (without use of windows printer drivers), some advanced queries are done as part of the diagnostic data.

    When a printer is connected to the port on the TI controller, these queries succeed but populate memory with invalid data. Here are some examples. On the TI controller, these calls do not generate traffic, but succeed. 

    An HP Printer on USB 2.0 Port (Intel):
    Enumeration Successful - 1 printers found.
    Successfully connected to Handle 1
    USB Standard: 1.10
    Control Endpoint Size: 8
    Vendor ID: 0x3F0
    Product ID: 0x517
    Device Version: 1.20
    Manufacturer Name: Hewlett-Packard
    Product Name: hp LaserJet 1000
    This function is not supported on this system. (From InternalGetStringDescriptor) This printer does not support the requested string descriptor.
    Disconnecting 1
    Test Complete

    The same printer connected to the Ti Controller:
    Enumeration Successful - 1 printers found.
    Successfully connected to Handle 1
    USB Standard: 165.165
    Control Endpoint Size: 45
    Vendor ID: 0x6150
    Product ID: 0x6B63
    Device Version: 72.61
    A device attached to the system is not functioning. (From InternalGetRawStringDescriptor) DeviceIoControl failed to retrieve the string descriptor.
    Disconnecting 1

    A Zebra Printer on USB 2.0 Port (Intel):
    Enumeration Successful - 1 printers found.
    Successfully connected to Handle 1
    USB Standard: 2.0
    Control Endpoint Size: 64
    Vendor ID: 0xA5F
    Product ID: 0xBD
    Device Version: 1.0
    Manufacturer Name: Zebra Technologies
    Product Name: ZTC QLn320-203dpi CPCL
    Serial Number: QLn320
    Disconnecting 1
    Test Complete

    Same printer on TI Controller:
    Enumeration Successful - 1 printers found.
    Successfully connected to Handle 1
    USB Standard: 165.165
    Control Endpoint Size: 82
    Vendor ID: 0x5A3A
    Product ID: 0x6265
    Device Version: 61.72
    A device attached to the system is not functioning. (From InternalGetRawStringDescriptor) DeviceIoControl failed to retrieve the string descriptor.
    Disconnecting 1

    Here is a snippet of the code driving the queries, in this case the Product ID.

    The enumeration code is the only thing I've omitted here, because it is quite long. I am happy to post it if it would be helpful. It basically enumerates the USB Printers with SetupDiEnumDeviceInterfaces, then calls SetupDiGetDeviceRegistryPropertyA with SPDRP_ADDRESS to get the hub address, then calls CM_Get_Parent, CM_Get_Device_ID, SetupDiOpenDeviceInfoA and SetupDiEnumDeviceInterfaces to create a structure that can be used with  SetupDiGetDeviceInterfaceDetail to get the path to the stack that is handling the hub that the printer is connected to, against which the queries are issued. I can also provide complete code\compiled examples if that would be useful. 

    -- Snip --

    CASE %CCQ_ProductID

       hDevice = CreateFileA(BYREF printerInfo.usbStackPathString, _
          BYVAL 0, _ ' No read/write access
          BYVAL %FILE_SHARE_READ OR %FILE_SHARE_WRITE, _
          BYVAL 0, _ ' No security attributes
          BYVAL %OPEN_EXISTING, _
          BYVAL %FILE_ATTRIBUTE_NORMAL, _
          BYVAL 0 _ ' No template file
       )

       result = InternalGetNodeConnInfoEx(BYVAL hDevice, _
          BYVAL printerInfo.usbStackAddress, _
          BYREF nodeConnInfoExBuffer.buffer(0), _
          BYVAL STRING_BUFFER_SIZE, _
          BYREF nodeConnInfoExBuffer.usedBufferSize)

       IF result = 0 THEN
          nodeConnInfoEx = VARPTR(nodeConnInfoExBuffer.buffer(0))
       END IF

       IF nodeConnInfoEx = 0 THEN
          funcResult = InternalSetLastError(%ERROR_INVALID_PARAMETER, "Invalid USB_NODE_CONNECTION_INFORMATION_EX pointer.", FUNCNAME$)
       ELSE
          buffer.u32value = @nodeConnInfoEx.DeviceDescriptor.idProduct
          buffer.usedBufferSize = 4
          funcResult = InternalSetLastError(%ERROR_SUCCESS,"", FUNCNAME$)
       END IF

    -- End Snip --

    -- Snip --

    FUNCTION InternalGetNodeConnInfoEx ALIAS "InternalGetNodeConnInfoEx" ( _
       BYVAL hDevice AS DWORD, _
       BYVAL connectionIndex AS DWORD, _
       BYREF buffer AS BYTE, _
       BYVAL maxSize AS DWORD, _
       BYREF usedSize AS DWORD _
    ) AS DWORD

    LOCAL result AS DWORD
    LOCAL apiError AS DWORD

    CHECK_INVALID_HANDLE(hDevice)

    result = DeviceIoControl(BYVAL hDevice, _
       BYVAL IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, _
       BYVAL VARPTR(connectionIndex), _
       BYVAL SIZEOF(connectionIndex), _
       BYVAL VARPTR(buffer), _
       BYVAL maxSize, _
       BYVAL VARPTR(usedSize), _
       BYVAL 0) ' No overlapped IOCTLs here

    IF result = 0 THEN
       apiError = GetLastError
       FUNCTION = InternalSetLastError(apiError, "DeviceIoControl failed to retrieve the USB_NODE_CONNECTION_INFORMATION_EX.", FUNCNAME$)
    ELSE
       FUNCTION = InternalSetLastError(%ERROR_SUCCESS, "", FUNCNAME$)
    END IF

    END FUNCTION

    -- End Snip --