WiFi 6 gets 1.34 Gbps on the Raspberry Pi CM4

January 1, 2021 Update: My 1.34 Gbps benchmark was flawed. See this GitHub issue and this updated blog post to learn more: WiFi 6 is not faster than Ethernet on the Raspberry Pi.

EDUP Intel AX200 WiFi 6 802.11ax PCIe card in Raspberry Pi Compute Module 4 IO Board

After buying three wireless cards, a new WiFi router, optimizing my process for cross-compiling the Linux kernel for the Raspberry Pi, installing Intel's WiFi firmware, and patching Intel's wireless driver to make it work on the Raspberry Pi, I benchmarked the EDUP Intel AX200 WiFi 6 PCIe card and got 1.34 Gbps of bandwidth between the Raspberry Pi and a new ASUS WiFi 6 router.

This is my story.

The never-ending budget-busting project

Have you ever started a project that should take a couple hours with a fifty dollar budget, and realized at the end you spent a whole month on it and spent close to a thousand bucks?

Yeah, well, this is one of those projects.

Raspberry Pi Built-in WiFi module 802.11ac Compute Module 4

When I tested the Compute Module 4's onboard WiFi 802.11ac chip, I got up to around 80 Mbps, even when using an external antenna.

ASUS AC51 Wireless WiFi 802.11ac PCIe card

I wondered if I could get better performance with a PCI express card. So I bought an ASUS AC51 PCIe card that has a Realtek chip inside, and I spent a few days debugging Realtek's Linux drivers. Eventually, though, I gave up, because most people on Linux seem use a USB version, not PCI express. If you want to read more about that failure, check out this GitHub issue on the ASUS AC51.

So after a little more research on well-supported WiFi chipsets on Linux, I settled on the EDUP Intel AX200 PCIe card pictured at the top of this post. From what I read online, the iwlwifi drivers it requires are used a lot more widely, in a variety of desktops and laptops running Linux.

Video with extra details

The blog post continues below, but if you're more visually-inclined, I also posted this video about WiFi 6 on the Pi:

Apologies for the thumbnail—it performs a thousand times better than not-open-mouthed-Jeff in my A/B testing.

What's AX? What happened to AC?

But before we get to the card, what's 802.11ax and what's WiFi 6?

Apple AirPort WiFi Router

In WiFi's early days, when Apple's AirPort was all the rage, and we had 802.11b WiFi, with a theoretical maximum speed of 11 Mbps.

In the past couple decades, we had 802.11a and g with 54 Mbps, 802.11n (AKA WiFi 4) with 300-600 Mbps and using either the 2.4 or 5 gigahertz spectrum, and more recently, 802.11ac (AKA WiFi 5) with up to 1.3 Gbps on the 5 gigahertz band.

WiFi bandwidth history 2000-2020

There are some other standards I'm skipping over, but last year the 802.11ax standard was christened as 'WiFi 6', and it's now the gold standard, allowing a theoretical maximum of 10 Gbps over the 5 gigahertz band.

Getting the card to work

Now, back to the PCI express card. It fits nicely in the 1x slot on the Compute Module 4 IO board without the need for any adapters.

The first thing I do with all the boards I test is boot the Pi and see what I can see using lspci:

$ sudo lspci -vvv
...
01:00.0 Network controller: Intel Corporation Device 2723 (rev 1a)

Since the board showed up, I also ran dmesg and looked for the PCI express initialization section, to make sure there weren't any BAR space issues:

[    0.940759] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    0.940790] pci 0000:01:00.0: BAR 0: assigned [mem 0x600000000-0x600003fff 64bit]

GPUs and some other cards I've tested run into BAR allocation issues, but this card seemed to be fine.

I also ran ip a to see if by some dumb luck, the card was already supported in Pi OS, but I had no such luck. Only the built-in wlan0 interface was listed alongside local and eth0.

It looks like it's time to recompile the kernel!

And after going through the struggle of recompiling the Linux kernel almost a dozen times for my first Pi GPU testing video, I decided to set up a reliable cross-compile environment on my Mac, which has a much faster processor.

Cross-compiling the kernel

The environment is built inside a virtual machine on my Mac, and the main reason for that is it's hard to mount the Raspberry Pi ext4 filesystem on my Mac (even with Docker for Mac), but it's easy to do inside a Linux VM under VirtualBox. I have to do that to be able to copy the compiled kernel into place for the Pi when using microSD cards.

There are other ways to do this, e.g. copying driver-specific files over the network instead of the entire kernel, or using netboot—but for now this is how I'm doing it since it's reliable and repeatable in a variety of situations.

The full instructions for cross-compiling are available in my Raspberry Pi PCIe project repo on GitHub: Raspberry Pi Linux Cross-compilation Environment.

iwlwifi enable MVM kernel support for Intel AX200 driver menuconfig compile Linux

The most important thing is to configure the kernel using menuconfig (or by hand if you so wish), and to enable the following options:

  • Device Drivers > Network device support > Wireless LAN > Intel > "Intel Wireless WiFi Next Gen AGN (iwlwifi)"
  • "Intel Wireless WiFi MVM Firmware support" (under the iwlwifi option, once selected)

Once that configuration is saved, compile the kernel. On my Mac, in the VM, it takes around 10 minutes. On the Pi 4, it takes around an hour!

Need more help and details? Check out the video I made on the entire process here: WiFi 6 on the Raspberry Pi CM4 makes it Fly!.

Once the compile is done, follow the rest of the instructions to copy the built kernel, dtbs, etc. over to the microSD card (assuming you're using a CM4 Lite—otherwise mount the eMMC version of the CM4 separately).

After all the copying was finished, I unmounted both partitions, and shut down the VM. I pulled the microSD card from my Mac, put it back in the Pi, booted it up, and crossed my fingers!

Installing the Intel WiFi Firmware

I logged into the Pi and ran dmesg to check the logs... and I realized there must be something missing, because I saw the message no suitable firmware found!

I also had to install the appropriate device firmware from the Linux Wireless website. I found the driver download for the AX200 on the Intel wireless driver page, and installed it on the Pi like so:

$ wget https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi/iwlwifi-cc-46.3cfab8da.0.tgz
$ tar -xvzf iwlwifi-cc-46.3cfab8da.0.tgz
$ cd iwlwifi-cc-46.3cfab8da.0/
$ sudo cp iwlwifi-*.ucode /lib/firmware

I rebooted the Pi and crossed my fingers again!

Running into errors

This time, I ran dmesg and saw a lot more output, but also a lot of errors. Using dmesg --follow, I found there were similar errors being printed out every couple seconds.

And checking with ip a and iw list, I found that there was a new wireless device, but it seemed to be stuck in a loop, incrementing its ID each time it tried initializing.

The two main errors I found were:

[   50.097951] thermal thermal_zone1: failed to read out thermal zone (-61)

And:

[   50.898495] iwlwifi 0000:01:00.0: Failed to configure RX queues: -5

The thermal zone issue was just misdirection; it's not fatal, and in fact, if I manually read out the thermal zone data, it seems to work, so it's probably a bug in the driver.

For the second error, I eventually found a helpful patch on the Linux kernel mailing list.

The solution Paweł Marczewski came up with was to delete the error message and the check that triggered it. I figured it was worth a try, so I patched Intel's WiFi driver using the diff in that email.

Patching Intel's WiFi Driver

I copied out the diff straight from the mailing list page, booted my cross-compile environment again, logged in, and went back into the Linux source directory.

I created a new file called iwlwifi.patch with the contents of the diff from the mailing list, and applied it with git apply -v iwlwifi.patch. The patch applied cleanly with an offset, and so I recompiled (much faster the 2nd time), copied everything over to the Pi's microSD card, and booted the Pi with the patched driver.

It works!

I logged into the Pi, and checked dmesg, and it worked!

I ran ip a to check for the interface, and it showed up as wlan1, and I ran iw list, and it showed up correctly there too!

So the last thing to test was connecting to my network. I edited the WPA supplicant file in /etc/wpa_supplicant/wpa_supplicant.conf, setting my country code and network details

ctrl_interface=/var/run/wpa_supplicant
update_config=1
country=us

network={
 scan_ssid=1
 ssid="geerling-acn"
 psk="my-network-passphrase"
}

I saved the file and rebooted the Pi.

Everything connected, and the WiFi card picked up an IP address. We were in business!

Testing speeds ... and realizing my network is 802.11ac

The first time I did this, I ran a few tests using iperf but realized at this point that I had an 802.11ax wireless card connecting to a pokey old 802.11ac wireless router. So I had to figure out a way to connect over WiFi 6.

Testing speeds ... and realizing I don't have another computer with 802.11ax

Instead of upgrading my entire home network, PixlRainbow on GitHub suggested I try upgrading one of my other computers to WiFi 6, then test connecting it directly to the Pi.

So I was excited when I found a $20 'Wise Tiger' Intel AX200 card for my Dell XPS 13 laptop. I bought it and installed it in the Dell, and made the video How to Upgrade a Dell XPS 13 to WiFi 6 (802.11ax) of the process.

But when I tested the speeds, I was disappointed to find the upgraded card could only pump through 300-400 Mbps on the XPS 13, due to the two-by-two antenna performance and configuration on the Dell. My MacBook Pro, which doesn't have WiFi 6, can get speeds up to 900 Mbps over 802.11ac, so the design of the entire system is extremely important.

I was happy to have WiFi 6 in my Dell laptop, but it wasn't good enough to test how much speed I could get out of my Pi.

Testing speeds again ... and realizing my wired network is 1 Gbps

So my next step was upgrading my Wireless router. And there are a lot of AX routers available, but most of the ones with faster-than-gigabit speeds cost a lot more than the basic models. And if I wanted to break the gigabit barrier, I'd need one with a faster uplink.

I found my local Micro Center had the ASUS RT-AX86U WiFi 6 router with a 2.5 Gbps switchable LAN/WAN port. My home Internet connection can't do anything near that much (thanks, Spectrum!), but I do want to upgrade my internal network to 10 Gbps soon, so it'd be nice to have the fast WiFi connection too.

I bought that router, and replaced my old router with it.

And it was at this point that I realized two more things:

  1. I STILL didn't have any other computers with more than one gigabit of connectivity.
  2. I had blown through my budget for this project weeks ago.

So... I decided to do two things:

First, I bought ten gigabit networking gear, including a MikroTik 4 SFP+ port 10G switch... and I realized after-the-fact the particular transceivers I bought wouldn't work with the router's 2.5 Gbps port—they only did 1 or 10 Gbps.

And second, I decided to follow the advice of St0nedB on GitHub and set up the ASUSWRT-Merlin firmware on my router so I could run iperf directly between my router and the Raspberry Pi.

The instructions for benchmarking with iperf directly with the ASUS router are linked on GitHub, if you want to try the same thing.

Anyways, here's the bottom line:

Raspberry Pi Compute Module 4 Benchmarks - Built-in WiFi AC, Wired 1 Gbps, WiFi 6 AX

Over my Gigabit network, the Pi matched it's built-in gigabit wired network performance, maxing it out at 930 megabits.

And connected directly to the AX router, it could pump through 1.34 gigabits (or a total of 1.5 gigabits bidirectional, with a full-duplex transfer). This WiFi 6 AX200 card runs 30% faster than the built-in gigabit wired networking, and a whopping 16x faster than the built-in WiFi!

It can probably get even faster, but I was happy enough with this result.

Conclusion

So what did I learn?

Getting faster WiFi on the Raspberry Pi isn't too hard, but it does require some extra tweaking and a kernel patch, making it hard for most people to get it working. Hopefully the issues I ran into will be easier to work around in the future.

I want to explore more of the possibilities this fast wireless setup enables, like using WiFi 6 along with fast SATA or NVMe storage for a super fast wireless NAS, or using WiFi 6 along with gigabit ethernet to build a custom router or access point.

If you want to follow along with these adventures, subscribe to my YouTube channel and browse the issues on my Raspberry Pi PCIe Device Database.

And please consider sponsoring my open source work on GitHub Sponsors or Patreon!

Comments

What do you think of the new Xiaomi ax3600 router? It claims wifi6 connectivity at a fraction of your cost. I bet you can hack it to work even faster

For WiFi-only, it's not bad, but it lacks a 2.5 (or greater) Gbps uplink port, so if you want to bridge any wired devices into your network, you're out of luck—they're stuck transferring data at 1 Gbps or slower.

For most people, that's not necessarily a big deal. But I'm trying to get the best WiFi + wired performance possible within my budget :)

iirc (I did my CCNP 20 years ago, so..) LACP can't split a single tcp session across two wires, so it's only useful if your software supports multiple streams.

again.. RK3399 is far faster woth 4 PCI lanes. why RPI 4 is a thing nowdays? who nows. it's just a really bad hardware with tons of hype.

Boards based on the RK3399 are between 2 and 3 times more expensive than the Pi 4 here in the UK, so I would certainly hope they are faster!

The Pi is fast enough for the majority of hobbyist projects. Also, the Pi ecosystem is far superior - there's an easy-to-use OS, educational support, lots of HATs and other resources. It may be stating the obvious, but it bears repeating - there's much more to a SBC than just the hardware.

and that's bc of your policies, they are tons of boards that are extremely competitive on prices. if they reach there 3 times more expensive it's bc of your country policies. radxa Rockpi 4C cost 59, just to give you one example. rk3399 was expensive an year ago. not now. they have 4x PCI and 2 independent usb 3.0 buffers! about the software.. RK3399 sbcs have tons of software support on Linux.

Hi Jeff, i´d like to know if you tested with openwrt SO on Raspberry Module with this AX Board. Could you test it?

I'd love to try this combo (pi 4 cm + wifi 6 card) to make a wifi access point.

max 11ax Phy data rate for Intel AX200 on 5GHz is 2401Mbps since both Intel AX200 and ASUS WIFI6 support 160M bandwidth.
So it's possible to have 1340Mbps iperf throughput.

I follow your video with 2 cm4 and the same wifi 6 pcie Boards.
I setup one as a 5ghz AP and connect the second one to it. Then run an iperf and the result was really slow (around 30mbits) .
Did you make some test using the AP mode the ax200?

With the regular Rasberry Pi there are instructions to enable it into hostAP mode. Are any of those PCIe adapters able to enter hostAP mode? If so, maybe we can create a more affordable wifi 6 router.

What needs to be mentioned is that this traffic is only simplex. If you want symmetrical duplex traffic, the ethernet connection will still be the best option.
Also, as soon as you will start to use this in combination with wifi 5 clients, the OFDMA that is present with Wifi 6 clients will become less effective since.
Next to this, 160MHz BW is having more interference and is covered by DFS. As soon as there is a radar signal, you need to fallback to 80MHz an the max theoretical througput speeds will drop with 50%. As soon as 6GHz is introduced worldwide, then 160MHz BW will become more common. However, not a lot of clients will support these 3 bands, this will only add cost to devices, it will initially be perfect as a backhaul for mesh networks in the coming years.

Hello Jeff how you can test the Rasp network packet speed ?
İ build a nas and want to be sure all connections are ok about nethwork.
İm using gigabit switch and cat6 cables.I tra to copy files to rasberry nas with raid5 and rtfs files system on 6 drives.
Copy speed looks like 60 kbit/s

I use iperf3 — basically run iperf3 -s on one end, and iperf3 -c [ip address of 'server' here] on the other, and that will measure the maximum TCP throughput of the connection. Measure it both ways to be complete.

Hello Jeff how you can test the Rasp network packet speed ?
İ build a nas and want to be sure all connections are ok about nethwork.
İm using gigabit switch and cat6 cables.I tra to copy files to rasberry nas with raid5 and rtfs files system on 6 drives.
Copy speed looks like 60 kbit/s