# Trouble with USB3 PCIe cards...



## hsnyder (Aug 13, 2022)

Hi all,

I have two USB3 PCIe cards (different chipset vendors) that are both exhibiting the same symptoms:

 - They are detected and attached to the xhci driver.
 - They sort of work (a usb stick seems to work for file IO)
 - When an interactive device (e.g. USB sound card, mouse, or keyboard) is connected, they seem to drop the overwhelming majority of input events. For example, the mouse moves jerkily, at intervals of several seconds. Most keypresses on a keyboard are missed, and occasionally a "key up" event seems to be missed and the same key is typed repeatedly. A USB sound card has stutters and hitches in the audio output.
 - A USB keyboard used in the machine BIOS works completely fine.

Does anybody recognize this behaviour or know of a solution? I have tried:

 - A different PCIe slot
 - Two different PCIe USB3 cards from different vendors (and different chipset vendors - VIA and ASMedia). One of the cards uses the VIA VL806, which some users on this forum reported working.
 - Tried using Linux instead of BSD with the VIA card. I got the same behaviour in Linux as in FreeBSD.

I'm beginning to suspect that there's an issue with a BIOS setting or a motherboard incompatibility, but I'd love to hear from someone who knows more about such things. This is a supermicro server motherboard (H11DSi) but being used as a workstation.

I'm running current, but about 2 weeks behind...


----------



## SirDice (Aug 15, 2022)

I have a USB3 PCIe card:

```
xhci0@pci0:0:7:0:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1b21 device=0x2142 subvendor=0x3142 subdevice=0x1b21
    vendor     = 'ASMedia Technology Inc.'
    device     = 'ASM2142 USB 3.1 Host Controller'
    class      = serial bus
    subclass   = USB
```
Hasn't given me any issues so far. Bought the card via Amazon, some brand I had never heard of.

https://www.amazon.nl/gp/product/B094QLZC98


----------



## gpw928 (Aug 15, 2022)

I have a StarTech PEXUSB312A2 2-Port USB 3.1 Gen 2 PCIe card. It has two Type A USB3 ports both rated at 10 Gbps, and a SATA power connector providing up to 5V 0.9A (4.5W) per USB-A port, if required.

It also used the ASMedia ASM2142 chipset, and worked without any issues running on FreeBSD in my old ASUS M5A99X EVO R2.0 motherboard.

However, it's obsolete and now replaced by the PEXUSB312A3.


----------



## SirDice (Aug 15, 2022)

hsnyder said:


> I'm beginning to suspect that there's an issue with a BIOS setting


I remember a setting in the BIOS/UEFI, something about XHCI handoff. That's always set to 'off' by default, you might want to try turning that on.


----------



## hsnyder (Aug 15, 2022)

Thanks, this is helpful. I'll have to check the exact model of the ASMedia chipset that I have... I'll also check for that BIOS setting SirDice mentioned.

But just to confirm, you both have had an okay time with interactive devices (e.g. mouse, keyboard) plugged into those cards?

I wonder if XHCI or PCIe power management is somehow involved here...


----------



## SirDice (Aug 15, 2022)

hsnyder said:


> But just to confirm, you both have had an okay time with interactive devices (e.g. mouse, keyboard) plugged into those cards?


Only used it to connect external drives. Copying files/data to and from those drives certainly wasn't a problem. Probably wouldn't have noticed any stuttering if it actually happened though. But moving data back and forth was as speedy as I would have expected. Which was a bit of a surprise actually, after just buying a random card off of Amazon and expecting it to work on FreeBSD 

Oh, card is on a SuperMicro X8DT3-LNF+ board. Pretty old by today's standards.


----------



## hsnyder (Aug 15, 2022)

Interesting.. so maybe you were actually experiencing the same issue that I was, because external drives work correctly for me too. It's specifically interactive devices that do not.


----------



## gpw928 (Aug 15, 2022)

Oh, like SirDice, I only used it for external disks.


----------



## hsnyder (Aug 16, 2022)

Good to know, thank you both. I'll let you know what (if anything) I find as I continue to look into this.


----------



## hsnyder (Aug 16, 2022)

I checked and my ASMedia card and it's also the ASM2142 chip... I also tried disabling IOMMU support in the BIOS and that didn't help (some people have reported issues in Linux with IOMMU enabled on AMD platforms)...


----------



## hsnyder (Aug 23, 2022)

Based on advice received elsewhere, I ordered a third card, based on the Renesas uPD720202 chip. I also updated the firmware on it. It works much better than the other two cards, mouse and keyboard both work correctly. However, using a usb audio interface there are still pops and crackles in the audio stream. Just in case it might help here's a pciconf output... xhci0 is one of the motherboard integrated controllers, and xhci1 is the Renesas one, just for comparison.


```
xhci0@pci0:35:0:3:      class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x148c subvendor=0x15d9 subdevice=0x145c
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Starship USB 3.0 Host Controller'
    class      = serial bus
    subclass   = USB
    cap 09[48] = vendor (length 8)
    cap 01[50] = powerspec 3  supports D0 D3  current D0
    cap 10[64] = PCI-Express 2 endpoint max data 128(256) FLR NS
                 max read 512
                 link x16(x16) speed 16.0(16.0) ASPM disabled(L0s/L1)
    cap 05[a0] = MSI supports 8 messages, 64 bit
    cap 11[c0] = MSI-X supports 8 messages, enabled
                 Table in map 0x10[0xfe000], PBA in map 0x10[0xff000]
    ecap 000b[100] = Vendor [1] ID 0001 Rev 1 Length 16
    ecap 0001[150] = AER 2 0 fatal 0 non-fatal 1 corrected
    ecap 000d[2a0] = ACS 1

xhci1@pci0:1:0:0:       class=0x0c0330 rev=0x02 hdr=0x00 vendor=0x1912 device=0x0015 subvendor=0x1912 subdevice=0x0015
    vendor     = 'Renesas Technology Corp.'
    device     = 'uPD720202 USB 3.0 Host Controller'
    class      = serial bus
    subclass   = USB
    cap 01[50] = powerspec 3  supports D0 D3  current D0
    cap 05[70] = MSI supports 8 messages, 64 bit
    cap 11[90] = MSI-X supports 8 messages, enabled
                 Table in map 0x10[0x1000], PBA in map 0x10[0x1080]
    cap 10[a0] = PCI-Express 2 endpoint max data 128(128) NS
                 max read 512
                 link x1(x1) speed 5.0(5.0) ASPM disabled(L0s/L1) ClockPM disabled
    ecap 0001[100] = AER 1 0 fatal 0 non-fatal 0 corrected
    ecap 0018[150] = LTR 1
```


----------

