LUMINA

Breaking USB-C

Thu Jan 20 2022 23:54

While testing I discovered something weird. I was pretty sure everything was connected correctly, but the downstream device would only charge with particular orientations of the cable.

Then I remembered how USB type C cables are wired.

The type-C connector has a pair of pins called CC1 and CC2. They're used for orientation and current sensing.

The way USB-C detects cable orientation is by only connecting one of those through the cable. If CC1 on one end connects to CC1 on the other, it knows the pins match up. If CC1 connects to CC2, they're flipped.

CC1 +--------+ CC1
CC2 +-      -+ CC2
A "straight-through" connection
CC1 +---\   -+ CC1
CC2 +-   \---+ CC2
A "flipped" connection

The problem is that by man-in-the-middling the cable, you've got two potential flips. LUMINA only connects the CC pins straight through. So if cable one is CC1 to CC2, and so is cable 2, there's no connection between CC2 and CC1 in the middle.

CHARGER          LUMINA           DEVICE
CC1 +---\   -+ CC1----CC1 +---\   -+ CC1
CC2 +-   \---+ CC2----CC2 +-   \---+ CC2
Whoops

And you effectively have a broken cable. I've designed a widget that makes USB-C orientation-sensitive.

I don't think there's a solution for this that doesn't involve dynamically reconfiguring the CC connections. There might be chips to do that but I don't even know.

I also learned that you can use LUMINA to make USB configurations that don't work. Like a USB-C to Lightning cable is apparently particular about the current signaling resistors. A device connected with one of those cables won't charge if nothing is connected to CC1/2 on the other end, which might happen if you do USB A to C on one end and USB C to Lightning on the other.

(Except if the device is dead! A dead iDevice will gladly accept power even without the sense resistors, but it limits itself to 500mA. A broken USB-C charger or cable might put you in the frustrating situation where it will charge enough to boot your phone only to have it stop and then immediately shut off.)

USB-C extension cables (M-to-F) exist and I wondered how they avoid this problem. I found this review and many similar ones on Amazon.

So I tested this on my wife's MacBook pro thinking it might be a M1 issue. Of course it worked on hers. I disconnected everything again and hooked it back up to the iMac and it worked. So I removed the Apple adapter from the usb-c extension cable and routed everything the the way I wanted it and tested it again; it didn't work. I was puzzled. I decided to try just disconnecting the adapter from the usb extension cable and flipping it and reconnecting it. It now works! I tried this multiple times and it will only work when plugged in a certain way. So if it doesn't work for you, whatever you are trying to extend with this cable, try flipping it over.

It looks like they don't solve it, though this did seem to be specifically a problem with USB 2.0 communication. Maybe USB 3 doesn't use the CC pins. Anyway, I'm clearly not alone on this problem.