Author Topic: XHCI and USB Audio perspectives  (Read 58300 times)

Lars

  • Hero Member
  • *****
  • Posts: 1363
  • Karma: +70/-0
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #60 on: December 09, 2022, 01:58:22 am »
By the way: I have an XMOS device as a USB audio 2.0 device:

Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x20b1 XMOS Ltd
  idProduct          0x3060
  bcdDevice            0.03
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      2
...

That device at least works fine with USBAUD2.SYS version 10.247.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #61 on: December 09, 2022, 02:09:39 am »
In fact, I drew a slightly different conclusion from the situation.
I believe that the problem is in the USB stack from AN and since for both firmware versions your drivers 10.xx are suitable, as long as we don't run into the need to connect the device to the XHCI controller. As soon as the XHCI and USBD driver from AN appears, miracles begin. For example , such:
If there are 2 XHCI controllers in the system and we connect a USB Audio device to the port of the second controller, then playback speeds up - multiple times, and the timer of the player runs very fast and the sound is distorted.
When using the XHCI driver from AN, fatal errors appear, crashes when switching tracks (I mentioned them in the letter).

The fact that there is an acceptable USB audio operation on the EHCI controller ports with firmware for Linux only shows that the EHCI driver can be called selectively working.

By the way, the device on the Amanero controller works fine both under Windows OS on linux firmware and under Linux OS on Windows firmware. There are nuances when switching to DSD format and separate drivers are needed under windows when using the Windows firmware version, which just smooth out these clicks.

It seems to me if there was a 10.250 version of the driver with the file usbxhcd.sys then there would be no such problems in it :-)

Yes, I can save the descriptors. I'll post them here. I have already read the descriptors once, on the previous Amanero device with old firmware. Here they are below and in the attachment.

Code: [Select]
Bus 001 Device 002: ID 16d0:0a23 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239
  bDeviceSubClass         2
  bDeviceProtocol         1
  bMaxPacketSize0        64
  idVendor           0x16d0
  idProduct          0x0a23
  bcdDevice            1.9b
  iManufacturer           1 Amanero Technologies
  iProduct                2 Combo384 Amanero
  iSerial                 3 413-001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          213
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x40
      (Missing must-be-set bit!)
      Self Powered
    MaxPower                0mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          1
      bFunctionSubClass       0
      bFunctionProtocol      32
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1
      bInterfaceSubClass      1
      bInterfaceProtocol     32
      iInterface              0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               2.00
        bCategory               1
        wTotalLength           72
        bmControl            0x00
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     10 (CLOCK_SOURCE)
        bClockID               41
        bmAttributes         0x03 Internal programmable Clock
        bmControls           0x07
          Clock Frequency Control (read/write)
          Clock Validity Control (read-only)
        bAssocTerminal          0
        iClockSource            2 Combo384 Amanero
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     11 (CLOCK_SELECTOR)
        bUnitID                40
        bNrInPins               1
        baCSourceID( 0)        41
        bmControls           0x03
          Clock Selector Control (read/write)
        iClockSelector          2 Combo384 Amanero
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            42
        wTerminalType      0x0101
        bAssocTerminal          0
        bCSourceID             40
        bNrChannels             2
        bmChannelConfig   0x00000000
        bmControls    0x0000
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                10
        bSourceID              42
        bmaControls( 0)      0x0000000f
          Mute Control (read/write)
          Volume Control (read/write)
        bmaControls( 1)      0x0000000f
          Mute Control (read/write)
          Volume Control (read/write)
        bmaControls( 2)      0x0000000f
          Mute Control (read/write)
          Volume Control (read/write)
        iFeature                0
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            43
        wTerminalType      0x0301
        bAssocTerminal          0
        bSourceID              10
        bCSourceID             40
        bmControls         0x0000
        iTerminal               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1
      bInterfaceSubClass      2
      bInterfaceProtocol     32
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass         1
      bInterfaceSubClass      2
      bInterfaceProtocol     32
      iInterface              0
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          42
        bmControls           0x00
        bFormatType             1
        bmFormats               1
          PCM
        bNrChannels             2
        bmChannelConfig   0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         32
      ** UNRECOGNIZED:  08 25 01 00 00 02 08 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0308  1x 776 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes           17
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Feedback
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass         1
      bInterfaceSubClass      2
      bInterfaceProtocol     32
      iInterface              0
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          42
        bmControls           0x00
        bFormatType             1
        bmFormats               1
          PCM
        bNrChannels             2
        bmChannelConfig   0x00000003
          Front Left (FL)
          Front Right (FR)
        iChannelNames           0
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         32
      ** UNRECOGNIZED:  08 25 01 00 00 02 08 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0308  1x 776 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes           17
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Feedback
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval               4
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
« Last Edit: December 09, 2022, 06:06:24 am by Mikhail »

Lars

  • Hero Member
  • *****
  • Posts: 1363
  • Karma: +70/-0
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #62 on: December 09, 2022, 12:29:56 pm »
I looked at both of the descriptor dumps (Linux and Windows). Are these really for the same physical device ?

The "Linux dump" shows an audio interface (which of course was expected).
However, the "Windows dump" shows a vendor specific bulk interface (like it were a memory stick) but no audio interface.
With the Windows descriptor set, the device should never be detected as an audio device.
To me, the Windows descriptor set looks like it is for FW update or some such.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #63 on: December 09, 2022, 08:21:49 pm »
The descriptors for the Windows firmware version were written correctly. For USB drivers version 12.14, the descriptors are read this way.
On USB drivers version 10.247, the result is completely different - more complete.

By the way, I compared a few descriptors and on the Linux version of the firmware, the files there are the same (It seems).

I also considered the descriptors from the M2tech hiface two device, it really works better, especially if installed in the USB 3.0 XHCI port on a PCIe card. There are no questions about the work at all, and frequency switching works and there are no artifacts in the sound, the device does not support DSD from 44/16 to 192/24. Everything would be fine, but if you plug M2tech into the port of the motherboard, then a crackle in the sound and freezes when executing player commands begins.

Lars

  • Hero Member
  • *****
  • Posts: 1363
  • Karma: +70/-0
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #64 on: December 10, 2022, 02:25:20 pm »
The problems you describe regarding the M2tech device are clearly a problem of the host controller driver USBXHCD.SYS (most likely) and/or USBD.SYS (less likely) because USBAUD2.SYS does not touch the HW and knows nothing about what HC instance or USB port is used (it does not distinguish between the onboard HC and the plugin card HC).
Since you are using AN USB stack, you will need to raise a problem report with AN.
If they don't respond, the only advice remaining is: switch over to another OS, Linux or Windows, whatever you prefer.
« Last Edit: December 12, 2022, 03:09:44 pm by Lars »

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #65 on: December 10, 2022, 07:08:14 pm »
If they don't respond, the only advice remaining is: switch over to another OS, Linux or Windows, whatever you prefer.
I am deeply immersed in the topic of sound quality of different operating systems on specially prepared computers. OS/2 in general and OS/4 in particular sounds the best of all systems. If the difference was not fundamental, I would have switched to Windows or Linux a long time ago. There would be much less problems with compatibility.

Lars

  • Hero Member
  • *****
  • Posts: 1363
  • Karma: +70/-0
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #66 on: December 17, 2022, 01:19:34 pm »
As to point 3) in my last email to you: please try the attached and see if that makes a difference.
Unfortunately, I cannot send any ZIP file to you that contains .SYS driver files (Google rejects).
You could also send me an upload link via private message.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #67 on: January 13, 2023, 11:36:08 pm »
I will clarify the current status.
USB Audio devices of Class 2.0 on the ports of XHCI controllers do not work stably.
The problems described in the topics above have not yet been solved.
Most devices experience problems with cracking and dropping samples, sometimes slightly noticeable, sometimes very noticeable.
Other devices cannot synchronize the sampling frequency of the audio stream with the signal source the first time. As a result, the playback speed changes.

Unfortunately - AN rejected my ticket to the XHCI driver with this problem.

If there are those who wish to repeat the appeal, use only the release versions of drivers and OS when preparing logs.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #68 on: July 22, 2024, 11:26:47 pm »
The issue of UAC 2.0 device compatibility with XHCI has been resolved in drivers 12.16.
Thanks to David, Lars and Wim!
It remains to understand why playback occasionally stops in the middle of a track, this problem is not related to a compatibility problem and appears in a floating way, perhaps there is something wrong with my hardware.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5000
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: XHCI and USB Audio perspectives
« Reply #69 on: July 27, 2024, 03:07:39 pm »
Hello Mikhail

Can you please confirm, is this your device you were testing:
https://www.os2world.com/wiki/index.php/Amanero_Combo384

Is there something else that you want me to add to the wiki page as information? any remarks?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #70 on: July 28, 2024, 02:03:37 am »
The problem that David solved concerns not one specific device, but the entire class of USB Audio Class 2 devices. For my purposes (high-quality audio playback), I use devices on XMOS chips and programmable FPGA controllers with Amanero firmware; they are most often installed in external DAC devices . I tested both devices on different controllers, connecting them to XHCI controller ports on different motherboards and external PCI-e cards with USB3 ports. In all cases the problem of crackling, distortion and TRAP went away.

Attached are detailed LSUSB logs for the devices I connected.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5041
  • Karma: +114/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #71 on: July 28, 2024, 06:43:27 am »
It remains to understand why playback occasionally stops in the middle of a track, this problem is not related to a compatibility problem and appears in a floating way, perhaps there is something wrong with my hardware.

Try with only one CPU (core) enabled and see if it still happens. There is code in various drivers etc that is not SMP safe.
David also fixed an issue that I was having when copying files from one USB device to another USB device, which would trap and bring down the system. He wasn't very hopeful with the problem being intermittent and then he proposed a fix that worked.
Edit: It was a SMP issue

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #72 on: July 31, 2024, 03:01:38 am »
I have to admit that my conclusions about the absence of errors in the operation of UAC devices were incorrect. I conducted more in-depth testing for PCI-e cards with USB XHCI controllers on different motherboards, both with their own XHCI controller and without their own XHCI controller. All PCI-e cards and controllers on motherboards behaved differently and only one PCI-e card worked correctly on both motherboards and with all the UAC devices that I have. And even the xhci controllers built into motherboards were not compatible with all UAC2 devices (which, I understand, is not an AN problem, but I provide this information as an observation).

In total I have 4 PCI-e different XHCI boards, 3 of them on different chipsets (Texas instruments, Asmedia, and Renesas).
If we talk about each separately then:
  • The board with the Renesas PD720202 controller for 6 ports does not work at all, it is detected in the system, but none of the UAC2 devices work on it and are not detected. Apparently the problem is that this card has a HUB/divider.
  • The board with a Renesas PD720202 controller for 2 ports is fully functional. Both devices on XMOS chips and AMANERO are detected and operated on it. When playback is at the correct speed, multi-hour playlists do not stop.
  • Board with Asmedia ASM2142 controller for 1 port. The board is unstable. In the original and latest build of ArcaOS 5.1 installed in UEFI mode, the board is only capable of working with the Amanero UAC2 device and refuses to detect and work with the XMOS device. With the UAC2 Amanero device, playback can stop at any time without any apparent reason or error. Moreover, in a micro assembly, when loading the system into MSHELL via Legacy (BIOS), playback mode can last several minutes, and in a full system in UEFI mode, playback rarely lasts longer than 5 seconds.
  • Board with Texas Instruments TUSB73x0 controller for 1 port. The board is unstable. In the original ArcaOS 5.1 build installed in UEFI mode, the board is only capable of working with the Amanero UAC2 device and refuses to detect and work with the XMOS device. With the UAC2 Amanero device, normal playback is possible only for the first launched track; all subsequent tracks are played back at a speed increased several times.

As for XHCI controllers built into the motherboard or processor chipset. At the moment, for OS/2 I am using a motherboard with an Intel Q370 chipset, the only XHCI controller on this motherboard works normally only with the AMANERO UAC2 device, it works fully (without accelerations and sudden stops). UAC2 XMOS device is not detected.

Mikhail

  • Newbie
  • *
  • Posts: 43
  • Karma: +3/-1
    • View Profile
Re: XHCI and USB Audio perspectives
« Reply #73 on: July 31, 2024, 01:18:49 pm »
It remains to understand why playback occasionally stops in the middle of a track, this problem is not related to a compatibility problem and appears in a floating way, perhaps there is something wrong with my hardware.

Try with only one CPU (core) enabled and see if it still happens.

Thanks for the advice. I tried leaving only one core enabled and it had no effect on the problem.