All About USB


HomeHome / Blog / All About USB

Jul 10, 2023

All About USB

One amazing thing about USB-C is its high-speed capabilities. The pinout gives

One amazing thing about USB-C is its high-speed capabilities. The pinout gives you four high-speed differential pairs and a few more lower-speed pairs, which let you pump giant amounts of data through a connector smaller than a cent coin. Not all devices take advantage of this capability, and they’re not required to – USB-C is designed to be accessible for every portable device under the sun. When you have a device with high-speed needs exposed through USB-C, however, it's glorious just how much USB-C can give you, and how well it can work.

The ability to get a high-speed interface out of USB-C is called an Alternate Mode, "altmode" for short. The three altmodes you can encounter nowadays are USB3, DisplayPort and Thunderbolt, there's a few that have faded into obscurity like HDMI and VirtualLink, and some are up and coming like USB4. Most altmodes require digital USB-C communication, using a certain kind of messages over the PD channel. That said, not all of them do – the USB3 is the simplest one. Let's go through what makes an altmode tick.

If you’ve seen the pinout, you’ve seen the high-speed pins. Today, I’d like to show you what interfaces you can get out of those pins nowadays. This is not a complete or extensive list – for instance, I won't be talking about stuff like USB4, in part because I don't understand it well enough nor do I have experience with it; that, and it's certain we’ll get more USB-C-equipped high-speed devices in the future. Plus, USB-C is flexible enough that a hacker could expose Ethernet or SATA over it in a USB-C-compliant way – and if that's what you’re looking for, perhaps this overview is what helps you figure it out.

USB3 is very, very simple – you have one TX and one RX pair, and while the transmission speeds are way higher than USB2, they’re manageable for a hacker. If you use a multi-layer PCB with impedance-control for USB3 signals and treat your diffpairs with respect, your USB3 connection will generally work.

With USB3 over USB-C, not much changes – you will have a mux for handling the rotation, but that's about it. USB3 muxes are abundant, so you’ll hardly ever have a problem if you’re ever to add USB3-capable USB-C on your board. There's also dual-link USB3, using two USB3 links in parallel to increase throughput, but hackers will generally neither encounter nor need this one, and this territory tends to be better covered by Thunderbolt. Want to convert a USB3 device to USB-C? All you really need is a mux. If you were thinking of putting a MicroUSB 3.0 connector on your board for a high-speed device of yours, I politely but firmly ask you to reconsider and put a USB-C socket and a VL160 on there instead.

If you’re designing a plug-equipped USB3 device, you don't even need a mux for rotation handling – you don't need any rotation detection, in fact. A single, non-monitored 5.1 kΩ resistor will be enough for building a USB3 flashdrive that plugs directly into a USB-C port, or making a USB-C male to USB-A 3.0 female adapter. On the socket side, you can avoid using a mux if you have a spare USB3 connection to sacrifice, though that's not a wonderful trade to make, of course. I’m not aware of dual-link USB3 enough to say if such a connection is USB3 dual-link capable, but I see "no" as more likely of an answer than "yes"!

DisplayPort (DP) is a wonderful interface for connecting high-resolution displays – it's been overtaking HDMI in desktop space, dominating the embedded display space in its eDP form, and provides for high resolutions over a single cable, often better than HDMI can. It's convertable to DVI or HDMI with a cheap adapter using a standard called DP++, and it's not as royalty-encumbered as HDMI is. It makes sense that the VESA consortium has worked with USB group to implement DisplayPort support, especially given that DisplayPort transmitters in SoCs have been getting more and more popular.

If you’re using a dock with HDMI or VGA output, it's using the DisplayPort altmode under the hood. More and more often, monitors come with DisplayPort over USB-C inputs, and thanks to a feature called MST, you can chain monitors, giving you a single-cable multi-monitor configuration – unless you’re using a Macbook, as Apple refuses to support MST in MacOS.

Also, fun fact – the DP altmode is one of the only altmodes that uses SBU pins, which are repurposed for the DisplayPort AUX pair. The overall lack of USB-C pins also meant that DP config pins had to be omitted, excluding the DP++ HDMI/DVI compatibility mode, and as a result, all the USB-C DP to HDMI adapters are actually active DP-HDMI converters in disguise – as opposed to DP++, which lets you use level shifters for HDMI support.

If you want to tinker with DisplayPort, you might need a DP-supporting mux, but most importantly, you’ll need to be able to send custom PD messages. First off, the whole "offering/requesting DP altmode" part is done through PD – resistors are not enough. Plus, there was no free pin for HPD, a crucial signal in DisplayPort, and as such, hotplug events and interrupts are sent as messages over the PD channel instead. That said, it's not terribly hard to implement, and I’m looking at making a hacker-friendly implementation – until then, if you need DP or HDMI out of a USB-C port with DP altmode, there are some chips, like the CYPD3120, which let you write a firmware to do that.

A great thing that makes the DP altmode stand out – with four high-speed lanes on USB-C, this altmode allows combining a USB3 connection on one side of the USB-C port and a two-lane DisplayPort connection on the other. This is how all of the "USB3 ports, peripherals and a HDMI output" docks work. If the dual-lane resolution is limiting for you, you can get a four-lane adapter too – there will be no data transfer because of lack of USB3, but you will be able to get higher resolutions or framerates through two additional DisplayPort lanes.

My take – the DisplayPort altmode is straight up one of the best things about USB-C, and while the cheapest (or most mis-designed) of laptops and phones don't support it, it's a joy to have a device that does. Of course, sometimes a large company will straight up take the joy away, like Google did.

Google explicitly disabled it in the kernel during development.

No reason given.

Qualcomm chips since the 835 natively support DisplayPort Alt Mode.

There's not even a licensing fee involved.

— Mishaal Rahman (@MishaalRahman) October 31, 2019

On that note, let's talk about the most complex altmode of them all.

On USB-C specifically, you can get Thunderbolt 3 – soon, Thunderbolt 4, too, but that's fiction for now. Thunderbolt 3 is an initially proprietary specification that was eventually open-sourced by Intel. Evidently, they didn't open-source it enough or there's a different caveat to it, since Thunderbolt 3 devices in the wild are still being built using exclusively Intel chips, and my guess is that lack of competition is what causes pricetags firmly in triple digit territory. Why would you look for Thunderbolt devices in the first place? Aside from higher speeds, there's a killer feature.

You can get PCIe passthrough over Thunderbolt – up to a 4x wide link, too! This has been a hot topic among people who want eGPU support or fast external storage in form of NVMe drives, and some hackers use it for PCIe-connected FPGAs. If you have two computers (say, two laptops) which support Thunderbolt, you can also link them over a Thunderbolt-capable cable – this creates a high-speed network interface between the two, with no extra components required. Oh, and of course, Thunderbolt can easily tunnel DisplayPort and USB3 within itself. The tech between Thunderbolt is extremely powerful, and tasty for power users.

That said, all this coolness comes at a cost of proprietary and complex technological stack. Thunderbolt is not something that a lone hacker can easily build upon – though, someone ought to try it one day. And, even though the Thunderbolt docks have a wonderful amount of features, the software side of things is often hit and miss, especially when it comes to things like trying to make sleep mode on your laptop work without your eGPU crashing your kernel. If that hasn't been apparent by now, I’m anxiously waiting for Intel to get it together.

I keep saying "muxes". What are those? In short, that's the part that helps handle high-speed signal swapping depending on the USB-C rotation.

The high-speed lanes are the part of USB-C that's the most impacted by port rotation. If your USB-C port uses high-speed lanes, it will need a mux (multiplexer) IC that manages two possible USB-C rotations – matching orientations of ports on both ends and the cable to the actual high-speed receivers and transmitters inside devices being connected. Sometimes these muxes are internal to a high-speed chip if it was developed with USB-C in mind, but a lot of the times they’re a separate chip. Looking to add high-speed USB-C support to a device that doesn't yet have it? A mux will be a core element for making your high-speed communications work.

If your device has a USB-C socket with high-speed lanes, it needs a mux – captive-cable and plug-equipped devices don't need it. As a rule, if you use a cable to connect two high-speed devices with USB-C sockets, both of them need muxes – managing cable rotation is each device's responsiblity. On both sides, the mux (or a PD controller with a mux connected to it) will monitor the CC pin orientation and act accordingly. There are quite a few of these muxes for different purposes, too – depending on what you want out of a port.

You will see USB3-intended muxes in cheap laptops that only implement USB 3.0 on the Type-C port, and if it supports DisplayPort, you will have a mux that has extra inputs to mix those signals in. In laptops with fancier ports that implement Thunderbolt, the mux will be built into the Thunderbolt chip. For hackers developing with USB-C that can't reach Thunderbolt or don't need it, TI and VLI offer quite a few good muxes for all purposes. For instance, I’ve recently been playing with DisplayPort over USB-C, and VL170 (seemingly 1:1 clone of TI HD3SS460) looks like a wonderful chip for combined DisplayPort + USB3 purpose.

DisplayPort-capable USB-C muxes like HD3SS460 don't do CC pin management and rotation detection themselves, but that is a reasonable limitation – you need to do fairly application-specific PD comms for DisplayPort, which quickly outgrows what a mux can do for you. Are you satisfied with USB3, where PD communications aren't required? VL161 is a simple chip for USB3 muxing that has a polarity input, expecting you to do polarity detection yourself.

If you don't want to do polarity detection either – is analog, 5V-only PD enough for your USB3 needs? Use something like the VL160 – it will do sink and source analog PD, handling power and high-speed lane rotation all in one. This is the real "I want USB3 on USB-C and I want everything managed for me" IC; for instance, the VL160 is what the recent open-source HDMI capture card uses for its USB-C port. To be fair, though, I don't have to single out the VL160 – there's dozens of such ICs; "USB3 mux for USB-C that does everything" is probably the most popular kind of USB-C-related IC there is.

There's a few abandoned USB-C altmodes. The first one I won't shed a tear over – it's the HDMI altmode; and it just puts HDMI connector pins onto USB-C connector pins. It would give you HDMI over USB-C, and it seems to have been used on smartphones for a brief period of time. However, having to compete with the easily-convertible-to-HDMI DisplayPort altmode whereas HDMI-DP conversion is typically costly, inability to be combined with USB 3.0 since HDMI requires four differential pairs, and the HDMI licensing baggage seem to have driven the HDMI altmode into the ground. It's my sincere belief that it ought to remain there, as I don't believe our world could be improved by adding more HDMI.

The other one is actually interesting, however – it's called VirtualLink. A group of large tech companies have been looking into capabilities of USB-C for VR – after all, it's wonderful when your VR headset only needs a single cable for everything. However, VR goggles need a high-resolution high-framerate dual-display-capable video interface and a high-speed data connection for auxiliary cameras and sensors, and the usual "dual-lane DisplayPort+USB3" combination couldn't provide such capabilities at the time. What do you do, then?

It's simple, said the VirtualLink group, you get rid of the two duplicated USB2 pairs on the USB-C connector, and use the four pins for a USB3 connection. Remember the USB2 to USB3 converter chip I mentioned in a short article half a year ago? Yeah, its original purpose was VirtualLink. This kind of arrangement, of course, requires a more expensive custom cable with two extra shielded pairs, and it also required PCs to provide up to 27W of power, hence, 9 Volt output – a rarity on USB-C ports that aren't wall plug chargers or powerbanks. The USB2-omitting deviation from USB3 has upset some; however, for the purpose of VR, VirtualLink looked mighty useful.

Some GPUs shipped with VirtualLink support, but, ultimately, not enough – and laptops, known for their often lacking USB-C ports, didn't bother. This caused a key player in the arrangement, Valve, to give up on adding VirtualLink integration with Valve Index, and it went downhill from there. Sadly, VirtualLink never really took off. It would have been a fun altmode to have around – the single cable thing would’ve been amazing for VR users, and the requirement for increased voltage available through USB-C would’ve also given us PD-capable higher-than-5V ports – which no laptops and hardly any PCs provide nowadays. Yes, just a reminder – if you have a USB-C port on your desktop or laptop computer, it will give you 5 V, sure, but you won't get a higher voltage out.

Let's look at the bright side, however. If you happen to have one of those GPUs which shipped with a USB-C port, it will have both USB3 and DisplayPort support!

The great thing about USB-C – a vendor, or a hacker could absolutely define their own altmodes if they wanted, while the adapter would be semi-proprietary, it would still remain a USB-C port at heart, working for charging and data transfer. Want an Ethernet altmode, or dual-port SATA? Do it. Gone are the days of having to source seriously obscure connectors for devices, where every docking and charging connector was different, and could cost up to $10 apiece if rare enough, if it would’ve even been possible to find it.

Not every USB-C port has to implement every single of these capabilities – many don't. However, a lot of them do, and with each day, we get more and more out of an average USB-C port. This unification and standardization will pay off in the long run, and while deviations will occur every now and then, manufacturers will learn to get more clever about them.