A brief sharing on using Raspberry Pi 4B with high speed USB3 WiFi as AP

I know this is not recommended, but people do have a reason to do it, maybe as a dirty quick solution, and I've seen people asking about this from time-to-time, so I am trying to write-up a bit of my findings here:

First of all, the most important thing, picking a well-supported USB WiFi, this is very tricky as most of the USB one on market don't play well with Linux (thanks to Realtek)

Here is a post with some tested one, for more detail information about status of various dongles, you can read this.

USB 2.0 based supported dongles are kind of no-brainers, install driver and it should work without issue, I have many success with my MT7610U 802.11ac 1x1 little dongle (one of them are even deployed as far end AP just to cover small corner with IoTs at the other end of my home)

USB 3.0 based devices are tricky.....yes, very tricky, especially on Raspberry Pi 4B, for those who picked a general Linux supported dongle but failing to use on Pi4B should really blame Pi Foundation of picking such a bad design on USB interface.

I was struggling with 3 USB3 based MT7612U 802.11ac 2x2 MIMO WiFi, tested on Linux laptop they work like charm, using with OpenWrt as AP on NanoPi R4S also working nicely. On Pi4B USB subsystem seems crashed when I use it with USB3 port, when there is very little traffic nothing happens but when you put load on it, the AP crashes and dmesg log with something similar to below exists:

Wed Apr  3 00:00:03 2024 kern.warn kernel: [  274.275890] xhci_hcd 0000:01:00.0: WARN: TRB error for slot 2 ep 7 on endpoint
Wed Apr  3 00:00:03 2024 kern.warn kernel: [  274.283267] xhci_hcd 0000:01:00.0: WARN waiting for error on ep to be cleared
Wed Apr  3 00:00:03 2024 kern.err kernel: [  274.283421] mt76x2u 2-2:1.0: tx urb failed: -84
Wed Apr  3 00:00:03 2024 kern.err kernel: [  274.290412] mt76x2u 2-2:1.0: tx urb submit failed:-22
Wed Apr  3 00:00:03 2024 kern.warn kernel: [  274.300093] xhci_hcd 0000:01:00.0: WARN waiting for error on ep to be cleared
Wed Apr  3 00:00:03 2024 kern.err kernel: [  274.307238] mt76x2u 2-2:1.0: tx urb submit failed:-22
Wed Apr  3 00:00:05 2024 kern.err kernel: [  276.666422] mt76x2u 2-2:1.0: error: mt76x02u_mcu_wait_resp failed with -110

I was using official RPi USB power, also verified that no throttling throughout the whole testing process, in fact they worked on older USB2 only RPi so there is no point to blame the power. Also, even with USB2 port on Pi4B they failed as well.

Thanks to the GitHub I quoted above, I managed to get them working on USB2 of Pi4B by this:
echo 1 > /sys/module/mt76_usb/parameters/disable_usb_sg

(In fact if you need you can make it an module option during boot)
This is USB Scatter-Gather problem for some USB hosts, it does helped me to allow those MT7612U to be used on USB2 ports @Pi4B, but the performance is quite terrible (up to 100Mbps speed and transfer might stall from time to time), well at least we managed to get past one barrier now.

Got another hint from Raspberry Pi forum, people talking about similar USB bus crashing that might be caused by interrupts (even in RPi OS). So I tried to move my onboard ethernet interrupts away from default core#0 (this is also the default core used by XHCI)

 echo 2 > /proc/irq/35/smp_affinity
 echo 2 > /proc/irq/36/smp_affinity

In my case eth0 has interrupt 35/36, above settings moved both interrupts to core#1, now continued to setup the AP again to test, Ookla/Fast.com/Bufferbloat tests all done without issue, then to download Windows 10 ISO + Linux Mint ISO (total roughly 8GB) succeeded with sustained speed no less than 300Mbps.

Feel free to input more or discuss!


Thank you for all the work you did and the knowledge you shared.

The speed was kind of insane for my PIX-LINK LV-UAC04 when used with as AP, now I can get 300-350Mbps even when I'm on the other floor inside my home.

1 Like