Ramblings of an aging IT geek
← Ramblings of an aging IT geek
hardware

poking at a usb-c charger until it gave me 20 volts

What I learned probing the USB Power Delivery negotiation on a cheap GaN charger, and why CC line resistors matter more than the wattage printed on the case.

A soldering iron and circuit board on a bench

I had a small problem and a cheap charger, which is how most of my evenings start. The problem: a board I'm building wants 12V at a couple of amps, and I'd rather not carry a separate brick when every other thing I own charges over USB-C. The question was simple. Could I ask a bog-standard 65W GaN charger for 12V politely, and would it say yes?

USB Power Delivery isn't magic, but it does have layers. The bit people forget is that before any of the clever digital negotiation happens, there's a purely analogue handshake on the CC lines. A source advertises how much current it can give by pulling CC up through a specific resistor: 56kΩ means "default, 500mA-ish", 22kΩ means 1.5A, 10kΩ means 3A. A sink pulls down through 5.1kΩ. Get that resistor wrong, or leave CC floating, and the charger sits there at a sullen 5V and refuses to talk. I lost an hour to exactly that before I bothered to read the spec properly.

Once CC is resolved, the source sends a stream of BMC-encoded packets on the same line listing its Power Data Objects: the fixed voltages it can do. My charger offered 5V, 9V, 15V and 20V. Notably not 12V, which is the voltage half the world's gadgets actually want, and a recurring annoyance with PD before PPS became common.

A close-up of a populated circuit board

To see the negotiation I put a cheap USB-C breakout and a logic analyser on the CC line. The traffic is slow enough that a basic sigrok setup catches it fine. You see the Source_Capabilities message go out, then your Request, then an Accept and a PS_RDY once the supply has ramped. It's a tidy little state machine, and watching it complete is far more satisfying than it has any right to be.

For the actual board I cheated, because the honest answer to "should you bit-bang a PD stack" is "no, not for one project". I used a dedicated trigger IC, one of the cheap ones that you configure with a couple of resistors or over I2C to demand a fixed voltage. Set it for 15V, fed that through a buck converter down to my 12V, and the charger handed it over without complaint. The whole sink side is two parts and costs less than a coffee.

CC pull-down (sink):     5.1kΩ
Trigger IC request:      15V fixed PDO
Buck output:             12.0V @ 2A
Charger response:        Accept -> PS_RDY

A few things I'd tell my earlier-this-evening self. Measure CC before you suspect anything else; a floating or mis-resistored CC line explains most "it only does 5V" mysteries. Don't trust the wattage on the case to tell you which voltages are on offer, read the PDOs. And if you genuinely need 12V, look for a charger that advertises PPS, because then you can ask for almost any voltage you like and skip the buck entirely.

It's a good protocol. Slightly over-engineered, the way the best standards are, and once you've watched the handshake go past on a scope it stops being a black box. Which, for something this ubiquitous, feels overdue.