All About USB-C: Introduction For Hackers

We’ve now had at least five years of USB-C ports in our devices. It’s a standard that many manufacturers and hackers can get behind. Initially, there was plenty of confusion about what we’d actually encounter out there, and manufacturer-induced aberrations have put some people off. However, USB-C is here to stay, and I’d like to show you how USB-C actually gets used out there, what you can expect out of it as a power user, and what you can get out of it as a hobbyist.

Modern devices have a set of common needs – they need a power input, or a power output, sometimes both, typically a USB2 connection, and often some higher-speed connectivity like a display output/input or USB 3. USB-C is an interface that aims to be able to take care of all of those. Everything aforementioned is optional, which is a blessing and a curse, but you can quickly learn to distinguish what to expect out of a device based on how it looks; if ever in doubt, I’d like to show 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 usecases, 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 usecases like voltages larger than 5 V (USB-PD) or high-speed connectivity beyond USB 2 and 3 (the “altmodes”, 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’s 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 amount 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 the 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 up 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 basically 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 see more 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 in.

…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’s 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 to 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 edgecases. 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 USB-C standard’s fault that others misuse it — when defining a complex standard, you can only implement a limited amount of protections. 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

It’s important you 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 as 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 within each day. If you’re designing something today, you should strongly consider USB-C for your usecases.

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.

Symbol: USB_C_Receptacle_USB2.0; footprint: USB_C_Receptacle_HRO_TYPE-C-31-M-12

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 an 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 an 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 actually works. Personally, 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 connectors!

You have plenty of USB-C connectors to pick from, and the 16-pin ones are a crowd favourite – 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 an 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, it’s important that you 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 likea 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 actually implement debugging in a standards-compliant way, too!

You Don’t Always Have To Comply

And even full compliance won’t always keep you safe.

Compliance to 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 actually 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.

53 thoughts on “All About USB-C: Introduction For Hackers

    1. Hi, no only some devices support USB OTG like most smartphones. The cheapest smartphones however don’t support OTG on their USB-C connectors as well as the devices which use USB-C for charging only like headsets and battery powered bluetooth speakers.

    2. A big hole for me: I’ve yet to find a USB Type-C hub. I don’t mean something that breaks a Type-C port out into HDMI and Type-A ports and such – I mean something that breaks a Type-C port out into multiple Type-C ports.

      Has anybody encountered such a thing? Is there some reason it’s be difficult to make?

        1. What I have been unable to find is this, but with PD for both the host and at least one device port.

          I want to power my laptop AND my camera, while passing data. Both are PD-capable. I have not found anything that will pass PD power to both a host AND a device.

    3. Can I comment?
      Ethernet cables has two leds for a reason to indicate status of connection … !!! …
      USB lacks a simple LED interface to indicate status of connection. What if cable is bad and has deteriorated or just general bad quality and not performing well? Who is going to call you and tell you hey you USB-C cable is trash it only runs on half speed half electricity throughput.

      Ethernet latency, can it replace Ethernet one day?

      I’d say remove all old USB ports from all new electronics. If you still need to connect an old USB then there are tiny dollar adapter you can put in between

      1. I’m with you. I’ve used bad USB3 cables before – not C but still – which worked fine for an external HDD dock, but would then fail after about 10 minutes or so of transfer. Was worried the hardware was failing but didn’t occur to me to try a new cable until a few days after. Dmesg showed generic I/O errors so it was all guesswork.

        And yeah I loved the idea of USB-C being on every device and using the same cables in either direction. Recently got a new keyboard which had a USB-C socket on it rather than a hard-wired cable to USB-A which was nice, but getting a motherboard or laptop dock/hub with mostly USB-C plugs and either none or few USB-A’s seems rare still.

  1. Interesting. I’m in an industry that’s still has a big focus on RS-232 and CAN and rarely get to dig into some of these more modern interfaces except for whims on my own time. I always like these writeups HAD has on this kind of thing. Looking forward to the follow-up

  2. Heh… It seems like a friggin nightmare.
    If I connect my phone via C to my laptop via C, how can I know/predict/assure which is the host and which is the device? Which will try to power which?
    If I buy a dock with a PD port and plug it into a laptop, does that mean it passes through power out for charging my tablet, or that it allows power in for charging the laptop? If it allows both, then how do I assure the direction I’m going for?
    This list is endless. I’ve only got one C device, and a USB3 device with a C adapter, and I can’t even figure out how to put a friggin hub inbetween for a few extra USB3 ports. Which is not helped at all by the “quality” of such products available and their poor documentation.

    1. From my experience with Macbooks & Samsung S8, mostly the phone gets charged but very occasionally the phone charges the laptop, so it’s not perfect but seems to get it right most of the time.

      1. I connected my wife’s phone to my phone through USB-C and my phone opens a pop-up asking if I want to provide charge or not.

        My wife is kind of reticent about doing potentially destructive experiments, so I’ve never tried to configure both phones to provide power.

    2. At least in android there’s a setting notification that pops up when you plug the phone into a computer or other device which allows you to manually select the power delivery behavior. By default my phone will charge off the connected device and allow file transfer.

        1. That’s not true, actually! USB PD has a Get_Battery_Status message, which the other device responds to with a Battery_Status message, containing, amongst other information, the battery’s charge level in dWh.

        2. It doesn’t make sense to have *automatic* functionality like that – that’s totally a user-dependent thing. Do you want a laptop trying to suck power from wireless earbuds? The earbuds would drain to the laptop’s charge level every time. Even if you said “OK, oops, always transfer from higher absolute charge, rather than percentages” it’s the same problem – now if you’ve got a 3000 mAh device it wouldn’t be able to dump charge to a 10,000 mAh device even if one’s full and the other’s half empty.

          There are plenty of USB type-C controllers that have an input that disables source mode so that you can programmatically disable charging devices when the battery is low. Some even have programmable battery thresholds so that it doesn’t even require any smarts.

    3. > phone plus laptop

      Your laptop is likely unable to be a device, so, your phone will take that role. Power… There’s no guarantee =D It’s interesting, yes. I’ll mention that in an upcoming article!

      > dock with a PD port

      I’d bet that’s the port to connect your charger – I’ve never seen extra ports on docks being dedicated to powering other devices specifically – with like, >5V capability or something (as opposed to the usual power+data ports on docks, which typically have 5V out and high-speed data lanes and stuff). If your dock has other USB-C ports that are not marked “PD”, i.e. some power+data USB-C port, you can use these for 5V charging – that’s the rule. Also, read the dock’s manual, of course – those tend to specify things fairly well.

      > how to put a hub inbetween for a few extra USB3 ports.

      In between what specifically?

    4. Normally the Android phone pops up a notification asking in which mode you want to work.

      In the case of the PD, Charger, etc, there is the CC pin with which both devices negotiate the mode.

  3. I’m on a train now, so no replies yet, but – something I forgot to add in the end of the article!

    A ~week ago, I asked people on Twitter and Mastodon about their USB-C horror stories, and if “how USB-C goes wrong” is of interest to you, you can check the replies out – there’s plenty fun stuff on both platforms! Plus, of course, it’s a bit of a sneak peek into “what will be covered in next installments”, though, there’ll be way more than just USB-C sins, of course.

  4. The powers that be who devised USB are idiots. There is no way to optionally lock the connector in. Also, they gave no forethought about current levels, so there are already several different different high-current standards planned.

    1. I’ve never had issues with USB-C retention in a port that wasn’t super linty, and I fixed that port easily with a wooden toothpick. I, personally, prefer that to thumbscrews or a clunky tab pad like on some displayport or RJ45. I can see the appeal of positive retention, and to each their own, but I don’t think it’s fair to point the lack thereof out as a mistake, especially when the typical considers such a feature more of a hindrance.

      I’m also not sure why you say they gave no forethought to current levels. Their newer EPR mode uses the same 5A max that they originally specced, they’re just allowing higher and higher voltages. Copper and especially contacts can only carry so much current. Given that EPR can deliver up to 240W with no (significant) change to the physical standard, I’d say they considered current plenty well.

      I do think much of what the USB coalition decides is inane, but the things I dislike are branding/labeling, constant renaming, and often near-impossibility of knowing for sure which feature subset a USB-C cable/device is actually capable of. The two things you mentioned are things I actually find to be extremely well done.

      1. “I can see the appeal of positive retention,”

        So can USB-IF. Which is why they came up with a USB Type C locking spec 6 years ago, just a few years after Type C first got introduced.

        Google Type C locking connector cable. They’re readily available. And it’s a smart spec, too, with both a 2-sided screw version and a 1-sided screw version.

        The 1-sided screw version means you can abuse the Type-C spec because you can force orientation. So if you ever need a cable between custom boards with 4 high quality differential pairs, 1 medium-quality pair (like, for a clock), 4 GPIOs, and hefty current capability, there you go!

        1. Interesting, I’d never seen that! I’ve gotta say, that one-sided option makes me uncomfortable. I’m sure they’ve thought it through and it’s fine, but my gut’s telling me it would torque that connector about its thin axis.

          1. The risk is actually forcing the connector past fully-mated, which is present for both the one-sided or two-sided, actually.

            And yeah, that’s called out directly in the spec as well: you need to make sure the screw can’t tighten past that point.

    2. You can most certainly get USB connectors with twist lock housings, also they most certainly gave forethought to higher current levels, as you observe they are accommodated by backward compatible extensions.

  5. Shouldn’t people have been paying attention to the USB C spec when it was just a spec, and spoken out before years have gone by? It seems much too late to be complaining about something that’s already baked into billions of devices.

    1. That’s one thing that would be good if it were to happen more, but it doesn’t preclude anyone from speaking out after they’ve seen an implementation and worked with it for some time. Both implementation and mis-implementations of USB-C disappoint people, and they are not wrong for being disappointed. Of course, complaints don’t fully negate everything USB-C stands for, not anywhere near that, but it’s good if we go through them and figure out what’s up.

    2. The complaining is irrelevant, and they’ll complain about any standard that is issued, and they’ll complain the same if no standard is issued. Maybe internet commenters have complain-only interfaces.

      But it doesn’t matter; people who want to do something with USB-C, be they hackers or engineers, are not hindered in any way by the complaining. And it is easy enough to find an IC to work with that does what you want.

      Sure, there are issues with cable compatibility; but the main issue has to do with buying the cheapest cable possible for a use case. Which is more of a shopping issue than a spec issue, as the cheap cable manufacturers already don’t follow specs. If they make it work for the most common use case, they’ll just lie about meeting the spec. There is not really any solution to this for all-in-one connector formats, which is what people wanted.

      It is never too late or too early to complain, because complaints don’t weigh anything.

    3. Hard to speak out about it early when much of the time the new spec is already being baked into products before its officially released as a spec. Not sure if that has happened with USB-c stuff, but it certainly has in other areas.

      So when only the industry insider companies, who likely championed their own little bits of the standard are able to pay attention, you end up with a mess..

  6. USB-C is one of the most exciting things in tech right now. I’m surprised we don’t see a lot more unofficial alternate modes.

    There’s only one real major complaint I have. The removal of the 12v PD voltage. So many legacy 12v devices can’t be used with the standard until we get 12v PPS to 2.1 adapters.

    Luckily more and more manufacturers are doing the sane thing and powering their stuff directly from USB.

  7. (Did you mean USB-A, not USB-B? B is usually referred to as the printer port.)

    I’d like to see a list of tools (hardware and/or apps) that can enumerate and potentially test/verify the standards supported by each USB device and cable. Most of the devices I see advertised seem to only support reporting power, so I have no idea if something should support Thunderbolt, DP, PCIe, different flavors of PD, proprietary power protocols, faster speeds or higher power than my “tester” (smartphone or laptop” will accept, etc.

  8. What I find sad is half the contact area in the space of what is the same width. Metal fleas would be bigger than the contacts in a C cable/port! Half as much reliability, all for the convenience of not having to orient it one way.

  9. I just want a way of hooking up a USB OTG to my android phone that also allows it to charge.

    That’s all,

    You figure by now they’d have that figured out… and, no, forget about the wireless charger option.

  10. The biggest problem I have had with USB-C is that on a mobile phone you get a build up of lint around the connector to the point that the cable will not charge the phone. I’ve had this happen twice and it ends up that you need to carefully position the cable and ensure it is not moved to charge. This is even after trying to remove as much debris as possible. It seems that the design is uniquely designed to pick up dirt if you carry your phone in your pocket, and was not a problem I encountered with micro-usb

    However it does raise another question. Who actually uses the data transfer properties of USB-C on a phone anymore? With wifi/bluetooth etc it feels that phones have a very expensive power adapter with various failure modes. This is before we start looking at the security of implications of combining your power delivery with your data delivery

    1. I’m not sure I’ve ever had trouble with lint. Maybe pull pockets out before washing?

      I have had trouble with broken USB micro, at least once. Not USB-C.

      I use my Smartphone for data transfer fairly regularly; not all computers have Bluetooth or have it turned on (and it’s not my mine to turn it on).

  11. Thanks for this – a practical guide to a horrifically complicated spec designed by committee.

    I have already found some of my cheap USB-C cables have either failed in odd ways (charge OK but no data) or just misbehave randomly, I guess those fiddly little pins are a tough ask for the knock-offs.

  12. USB-C is absolutely awesome. I made a mechanical keyboard that I sold on Kickstarter that useb USB-C as the upstream USB port. This was neat because you can plug the keyboard into a phone that supports USB-OTG and have a full size keyboard on your phone. I also put a USB hub into the keyboard. This means no fumbling behind your workstation for a USB port to plug in your USB drive, and you can also plug in a USB mouse and USB drive to your phone! The key is the very hacker friendly USB 2.0 hub IC, SL2.1C by CoreChips. The design is open source on my website:

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.