Our devices have had USB-C ports for at least five years at this point. Many manufacturers and hackers can support this standard. It was initially unclear what we might face outside, and some folks were turned off by manufacturer-induced abnormalities. However, USB-C is here to stay, and I’d like to show you how it’s utilized in real life, what a power user may expect from it, and what a hobbyist can get out of it.
Common requirements for modern devices include a power input or output, occasionally both, a USB2 connection, and frequently faster connections such a display output or input or USB 3. An interface called USB-C aspires to be able to handle all of those. The fact that all of the aforementioned things are optional is both a benefit and a curse, but you can quickly learn to tell what to expect from a gadget based on the way it appears; if you’re ever unsure, let me teach you how to check.
Communicating Capabilities, Configurations, and Caveats
We all know that USB-C can be rotated – it lets you insert the cable whichever way around — which was a significant improvement over USB-B. Let’s get down to how this works. To make this possible, there’s a CC (Configuration Channel) connection – a single-wire line in every USB-C cable that attaches to one of the two CC pins in the Type-C connector, and it is essential to making USB-C work. For simple USB-C use-cases, like “get USB 2.0 and 5 V out of a port, follow a simple recipe – attach a 5.1 kΩ pulldown to each CC pin, and you will have a USB-C port that will work with all reasonable devices out there.
There’s support for stuff beyond 5 V and USB 2.0 in USB-C, of course. You can get a variety of voltages out of a USB-C port, which is quite handy for charging things like laptops. You can get USB 3, DisplayPort, and Thunderbolt. Most laptops will let you connect a docking station taking advantage of USB-C as much as possible, giving you a high-resolution display, plenty of USB ports, and charging all over the same cable. Now, how does that work?
For use-cases like voltages larger than 5 V (USB-PD) or high-speed connectivity beyond USB 2 and 3 (the “alt modes”, for Alternate Mode) you have to invoke them through the same CC connection. You have a single wire for two-way communications, which makes the CC wire a half-duplex channel; it’s a fixed-rate 300 kbps Ethernet-like protocol. There are plenty of ICs that talk this protocol to implement a set of defined features, and quite a few ICs and microcontroller peripherals will help you say anything you want over the protocol.
With Great Power…
USB-C ports have pins for four high-speed differential pairs, eight pins in total. Many simpler USB-C devices have them disconnected, but there’s a lot of power in these ports. For a start, you can usually get USB 3.1 or 3.2 out of them when you see such a port on a laptop. A USB3 port usually takes up two differential pairs out of four, but some devices support 2 x 2 USB3 links, doubling the number of pairs and the transfer speed. More and more often, you can get DisplayPort out of your USB-C ports, too – with either two or four lanes, you can drive some pretty-high-resolution displays.
Then, there’s Thunderbolt, a half-proprietary technology that also uses high-speed pairs on a USB-C connector. It can tunnel USB3, DisplayPort, and even PCIe within itself, though it’s none of these three things. With Thunderbolt, you can have a docking station but on steroids, with more DisplayPort options, better and faster ports, or perhaps even an external GPU! You might guess that it’s the rarest and most expensive option out of all of these.
Given these high-speed and high-power capabilities, the unification of everything into one connector has strong upsides. Your USB-C laptop charger can also charge your phone in times of need, and thanks to aggressive standardization, there’s not much proprietary stuff involved in charging anymore.
If you have a USB-C Nintendo Switch dock, it will also theoretically act as a dock for your laptop, assuming you can mechanically make it connect, and laptop docks will work with your Steam Deck. In general, docking stations are becoming reasonable – you use a single cable for everything, it works with most USB-C devices out there, and that’s that.
Each year, there’s less and less that USB-C cannot do. Last year, they announced EPR, which raises USB-C port capability to 240 W, at 48 V @ 5 A – as opposed to SPR, where a USB-C port would be limited to 100 W, 20 V @ 5 A. This eliminates the need for barrel plug adapters on laptops, where 100 W of USB-C used to be a barrier – no longer should we need all the “universal” power supplies with an assortment of barrel jack adapters. Then, there’s USB4, an upcoming standard, which is just like Thunderbolt, but not quite, but better, but worse? Either way, we’re going to * USB4 support in computers, and hopefully one day every laptop will be equipped with a high-speed interface, even the cheapest ones.
Overall, USB-C has a bright future, and it’s reasonably well-designed in many aspects – learning from mistakes we’ve been making throughout the decades of ports, cables, and standards, and leaving enough for upcoming additions.
Of course, USB-C also created a whole new field to make mistakes.
…Comes A Memorable Track Record
USB-C horror stories are everywhere – basically, everyone who has used USB-C can tell you about that one time when USB-C failed them, or perhaps, multiple times over. There are more upsides to USB-C than there are downsides, but I firmly believe it’s important we remember the ways it used to fail us and the ways it still does so that we can learn from these ways and figure out how to avoid them.
Not all parts of the USB-C standard are equally well-thought-out. The cable and port situation is the first one to come to mind. When you see a USB-C port, you can hardly ever know at a glance what it supports, and the same goes for cables. The situation is pretty dire, as it stands – using USB-C can, at times, require plenty of guesswork for someone who hasn’t found a decent explanation yet. There are guidelines for how you can distinguish cables, and I will show some tricks along the way. That said, they should have introduced a compelling visual marking scheme from the start.
The USB-C standard is somewhat complicated to implement, with the numerous state machines and peculiarities involved. The USB-C specification is known for infamously long PDF documents: the connector and cables document is 350 pages and the USB-PD document is 600+ pages long. Many manufacturers have tried over the years, in good faith, and still created devices with noticeable and bizarre edge-cases. Laptops that only work with certain chargers and vice-versa, docks that only work with certain laptops or only in combination with a certain charger, cables that work in one orientation only, or devices that work differently depending on cable orientation – there’s no shortage of mystery.
In addition to that, there is an infinite amount of ways to misuse USB-C, and certain manufacturers try hard! It’s not the USB-C standard’s fault that others misuse it — when defining a complex standard, you can only implement a limited amount of protection. However, we still have a whole new category of problems for us to watch out for. Some USB-C sins are hard to forgive and worth zoning in on, and some are less obvious – we’ll go through many of these along the way.
Myriad Ways To Hack On
You must keep this in mind – USB-C will only become more coherent as time goes on; by force, if necessary. Likewise, it will only become more hackable. Because over time, we will collect more and more building blocks – pieces of hardware and knowledge alike. In addition to that, the USB-C ecosystems in our homes are only growing each day. If you’re designing something today, you should strongly consider USB-C for your use cases.
Here, let’s recap what you need to add a USB-C port to make sure your device gets 5 V with up to 3 A possible, with USB 2.0 data, and full rotation support for both.
That’s it. Compared to MicroUSB, it’s only two extra resistors, and the pins are easier to solder. Wire the resistors up specifically as pictured on the schematic; don’t join the CC pins like Raspberry Pi 4 did, and don’t omit the resistors either. If you omit the resistors, the upstream Type-C port will not provide 5 V to your device – a lot of cheap devices omit them. There’s no power provided without the 5.1 kΩ resistors unless you use a USB-A to USB-C cable to power your device. If you omit one of the resistors, only one rotation of the port will work – some cheap devices only have one resistor.
Every USB-C device that wants to receive 5 V at any point has those resistors, either onboard or inside a USB-C communications IC. For a simple “5 V and USB 2.0” purpose, you can just use 1% 5.1 kΩ resistors. That said, in pinch, you can parallel two 10K resistors and it works. I just ordered a reel of 5.1 kΩ resistors and they’ve been of big help. If you have a port where the designer forgot to add these resistors, you can also order some FPC shims that help solder such resistors onto a popular kind of connector!
You have plenty of USB-C connectors to pick from, and the 16-pin ones are a crowd favorite – with a ton of pin-compatible ones available for purchase anywhere, and reasonably easy to hand-solder, especially if you have solder wick to fix mistakes with. Make sure you don’t use connectors without CC pins – as you can’t connect pulldown resistors, it’s not possible to make such connectors work with actual Type-C ports, and they’ll only ever work with a USB-A to USB-C cable, which is a significant limitation.
Of course, there is way more to USB-C than just 5 V @ 3 A and USB 2.0, as I’ve mentioned, and I will show you how you can get to all the other possibilities. However, you must remember the formula shown, as it’s the one you will use the most often, and it will help you understand other formulae as well. In the meantime, you can use SBU pins to expose some debug connections like UART, because nothing except DisplayPort uses SBU. However, it can be tricky to find plug breakouts that expose SBU in a hand-solderable form-factor. And, if you ever enter the USB-C port hacker big leagues, you can implement debugging in a standards-compliant way, too!
You Don’t Always Have To Comply
Compliance with USB-C standards for a hacker is a double-edged sword. If you don’t comply, you might destroy a laptop, or it might be that you will benefit hugely without dangers or downsides. Some scenarios are “outlawed” not because they’re dangerous, but because they are deemed confusing for an average user or won’t result in tip-top functionality, and in many cases, the worst outcome for non-compliance is that someone on the Internet might get angry at you over a nitpick.
In upcoming installments, I will discuss things that are outright terrible and should never have been made. I will also show you how to gently (or harshly) violate the standards where it could benefit you or it would outright make sense, and where it might look like you could violate the standards, but you really, really shouldn’t. Here’s a guideline – when you hear that something you want to use violates the USB-C standards, it very much matters what the consequences of that are in your specific application.
Let’s learn, propagate, and violate the USB-C standard together! See you next week.
Subscribe to AFK Free Media on Google News.