May 19, 2024
All About USB
USB-C eliminates proprietary barrel plug chargers that we’ve been using for laptops and myriads of other devices. It fights proprietary phone charger standards by explicitly making them non-compliant,
USB-C eliminates proprietary barrel plug chargers that we’ve been using for laptops and myriads of other devices. It fights proprietary phone charger standards by explicitly making them non-compliant, bullying companies into making their devices work with widely available chargers. As a hobbyist, you no longer need to push 3 A through tiny MicroUSB connectors and underspecced cables to power a current-hungry Pi 4. Today, all you need is a USB-C socket with two resistors – or a somewhat special chip in case the resistors don’t quite get you where you want to be.
You get way more bang for your buck with USB-C. This applies to power too; after all, not all devices will subsist on 15 W – some will want more. If 15 W isn’t enough for your device, let’s see how we can get you beyond.
USB-C power supplies always support 5 V and some are limited to that, but support for higher voltages is where it’s at. The usual voltage steps of USB-C are 5 V, 9 V, 15 V and 20 V ; 12V support is optional and is more of a convention. These steps are referred to as SPR, and EPR adds 28 V, 36 V and 48 V steps into the mix – for up to 240 W; necessitating new cables, but being fully backwards and forwards compatible, and fully safe to use due to cable and device checks that USB-C lets you perform.
A charger has to support all steps below its highest step, which means that 20 V-capable chargers also have to support 5 V, 9 V, and 15 V as well – in practice, most of them indeed do, and only some might skip a step or two. You can also get voltages in-between, down to 3.3 V, even, using a PD standard called PPS (or the AVS standard for EPR-range chargers) – it’s not a requirement, but you’ll find that quite a few USB-C PSUs will oblige, and PPS support is usually written on the label.
You can’t get beyond 5 V with just resistors though – you’ll need digital communications over the CC line, using a protocol called USB PD (Power Delivery) – which lets a device and a PSU negotiate power requirements in a featureful way. It’s a constant-baudrate bidirectional protocol, there’s CRC checks, response timing requirements, and it’s used for basically everything USB-C – even high-speed protocol negotiations. Most importantly, USB-C PD is immensely powerful.
There’s a mindboggling amount of communication possible through USB-C, letting us build devices smarter than ever before. It’s thoughtfully designed – the communications are forwards- and backwards-compatible, with new 140 W EPR chargers happily charging old 60 W devices at 60 W rates, and 60 W chargers still usable for slower charging of 140 W-craving devices. USB PD capabilities are way beyond “give me this voltage limited by this current”, too – devices can query each other’s power role preferences, charging states, swap power roles on the fly, determine what a cable is capable of, and do all of that with safety in mind.
If you don’t yet appreciate the complexity, let me walk you through a complex scenario that is made easy by USB-C. Imagine a USB-C dock with a USB3 port, a HDMI port, and a USB-C charger input port. If you connect such a dock to your laptop without plugging a charger into it, the laptop will feed this dock with 5 V, capped at either 1.5 A or 3 A, depending on the laptop. That alone is quite useful when you need HDMI or an extra USB3 port on the go, and some such docks have Ethernet too – hard to pass up on that. All in all, the dock acts as a power sink, and the laptop acts as a power source. The arrangement is turned onto its head, however, when you plug a high-voltage-capable charger into this dock’s charger input port.
The IC inside the dock will detect the charger and act as an intermediary, talking PD with the laptop and the charger, determining each other’s power requirements and capabilities. Say, the laptop’s interested in the 20 V, 3 A that the charger can provide. The intermediary IC will tell the laptop to stop supplying 5 V and prepare to charge from a higher voltage instead, and once the laptop agrees, will tell the charger to ramp up the voltage. Within a second, the system’s changed completely – instead of running on 5 V from the laptop, the dock now passes 20 V from the charger to the laptop through itself, and gets power for its own needs from the same 20 V.
This power role swap is designed to be completed within a small timeframe – your USB3 and HDMI devices won’t experience brownouts, and high-speed communications aren’t interrupted as power role swap happens. 20 V doesn’t get onto the 5 V-only pins, either – the dock has power regulation and gating inside to prevent that. The dock will also work if your laptop or phone doesn’t support video output over USB-C, in which case, everything but the HDMI port will function as intended, and if the laptop doesn’t support charging over USB-C, then charging negotiations will fail in a safe way.
The dock IC knows the power budget for its own USB3 and HDMI ports, and subtracts it from the charger’s power budget before presenting it to the laptop, with the laptop knowing exactly how much current it’s able to consume, and being able to stick to that for powering everything, keeping the charger happy and not overloading it. If the gear used is up to USB-C standards, the user doesn’t have to take any precautions – everything is safe.
Best of all, you can buy a dock like this for just $10 online. All of these features aren’t a fluke or a hack – USB-C is designed to do all of this and much more. As a user, you no longer need to buy a business class laptop to get a fully featured single-cable dock – many consumer-grade laptops and phones with USB-C data and charging chops can handle all things listed above without breaking a sweat.
If you like geeking out about consumer and hacker tech advances, you will find USB-C firmly within the futuristic-technology territory as you get to know it. You deserve to know how all of this works, too – let’s go through the basics of power communications with PD.
Say, you plug a charger into a laptop. The charger provides a pull up on the CC line, the laptop will detect that, and if your laptop is USB-C charging-capable, it will put a pull down onto the CC line. The charger will then provide 5 V, and will get ready to talk PD for anything higher than that. As you can see, before higher voltages are possible, you first have to go the 5 V and analog communications way. Put your 5.1 kΩ resistors onto CC pins, get 5 V, and talk the power supply into giving you a higher voltage from there.
The resistors remain connected during communications – in fact, the combination of the pullup and pulldown resistor has to be present constantly for the charger to keep supplying current, even at voltages way beyond 5 V. The CC line voltage is used so that the PSU can quickly determine when a device has been unplugged, and vice-versa – this helps with safety features like reducing contact arcing at higher voltages when unplugging the cable, and making sure the charger goes out of its higher-voltage modes so that it doesn’t destroy the next device connected – which used to be a failure mode for some very early USB-C chargers.
As a result, the digital signalling is overlaid onto the CC line voltage. You could say that PD a half-digital protocol. This requirement of PD, plus demands like applying VCONN to currently unused pin for checking high-speed or > 3 A cables, make it hard to just wire the CC pins up to a UART peripheral or the like. However, there are microcontrollers with PD peripherals, both of Western and Eastern design, and there’s PD-talking chips you can hook up over I2C if your microcontroller lacks one.
The ability to talk PD is instrumental for making USB-C hacker-accessible. You don’t have to know the PD lingo if high voltage out of a USB-C port is all you need, however.
You can buy a friendly IC to speak PD for you. You might’ve heard of “PD trigger boards” – a small board with a USB-C socket, two pins for voltage output, some solder jumpers if you’re lucky, and an IC with just enough PD vocabulary to convince a power supply it should give us 20 V or 9 V. We’ve seen hackers use PD trigger boards and chips for converting old laptops and higher-powered devices to get power from USB-C power supplies, in situations where the manufacturer most absolutely didn’t intend for that to happen.
There’s a number of trigger ICs around. We’ve seen hackers successfully use IP2721, and recently, exploring ICs like the CH224K. Most of us just buy a small PCB with everything soldered on, however, and don’t fret over the specific ICs; that said, you’ll want to have a few suggestions whenever you set out to design a device with a USB-C port high voltage demands, what’s with surprise out-of-stock events and all.
PD trigger boards are not perfect for everything. Say, you want to power a resistive load of 8 Ω through USB-C – let’s use a PD-capable soldering iron as an example. The tip needs 2.5 A at 20 V, and 1.9 A at 15 V. A 60 W charger can provide 3 A at 20 V and will happily power your load, so you can safely set your trigger board to 20 V with a solder jumper. But then, a 45 W charger can only offer 2.25 A on 20 V, however, and a 8 Ohm load will put it into overcurrent protection mode – you need to use 15 V even though the 20 V mode is available. Trigger board ICs aren’t designed with logic like this in mind – thus, projects like the PD Buddy Sink exist, pairing a PD-talking chip with a MCU that can handle more complex logic.
In fact, trigger boards don’t tend to give you any current limit information – if there’s risk of overcurrent because the charger cannot provide 3 A at the voltage the trigger board request, you’ll just have to make sure the charger you’re using implements overcurrent protections; those are mandated by USB-C and done by most, that said, you don’t want your device powercycling every few seconds, either. Also, if you want a dual-role port that works with OTG adapters or perhaps can do high-speed lanes, a trigger IC won’t be able to help you, and you can’t just connect multiple PD ICs requesting different functions in parallel to your CC pins. We can try and surpass these limitations in later articles – for now, know that trigger boards have their well-defined place in your USB-C arsenal, and they will help you with your USB-C projects as far as higher voltages are concerned.
What if you have a 20 V barrel jack PSU that you’d like to turn into a USB-C charger? After all, the voltages match. Things aren’t as simple – you can’t just shove 20 V into a USB-C port and expect your laptop to charge. In fact, your laptop might die if you do that – it’s not guaranteed that magic smoke won’t be released; some laptops have protections against that, but I’ve witnessed this arrangement cause magic smoke emissions, and I’d rather not have that happen to you, too. You want to do it properly, and for that, you need to go through the PD negotiation song and dance first, limiting the supplied voltage to 5 V while at it.
There are adapters online that seem to do at least the 5 V and PD parts for you – without the intermediate steps, but hey, you can omit them safely if you know that 20 V is what your device needs. You do also need to make sure that your 20 V is within a reasonable range; sometimes the adapter will check that for you, and sometimes the device won’t mind. There’s also quite a few USB-C PSU designs with DC input, that will have active conversion onboard – so your 12 V, 19 V and 24 V PSUs can be put to good use with USB-C stuff.
There are caveats to USB-C power. One of them is connecting two dual-role ports together – say, a laptop and a powerbank. Both of them are able to either provide power or use power for charging, and with USB-C, they use the same port for both of these functions. As a result, if you want to charge your fancy laptop from your fancy powerbank, you might be surprised to find your laptop charging your powerbank instead – and same might happen if you connect your phone to your laptop. It’s not often that it happens and it seems that some powerbank manufacturers manage to avoid such an arrangement; however, other products might not fare as well.
There are provisions for battery level information exchange in USB-C, but I’d guess they are not utilized or implemented by all. Some devices that expose the USB-C layer controls to users, will show you a menu where you can check – in part, modern phones and Chromebooks do that. Powerbanks with their single-button controls, if they even have a button, might not do that, and many laptops aren’t able to ask anything either, so we’ll just have to wait and see towards an eventual solution for manufacturers to standardize upon.
USB-C also lets you implement digital signing for device validity verification. If you can read between the lines, it smells of DRM, and that’s what it is. Some device manufacturers, especially from the HP/Dell/Lenovo dark triad, will implement DRM that makes their laptop throttle its CPU if the charger or the cable is third-party – even if it’s all the same 100 W. It sort of makes sense when Dell does that in cases where they push 6A through a verified-to-work combination of charger, cable, and laptop. But at this point, let’s be fair, the conscientious choice would’ve been to go for EPR and 140 W instead, and throttling is inexcusable either way.
On the topic of laptops – if you ever try to find a laptop that gives more than 5 V on its USB-C port, I wish you good luck. As far as I’m aware, such laptops do not exist, and you’ll want a charger and a powerbank.
There’s little technical reasons that a switch-mode power supply has to be hard-wired to a certain voltage, and USB-C breaks these chains. Now, you can get 9 V or 20 V at 3 A from a gas station charger and a small cheap board, and you can even charge Li-Ion batteries from a PPS charger. There’s a potential in USB-C capabilities, that we’re only now starting to tap into. As times goes on, proprietary plug and wacky voltage chargers around us will completely die out, and we’ll forget about them, just like we’ve forgotten about all the cellphone data transfer cable standards after MicroUSB took over. How many proprietary data cable ports did Samsung alone create, again?