Profile cover photo
Profile photo
G Ragib
G's posts

Post has shared content
Hey all. A quick follow up to my previous post about USB Type-C cables.

Edit : If you have a #nexus6p  or a #nexus5x , follow these instructions from +Geoff Hoff :

That will help identify one class of failing cable (3A case).

+Vincent Palatin and I have some fairly simple instructions on how to test to see if a USB Type-A to Type-C cable, or a USB Type-B receptacle to Type-C adapter is spec compliant.

The both of us are on the Pixel team, so these instructions are only for people who have Chromebook Pixel 2015 laptops.

Put it into dev mode. Plug in the suspect USB cable and plug the other end into a DCP charging wall wart (preferably one you don't have any sort of sentimental attachment to)

From a root shell run this : 

ectool --name=cros_pd usbpdpower 0

Here's a good cable : 
localhost ~ # ectool --name=cros_pd usbpdpower  
Port 0: SNK Charger DCP 4920mV / 2000mA, max 5000mV / 2000mA / 10000mW
Port 1: Disconnected

Here's a bad cable :
localhost ~ # ectool --name=cros_pd usbpdpower
Port 0: SNK Charger Type-C 5147mV / 3000mA, max 5000mV / 3000mA / 15000mW
Port 1: Disconnected

In the bad case, it shows up as Type-C with a 3000mA max, which means the resistor setting is wrong. You'll know when it's using a "Default USB Power" setting because after SNK Charger, you'll see something in this set of possibilities : 

[SDP, CDP, DCP, Proprietary]

If you see Type-C, but the other end of the cable is Type-A, it's a bad cable with 3A pullup.

There are other bad cases too where the CC lines are floating.

Pixel will NOT charge in that case, and you'll see something like this : 
localhost ~ # ectool --name=cros_pd usbpdpower
Port 0: SNK (not charging) Charger DCP 5000mV / 500mA, max 5000mV / 500mA / 2500mW
Port 1: Disconnected

Vincent adds:
To decide whether the CC lines are floating, you can also do this :
ectool --name=cros_pd usbpd 0
("usbpd 0" for the left port, "usbpd 1" for the right port)
it will answer something like this :
Port C1: enabled, connected State:SNK_DISCOVERY
Role:SNK UFP, Polarity: CC1

if your State is "SNK_DISCOVERY" you are good (if you get State:SNK_HARD_RESET_RECOVER you did it too early)
if you get "State:SNK_DISCONNECTED" even with the cable connected, it has no termination on the CC lines.

By the way, if you don't want to put your Pixel 2015 in developer mode to get all those commands,
you can do the following in normal mode :
- plug your cable
- wait for at least 60 seconds
- go to chrome://system
- in the "dmesg" section, the kernel log will show traces like these ones :
[  121.172637] PDLOG 2015/11/04 19:58:18.074 P1 SNK Charger Type-C 5000mV max 5000mV / 3000mA 

#USB   #TypeC   #ChromebookPixel  

Post has shared content
USB C to A cable testing refined - Nexus 5X only
Edit: Now 6P as well
Edit: added descriptions of output values

Short version
adb shell "cat /sys/bus/i2c/drivers/fusb301/*/fclientcur"
Or  from a shell on the phone
cat /sys/bus/i2c/drivers/fusb301/*/fclientcur

If the result is 3000 an A to C cable is non-compliant

Possible values
0 - standard USB charging
1500 - 1.5 amp type C charging
3000 - 3 amp type C charging

It will also report 0 if not plugged in.

adb shell "cat /sys/class/typec/typec_device/current_detect"
Or from a shell on the phone
cat /sys/class/typec/typec_device/current_detect

If the result is 2 an A to C cable is non-compliant

Possible values
0 - standard USB charging
1 - 1.5A type C
2 - 3A type C

The FUSB301 chip is connected directly to the configuration channel pins in the Type-C port on the Nexus 5X and is used determine if the cable is connected, the orientation, and the power level and direction.  The fusb301 driver makes the charge current value available in the file fclientcur in the sys file system.  Because this is as close as it gets to the CC pins in the port, this is the best that can be done from the phone.

Also, because this can be done from the phone, if it is in fact reliable, an app can be built around this.

Looking at the kernel sources for the 6P, it doesn't have the fusb301 driver so it is probably using a different chip. 

The 6P uses a tusb320

Post has shared content
Can Qualcomm QC and USB Type-C coexist on the same connector?
I get this question sometimes, so I wanted to do a quick post to address it.
tl;dr : Type-C Spec forbids it.

Longer explanation:
Qualcomm's QC2.0 and 3.0 use variable voltage on Vbus in order to get more power over the same USB A-to-microB cables. My #Nexus6 , for example, comes with a Motorola Turbo Charger which outputs at 5V, 9V, and 12V. QC 2.0 allows for up to 18W charging over an A-to-microB cable by using the combination 12V * 1.5A.

18W is no slouch, actually, and right now, that's actually 3W more than the 15W that USB Type-C 3A charging can do.

The difference is that Qualcomm's solution is very proprietary, and it takes over the D+/D- (usb data) lines for good, so that Type-A port can't be used to communicate to your PC at the same time you fast charge.

USB Type-C doesn't have that restriction. You can have a hub with a 3A charging port that also hooks up all the data lines as the negotiation is separate from D+/D-.

When the USB-IF got to specifying Type-C, at the same time, considered higher voltages and much more dynamic power requirements as well. That is when the USB Power Delivery was introduced as well. Power Delivery will be able to handle much higher voltages (up to 20V) and higher currents (up to 5A) in a non-proprietary way.

This section of the Type-C specification 4.8.2  calls out chargers and devices that want to use a proprietary charging method and restricts them specifically from modifying Vbus (which is what QC does to get to 9V and 12V), and from altering roles from source to sink.

The idea is to reduce the confusion that could happen because PD does all of these things in an open and non-proprietary way.

If you're looking for an explanation why the Nexus 6P and 5X do not support QC of some kind, it's because of the final line in the section I've screenshotted here.

Also, any USB Type-C charger that purports to support QC2.0 or QC3.0 out of the same Type-C port is also breaking this section of the spec as well.

Hope this has been helpful!

#USB   #TypeC   #USBC   #Nexus6P   #Nexus5X  

Post has attachment

Post has attachment

Post has shared content

Post has attachment
21 Photos - View album

Post has attachment

Post has attachment

Post has attachment
Wait while more posts are being loaded