Using USB Type-C on hobyist projects

By | March 17, 2016

The new Type-C USB connector is the latest addition to the USB connector standards. It offers reversible plugs, direction independent cables, USB3.1 speeds, and 3A charging in a connector only a little bigger than the USB 2.0 MicroB connector. In order to add these capabilities the plugs and connectors have additional configuration pins to allow devices to negotiate their state. Supporting the configuration channel may seem like a difficult challenge but it can be achieved fairly simply for the basic use cases.

USB_Type-C_breakouts

Type-C as a 2.0 device with a type-C receptacle

In this mode the Type-C device is acting as an UFP (Upstream facing port).
This is the equivalent of devices equipped with either a B, Mini-B or Micro-B socket and majority of hobbyist projects will probably fit into this category.
Luckily this is fairly easy to implement as we can avoid worrying about multiplexing or managing connection states.

The simplest implementation of this is to use two 5.1k pull down resistors on the CC lines.
This allows for detection by other devices when using a USB C-C cable.
The USB 2.0 Data lines can both be connected together at the receptacle as only one pair will be populated in the connector.
The power and ground lines will all want connecting to the appropriate power rails on your board.
The Sideband pins and superspeed pins should be left unconnected in this configuration.

USB_Type-C_schematic

Type-C as a 2.0 device with a type-C plug or captive cable

If you wish to have a device plug directly into a Type-C receptacle this can be done much the same as above with a few small differences.
As the orientation of the plug is fixed at your end only one pull-down configuration resistor (5.1k) will be needed (the one attached to A5). This needs to be the correct cc channel as some devices multiplex the USB2.0 data lines.
In addition only one set of USB 2 data pins should be present in the plug (A6 and A7) so there isn’t a need to connect to both pairs like the previous case.

Using Type-C power on devices

If you want to use Type-C power which provides up to 3A at 5V (note: this is different to the USB Power Delivery capabilities) you will need to monitor the voltages at the CC lines to perform power detection. This can be achieved by either using an ADC or using a IC To manage the CC detection for you. Table 4-25 in the USB Spec covers the voltages that represent the power sources capabilities. note: the capabilities of a host may change while connected so this needs to be monitored throughout the connection.

* less than 0.2v nothing is plugged in/the other CC line is connected.
* between 0.2v and 0.66v only default USB power is available.
* between 0.66v and 1.23v 1.5A USB-C power is available.
* above 1.23v 3A USB-C power is available.

note: there are many out of spec legacy cables available that have the wrong CC pull-up resistor, this leads them to advertising the wrong power capabilities of the charger or host.

Type-C as a 2.0 host or dual role device.

Using Type-C as a DFP (downstream facing port) or a DRP (dual role port) is a bit more complicated than the previous example.
This is because the host needs to detect the connection before connecting VBUS to the device.

While it would be possible to do this yourself there are configuration channel control ICs available to perform this task such as the TUSB320.
These ICs handle the majority of the work for you.
The bits you are left with are turning on VBUS once connection has been established and putting your device into the correct USB mode.
This is often already provided by your controller if it supports USB on-the-go, many configuration ICs have an ID pin that acts like the ID pin on on the go connector for this reason.
Even if you are using the device in host only mode, you will need to enable VBUS only when a connection has been established to prevent two USB devices attempting to provide power at the same time.
An example schematic using the TUSB320 is shown below.

USB 3.1 operation and USB Power Delivery

while USB3.1 superspeed multiplexing and USB power delivery are outside of the scope of this guide there are ICs available which provide these functionalities however they are often in BGA packages which are difficult to work with.

References

13 thoughts on “Using USB Type-C on hobyist projects

  1. Pingback: DIY USB Type C | Hackaday

  2. Pingback: DIY USB Type C | wisdomparliament

  3. Pingback: DIY USB Type C | BH

  4. Pingback: DIY USB Type C - SHelfinger

  5. Pingback: DIY USB Type C - Hackaday - Home Family Insider

  6. Benson Leung

    Hi Tyler!

    Great guide! One quick minor correction I noticed in your description of Type-C UFPs.

    “The simplest implementation of this is to use two 56k pull down resistors on the CC lines.
    This allows for detection by other devices when using a USB C-C cable.”

    The Rd pulldown should be a 5.1kΩ resistor. The schematic looks correct though with a 5K1 resistor. Otherwise, thanks for posting this! It should be invaluable for hobbyists looking to use Type-C in their designs!

    Benson

    Reply
    1. Tyler Post author

      Hi Benson

      Thanks for spotting that, I have updated the article

      Tyler

      Reply
  7. Pingback: Using USB Type-C on hobbyist projects - Electronics-Lab

  8. Bryan McGrew

    Hi! I’m still new at electronics tinkering and would like any help you could give me on USB C. I want to make a custom PiHat that would allow me to add at least one usb type c to my raspberry pi. I’d also like to be able to make my own alternate mode (if possible) that would essentially allow me to access the pi’s gpio. Thank you in advance.

    Reply
    1. Tyler Post author

      Hi Bryan

      I haven’t used any alternate modes myself, Devices discover and setup alternate modes using the USB PD spec which I have yet to play around with.
      There is an open source Google project that implements the display port alternate mode that might be able to help.
      https://www.chromium.org/chromium-os/dingdong

      Tyler

      Reply
  9. Henri Bergius

    Hi! Thanks for posting this!

    Where on the USB 2.0 side should the CC1 and CC2 lines connect? That is a bit unclear from the JP1 representation.

    Trying to use this to add a USB-C plug to a microcontroller.

    Reply
    1. Tyler Post author

      Hi Henri
      If you are just building a usb 2.0 device with a Type-C connector you only need the pull down resistors and don’t need to connect the CC lines to anything else. However you may wish to connect these lines to other circuitry in order to sense if Type C power is available hence why they are connected to JP1 in the breakout board.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *