USB-C Port – How to Monitor the CC Lines

audiocomparatorusb-c

I need to develop a device which has a USB-C port. This port has two purposes:

  • One can connect a USB charger to charge the battery of the device
  • One can connect USB headphones to listen to some music which is transmitted by the device

I have a bit of trouble understanding how to monitor the CCx lines on the USB-C port. As far as I understand:

  1. In Audio Adapter Accessory Mode, the CC1 and CC2 lines are connected to GND. That would be when the headset is plugged : CC1 = CC2 = 0 V (link, "Audio Adapter Accessory Mode" section)
  2. In USB Power Delivery mode, the CC1 and CC2 lines are pulled up by the charger, and down by the device. According to this link, the Table 3. states that CC1 and CC2 lines need to be pulled down to GND with 5.1 k resistors on the device side. So I integrate these resistors and one of the CC line has a greater voltage than the other : CC1 > CC2 or CC2 > CC1
  3. When nothing is plugged, the CC1 and CC2 lines are pulled down to GND with the 5.1 k resistors. CC1 = CC2 = some mV

Here are my questions:

  • Have I correctly understood the configuration of the CCx lines?
  • If so, what circuit could I use to detect the 3 possibilities? Is it possible and safe to compare the difference between 0 V and some mV?

Best Answer

You need to support:

  • A downstream facing device (both CC lines pulled up, to provide power to downstream devices)
  • A upstream facing device (both lines pulled down, even if your device has an empty battery)

In your understanding, you are forgetting about the downstream facing case, you need to pull up both CC lines to see if an USB C passive audio device is connected. You also need to do the full USB C detection, to prevent powering VBUS if the user connects an active cable to the device.

Since you want a single port to act as both an upstream and a downstream facing device, you need to act as a dual device.

Here is a simplified truth table:

Role CC1 CC2 Actions
Downstream >2.75 >2.75 Switch to upstream facing mode after a small delay, turn VCON off, present 5.1k resistors on CC1 & CC2
Downstream 0.85-2.45 >2.75 Enable downstream power
Downstream <0.85 >2.75 Do nothing
Downstream >2.75 0.85-2.45 Enable downstream power
Downstream 0.85-2.45 0.85-2.45 Enable debug mode if appliable, Enable downstream power
Downstream <0.85 0.85-2.45 Turn on VCON, enable downstream power
Downstream >2.75 <0.85 Do nothing
Downstream 0.85-2.45 <0.85 Turn on VCON, enable downstream power
Downstream <0.85 <0.85 Enable downstream power, enable USB audio support
Upstream <0.25 <0.25 Switch to downstream facing mode after a delay, present 10k/22k/56k resistors on CC1 & CC2
Upstream 0.25-0.66 <0.25 Set max charging current to VUSB
Upstream 0.66-1.23 <0.25 Set max charging current to 1.5A
Upstream 1.23-2.18 <0.25 Set max charging current to 3A
Upstream >2.18 <0.25 Illegal state
Upstream <0.25 0.25-0.66 Set max charging current to VUSB
Upstream <0.25 0.66-1.23 Set max charging current to 1.5A
Upstream <0.25 1.23-2.18 Set max charging current to 3A
Upstream <0.25 >2.18 Illegal state
Upstream 0.25-2.18 0.25-2.18 Go to debug mode if supported, current VUSB
Upstream >2.18 >2.18 Illegal state

A few notes:

  • This is just passive PD communications, it won't allow you t do things like power role changes when connected to a power bank, or request charging at higher voltages)
  • In your application, yo do not require vcon, though it is recommended to include it if you ever update your circuit to connect to any USB C audio adapter, and not only passive ones

(If you would build a circuit like this from simple parts, it would look like this, the cost of the parts would probably be 10 times the cost of dedicated chip)

Note that your circuit should be designed in such a way that if your battery is discharged, it should present a 5.1k resistor on the CC is, so the circuit can start from a dead battery. This likely requires a depletion mode MOSFET or a noisy relay

Using a chip dedicated to the job makes your job easier, an example of such PD chip is the FUSB307B. When your device sis started in dead battery mode, this chip provides a 3.3V power rail, so you can start your micro controller, which then tells the PD controller chip which PD profile it should accept. After this, the chip enables the VBUS rail, so you can charge your battery. This chip also has detection capabilities for USB C passive audio specification, so could do not need to waste CPU cycles detecting this on your own.

Related Topic