PCIe For Hackers: Extracting The Most

So, you now know the basics of approaching PCIe, and perhaps you have a PCIe-related goal in mind. Maybe you want to equip a single-board computer of yours with a bunch of cheap yet powerful PCIe WiFi cards for wardriving, perhaps add a second NVMe SSD to your laptop instead of that Ethernet controller you never use, or maybe, add a full-size GPU to your Raspberry Pi 4 through a nifty adapter. Whatever you want to do – let’s make sure there isn’t an area of PCIe that you aren’t familiar of.

Splitting A PCIe Port

You might have heard the term “bifurcation” if you’ve been around PCIe, especially in mining or PC tinkering communities. This is splitting a PCIe slot into multiple PCIe links, and as you can imagine, it’s quite tasty of a feature for hackers; you don’t need any extra hardware, really, all you need is to add a buffer for REFCLK. See, it’s still needed by every single extra port you get – but you can’t physically just pull the same clock diffpair to all the slots at once, since that will result in stubs and, consequently, signal reflections; a REFCLK buffer chip takes the clock from the host and produces a number of identical copies of the REFCLK signal that you then pull standalone. You might have seen x16 to four NVMe slot cards online – invariably, somewhere in the corner of the card, you can spot the REFCLK buffer chip. In a perfect scenario, this is all you need to get more PCIe out of your PCIe.

Continue reading “PCIe For Hackers: Extracting The Most”

PCIe For Hackers: Link Anatomy

Last time, we looked over diffpairs, their basics, routing rules and the notorious tolerances of PCIe when it comes to diffpairs. Now, let’s take a look at the exact signals that make PCIe tick, as well as give you an overview of which sockets you can get PCIe on.

I separate PCIe sockets into two categories – desktop sockets, which are the usual 1x, 16x, or perhaps x4 PCIe sockets we see on desktop motherboards — and mobile sockets: mPCIe and M.2. There are also sockets like ExpressCard that are still found on some older laptops, but they have definitely fallen out of relevance. On mobile, M.2 is the way forward when it comes to PCIe – if you’re interested, I’ve written a short series talking about everything M.2 before.

On these sockets, most signals will be optional and some signals will be socket-specific, but there are some signals required in any PCIe device. Of course, the first group of required signals is the PCIe diffpairs themselves.

Continue reading “PCIe For Hackers: Link Anatomy”

PCIe For Hackers: The Diffpair Prelude

PCIe, also known as PCI-Express, is a highly powerful interface. So let’s see what it takes to hack on something that powerful. PCIe is be a bit intimidating at first, however it is reasonably simple to start building PCIe stuff, and the interface is quite resilient for hobbyist-level technology. There will come a time when we want to use a PCIe chip in our designs, or perhaps, make use of the PCIe connection available on a certain Compute Module, and it’s good to make sure that we’re ready for that.

PCIe is everywhere now. Every modern computer has a bunch of PCIe devices performing crucial functions, and even iPhones use PCIe internally to connect the CPU with the flash and WiFi chips. You can get all kinds of PCIe devices: Ethernet controllers, high-throughput WiFi cards, graphics, and all the cheap NVMe drives that gladly provide you with heaps of storage when connected over PCIe. If you’re hacking on a laptop or a single-board computer and you’d like to add a PCIe device, you can get some PCIe from one of the PCIe-carrying sockets, or just tap into an existing PCIe link if there’s no socket to connect to. It’s been two decades since we’ve started getting PCIe devices – now, PCIe is on its 5.0 revision, and it’s clear that it’s here to stay.

Continue reading “PCIe For Hackers: The Diffpair Prelude”

Four M.2 cards of different sizes on a desk surface

M.2 For Hackers – Cards

Last time, I’ve explained everything you could want to know if you wanted to put an M.2 socket onto your board. Today, let’s build M.2 cards! There’s a myriad of M.2 sockets out there that are just asking for a special card to be inserted into it, and perhaps, it’s going to be your creation that fits.

Why Build Cards?

Laptops and other x86 mainboards often come with M.2 slots. Do you have a free B-key slot? You can put a RP2040 and bunch of sensors on a B-key PCB as an experimental platform carried safely inside your laptop. Would you like to do some more advanced FPGA experiments? Here’s a miniscule FPGA board that fits inside your laptop and lets you play with PCIe on this same laptop – the entire setup having a super low footprint. Are you looking for an extra PCIe link because you’re reusing your laptop as a home server? Again, your WiFi slot will provide you with that. Want to get some PCIe out of a SteamDeck? Building a M-key 2230 card seems to be your only hope! Continue reading “M.2 For Hackers – Cards”

Raspberry Pi Grants Remote Access Via PCIe (Sort Of)

[Jeff] found a Raspberry Pi — well, the compute module version, anyway — in an odd place: on a PCI Express card. Why would you plug a Raspberry Pi into a PC? Well, you aren’t exactly. The card uses the PCI Express connector as a way to mount in the computer and connect to the PC’s ground. The Pi exposes its own network cable and is powered by PoE or a USB C cable. So what does it do? It offers remote keyboard, video, and mouse (KVM) services. The trick is you can then get to the PC remotely even if you need to access, say, the BIOS setup screen or troubleshoot an OS that won’t boot.

This isn’t a new idea. In fact, we’ve seen the underlying Pi-KVM software before, so if you don’t mind figuring out your mounting options for a Raspberry Pi, you probably don’t need this board. Good thing too. Judging by the comments, they are hard to actually buy — perhaps, due to the chip shortage.

Continue reading “Raspberry Pi Grants Remote Access Via PCIe (Sort Of)”

Picture of the setup described in the article, with PCI-E cards strewn around the desk, all interconnected, and a powered-up laptop, a large TV screen behind the laptop

This Laptop Gets All The PCIe Devices

Did you ever feel like your laptop’s GPU was sub-optimal, or perhaps that your laptop could use a SAS controller? [Rob Rogers] felt like that too, so now he has the only Dell Latitude business-class laptop that’s paired with an AMD RX580 GPU – and more. Made possible because of a PCIe link he hijacked from the WiFi card, he managed to get a SAS controller, a USB 3.0 expansion card, the aforementioned GPU and a dual-port server network adapter, all in a single, desk-top setup, as the video demonstrates.

First off, we see a PCIe packet switch board based on a PLX-made chip, wrapped in blue tape, splitting a single PCIe x1 link into eight. The traditional USB 3.0 cables carry the downstream x1 links to the four PCIe cards connected, all laid out on [Rob]’s desk. [Rob] demonstrates that all of the cards indeed function correctly – the SAS controller connected to a server backplane with whole 22 TB of storage in it, a few devices plugged into a USB 3.0 card, an Ethernet cable with an active link in the network card, and wrapping up the video showing 3DMark results of the RX580 clearly paired with the laptop’s mobile CPU. There’s four more spots on the PCIe switch card, so if you wanted to connect a few NVMe SSDs without the costly USB enclosures that usually entails, you absolutely could!

The setup on the desk, laptop-less, still interconnected and with the mini pci-e adapter visibleNow, there’s a reason why we don’t see more of such hacks. This seems to be a Latitude E5440 and the card is plugged into a mini-PCIe slot, which means the entire contraption is bound by a single PCI-E Gen2 x1 link, heavily offsetting the gains you’d get from an external GPU when, say, gaming. However, when it comes to the types and amount of peripherals, this is unbeatable – if you want to add an external GPU, high-speed networking and a SAS controller to the same computer that you usually lug around, there isn’t really a dock station you can buy for that!

Our collection of cool PCIe hacks has been growing, with hackers adding external GPUs through ExpressCard and mini PCIe alike, fitting PCIe slots where the factory refused to provide one, and extending the onboard M.2 slots for full-size PCIe cards. Nowadays, with these packet switches, it’s easy as ever to outfit any PCIe capable device with a whole slew of features – as this Raspberry Pi Computer Module motherboard with eleven PCIe slots demonstrates. Wonder how PCIe works, and why all of that is possible? We’ve written an entire article on that!

Continue reading “This Laptop Gets All The PCIe Devices”

The Bus That’s Not A Bus: The Joys Of Hacking PCI Express

PCI Express (PCIe) has been around since 2003, and in that time it has managed to become the primary data interconnect for not only expansion cards, but also high-speed external devices. What also makes PCIe interesting is that it replaces the widespread use of parallel buses with serial links. Instead of having a bus with a common medium (traces) to which multiple devices connect, PCIe uses a root complex that directly connects to PCIe end points.

This is similar to how Ethernet originally used a bus configuration, with a common backbone (coax cable), but modern Ethernet (starting in the 90s) moved to a point-to-point configuration, assisted by switches to allow for dynamic switching between which points (devices) are connected. PCIe also offers the ability to add switches which allows more than one PCIe end point (a device or part of a device) to share a PCIe link (called a ‘lane’).

This change from a parallel bus to serial links simplifies the topology a lot compared to ISA or PCI where communication time had to be shared with other PCI devices on the bus and only half-duplex operation was possible. The ability to bundle multiple lanes to provide less or more bandwidth to specific ports or devices has meant that there was no need for a specialized graphics card slot, using e.g. an x16 PCIe slot with 16 lanes. It does however mean we’re using serial links that run at many GHz and must be implemented as differential pairs to protect signal integrity.

This all may seem a bit beyond the means of the average hobbyist, but there are still ways to have fun with PCIe hacking even if they do not involve breadboarding 7400-logic chips and debugging with a 100 MHz budget oscilloscope, like with ISA buses.

Continue reading “The Bus That’s Not A Bus: The Joys Of Hacking PCI Express”