Profile cover photo
Profile photo
Wei Liang Tan
Wei Liang's interests
View all
Wei Liang's posts

Post has shared content

Post has shared content
USB Type C’s Configuration Channel

I’ve been getting questions about why certain kinds of USB adapters or cables work to charge new Type-C devices, and why other adapters are necessary to charge legacy devices from Type-C chargers.

This post will explain why, and will do a deeper dive into Type-C’s Configuration Channel (CC).

USB Type-A and Type-B
But first, I will start out with a description of how USB worked before Type-C so that we all understand some of the basic concepts.

USB cables are directional, meaning that each end of a cable has physically different plug: Type-A plug (the rectangular port and plug we find on our PCs, hubs, and chargers), and a Type-B plug (the squareish plug, or the smaller mini-B and much more common micro-B variants).

USB systems always form a tree based structure with a single USB host at the root (typically your PC), and one or more devices as leaves. USB was designed this way for simplicity. Hubs always have exactly one Type-B port and one or more Type-A ports. Devices by definition only have one Type-B port. Type-A plugs always plug into something that is closer to the root, or in other words Type-A plugs point “upstream.” Type-B plugs always plug into something that is further away from the root, or in other words Type-B plugs point “downstream.”

This architecture prevents problematic loops that are possible with other systems that have the non-directional cables, for example, Ethernet. A user simply cannot set up an incorrect USB tree by virtue of the physically different plugs and connectors.

Enter Type-C and CC
Type-C does not just replace one of the two classic USB connectors. It replaces both A and B types, making completely symmetrical and reversible Type-C cables possible. This does beg the question though: Does this mean that since the connectors and the plugs are physically identical that the tree structure of USB is no longer enforced?

The answer is no. USB Type-C systems still maintain the same tree structure as before with one USB host and one or many USB devices. Instead of a physically different connector and plug to signify the direction of data and power, USB Type-C devices now indicate their roles electrically through a brand new mechanism: the Configuration Channel or CC.

Each USB Type-C port has 2 CC pins, oriented in such a way that when you flip the cable over the the CC pins in the cable plug always land on one of the two CC pins.

The new USB specification defines a new set of terminology to represent different ports, now that both types of ports are now share the same formfactor:
* “Type-A” ports become Downstream Facing Ports (DFP)
* “Type-B” ports become Upstream Facing Ports (UFP)

A resistor is placed on CC to mark whether a Type-C port is a DFP or a UFP:
* DFP uses an Rp, or a pull-up resistor between CC and Vbus
* UFP uses an Rd, or a pull-down resistor between CC and Gnd

When a DFP (usb host) is connected to a UFP (usb device) by means of a cable, the CC on both sides are connected together, and the shared CC line has both a pull-up and a pull-down on it. Both sides read the voltage on this line and can recognize that a connection has just been made when the voltage becomes a predictable value.

There’s more! The CC lines are also how Type-C implements connector “flip”ability or cable twist. Remember I noted that there are actually 2 CC lines in the Type-C cable that happened to line up such that each CC on the plug side will always line up with a CC in the connector. By monitoring the voltage on both CCs, a host or device can figure out which orientation the cable is in and route the other wires appropriately.

Legacy cables and adapters
CC works great when you have all Type-C cables and ports, but Type-A hosts and Type-B devices will still exist. Type-A and Type-B ports and plugs do not have the new CC line, but what happens when you try to connect a Type-A host or Type-B device to a Type-C host/device?

The cables and adapters themselves must provide the proper CC pullup or pulldown in lieu of the Type-A or Type-B port that is missing the CC pin. Here are the two classes of cables :

* Legacy Host Port Adapter - Standard-A plug or Micro-B receptacle on one end - Requires a 56kΩ pullup from CC to Vbus
* Legacy Device Port Adapter - Micro-B plug, or Standard-A receptacle, or Standard B plug on one end - Requires a 5.1kΩ pulldown from CC to Gnd.

Many people ask me if “OTG” adapters are allowed in USB Type-C, and the answer I always give is that “OTG”, an older USB standard that allowed for devices to swap roles, doesn’t apply to USB Type-C, and that the adapter they are probably looking for is the Legacy Device Port adapter above that goes to a Standard-A receptacle for a USB flash drive, for example.

An example of a Legacy Host Port adapter for sale is this A-to-C cable from Google:
An example of a Legacy Device Port adapter for sale is this A-port-to-C adapter from Google:
So, the Type-C legacy cables that you can buy on the market today have (or at least are supposed to have) the correct resistor such that their roles are always fixed.

*On Legacy Host Port Adapters, power and data always flow toward the Type-C plug.
*On Legacy Device Port Adapters, power and data always flow from the Type-C plug.

This also answers the question that some have asked why they can’t simply chain together a clever series of adapters and non-compliant cables and hope it will charge their phone.

This leads to the topic that I’ve been quite vocal about in my Amazon reviews, which is power. The original USB port provided 500mA at 5V, or 2.5W of power. Ever since USB micro-B became the near universal standard for cell phone and other handheld device charging (thanks, Europe!) there’s been an arms race to increase the power that a USB charger or port can provide over the same wire to a device.

In the past decade, the USB-IF and other 3rd parties (most notably Apple) have responded by creating protocols that allow for chargers to deliver higher currents over the same wire to supported devices. They do this by signaling over USB’s data lines (D+ and D-). Chargers that support USB’s Battery Charging 1.2 specification may support up to 1.5A, while Apple’s protocols allow for 1A, 2A, and 2.4A levels.

With the USB Type-C specification, the requirements are beefed up so that every cable must be able to support 3A, however, that doesn’t mean that 3A is possible in every situation : the charger or power source must still be able to provide it, which is where CC comes in.

Remember before that every DFP (Downstream Facing Port or Host port) must use an Rp to identify itself as a DFP. The USB Type-C specification actually uses different values of resistance of Rp in order to allow the DFP to advertise its supply capabilities:

* Default USB Power - 56kΩ pullup
* 1.5A - 22kΩ pullup
* 3.0A - 10kΩ pullup

The bottom two modes are only allowed on non-legacy USB Type-C ports and cables, and only if the power supply has satisfied the electrical requirements to meet a 1.5A or 3.0A load. Under no circumstances may Legacy cables use 1.5A or 3.0A advertisements.

Legacy cables must use “Default USB Power” which at a minimum, means that it restricts it to 500mA for USB 2.0 or 900mA for USB 3.1. However, “Default USB Power” still allows for the negotiation on USB’s data lines D+ and D- using all of the protocols that would have worked on USB A-to-Micro-B cables, meaning that a Default USB Power legacy cable should be able to provide from 500mA to 2.4A of charging.

The specification allows a Type-C DFP power source to actually modify the Rp value in response to changing conditions.

For example, a 3A charger may be built with two USB Type-C ports. When one device is plugged in, it should advertise to that device a 10kΩ pullup to tell it that it can draw 3A. When a second Type-C device arrives, the charger can change the Rp on the first port to 22kΩ to tell it that it can only draw 1.5A. The second port may also be given a 22kΩ Rp, balancing the loads evenly across both ports.

When one of the devices is detached, the charger could even recognize that it's back down to 1 consumer, and give that port back its 10kΩ pullup, allowing it to draw 3A again.

Conclusion and Much More
USB Type-C’s configuration channel provides a ton of functionality. To summarize :
* Determines role, Host Vs. Device
* Determines when devices are attached to host
* Determines orientation, allowing for Type-C’s “flipability”
* Negotiates up to 3A power between charger and device.

There’s actually MUCH more that CC does, specifically, the configuration channel is integral for USB Power Delivery, a protocol that allows for much more robust, flexible and complex communication between both sides, and for Alternate Mode too…

Just as a preview for next time, CC, PD, and Alt Mode allow for :
 *Negotiated higher voltage and current, up to 20V, 5A for 100W of power
 * Power role switching, so your hub powers your laptop, instead of the other way around
 * Data role switching
 * Alt mode, so you can use your USB cable to display video, or much much more.

See you next time!

#USB   #TypeC   #USBC

Post has attachment
I just backed Mini MicroSD Reader Redux: Type-C, Aluminum, Reversible on @Kickstarter

Post has attachment
I just backed SmartEgg: The Elegant, Simple Universal Remote on @Kickstarter

Post has shared content
Sticky FAQ about Bad #USB   #TypeC   Legacy cables:

Thanks to +Mike Trieu for the suggestion.

Q : Why is a bad 3A resistor a problem?
A: 3A is bad because all of these cables and adapters are legacy host port adapter cable, meaning the other end of the cable is Type-A plug. The Type-A port and the vast majority of the devices that have Type-A ports were never designed to support 3A charging.

The cable lies to the phone by telling the phone it's attached to a pure 3A charging path, like the C-to-C cable to the OEM 3A charger that ships with the Nexus 6P/5X. The phone will attempt to draw 3A, but that may damage the weaker device you have the Type-A end of the cable plugged into.

Q: If I have a 1A or 2A charger, am I safe?
No, if you have a weaker charger, you are actually at MORE risk because your phone/tablet/laptop may not know to stop at the 1A or 2A limit the charger advertises because of the improper identifier in the cable.

Q: Do C to C cables have the same problem?
No. C to C cables do not have the same problem because they are required to be straight pass through and do not have a pullup built into the cable. If the other end of the cable is Type-C, then as long as you plug into a 3A charger (like the one you get with Nexus phones), you will get fast charging in a safe way.

Q: Can you recommend a Type-A charger? Is <insert some random Type-A charger from Amazon> safe? Is it fast?
I cannot review every charger, but as long as you have a safe compliant cable with a 56kΩ resistor, the phone will limit itself to safe levels of charging for Type-A chargers and hubs.

Whether or not a particular charger works best for your phone in terms of charge speed I cannot say definitively. It really depends on a ton of factors, including the protocols your phone and the charger supports. Phones and charger may be able to support up to 2.4A using various proprietary protocols with a safe cable.

Q: Can you recommend a Type-C fast charger?
I like the Google one. 2 Type-C ports, 22.5W total power.

If you want a SUPER deluxe one, get the Pixel 2's charger. It will support up to 60W charging using USB PD. Fast charge your laptop. :)

Q: How can I test the cable myself?
If you have a Chromebook Pixel :

If you have a Nexus 6P/5X phone :

Or use CheckR:

Q: I want to keep my bad cable. Is that OK?
Be very careful what you plug it into. If you must keep it, tag the cable with a label that says "3A bad cable" or something so that in a few years when you forget about this controversy, you don't grab that cable and damage a charger accidentally.

Q: Where can I find the USB spec to read up on this more?

Post has attachment

Post has shared content

Post has shared content
Check your cables. Now waiting for app. 
Checking USB type-c to type-a cable compliance with the Nexus 5X

Install adb
Enable developer options and usb debugging on your Nexus 5X
Connect your phone to your computer with the cable to be tested

adb shell dmesg | grep 'Avail curr from USB'

If you don't have grep, just run

adb shell dmesg

And then just look for the Avail curr line.  There may be more than one entry, but we're looking at the last one which is the most recent.  My results are

[22560.060485] dwc3 f9200000.dwc3: Avail curr from USB = 3000

If you see 3000 then I'm sorry, but you have a non-compliant cable.

If instead you see Avail curr from USB = 500 or possibly 1500 then your cable is good.

Post has shared content

Post has shared content
My team at Google has been very big proponents and innovators of USB Type-C. I've worked on two Pixel products now that use the connector and its related technologies (Power Delivery, Alternate Mode, USB 3.1). It really is an amazing little connector.

However, now that there are more and more Type C products rolling out from Nexus, One+, Nokia, and more, this I have found painfully true : USB Type-C will only be as good as its ecosystem, and more specifically, the worst of its ecosystem.

I have started reviewing USB cables on Amazon because I have gotten fed up with the early cables from 3rd party vendors that so blatantly flaunt the specification and I want to hold them to task.

You may not just get weird behavior from your devices with these bad cables... What some these vendors are doing is downright dangerous.

I've been contemplating setting up a blog where I document bad cables and perhaps give some insights into USB Type C as well.

#USB   #TypeC ,
#Nexus   #ChromebookPixel   #PixelC  

Wait while more posts are being loaded