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

17 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
  10. Jonathan

    Hi!

    Sorry for being a total jackass here but could you please assist me with something that I can’t figure out?

    If I want to convert a micro USB port to USB C ( for a DIY project of mine).
    How should i wire it up to be able to use the USB 2.0 device both with a USB type A (Master) > USB-C (Slave) and USB C (Master) > USB C (Slave)?

    In other words, I want it to be compatible with both my desktop PC (USB A) and my laptop (USB C).

    Kind regards,
    Jonathan

    Reply
    1. Tyler Post author

      Hi Jonathan

      You will want to have a type C receptacle on your device with the two pull down resistors. See the “Type-C as a 2.0 device with a type-C receptacle” section for a schematic and details.
      You can then use an A-C cable when using it with your desktop and a C-C cable when using with your laptop.

      Hope that helps
      Tyler

      Reply
  11. Alex Lomis

    Hi, I’m having some issues when I follow the instructions for “Type-C as a 2.0 device with a type-C receptacle.” I’ve wired it up how the schematic shows (using 4.7kOhm resistors instead of 5.1k), yet when I plug it in to windows 10 I get an error saying “the last USB device you plugged into this computer malfunctioned…”

    I’ve checked my wiring many times, and still have had no luck with getting it to work. I’m trying to put a USB C connector an an Arduino Nano.

    Any help would be greatly appreciated!
    -Alex

    Reply
    1. Tyler Post author

      Hi Alex

      I have had that error a few times on windows, I have seen it when there is a connection problem with the USB data lines or configuration on the microcontroler such as a bad USB descriptor.

      Some things that you could help in debugging it.
      Check for signal continuity through the connector and that the data lines aren’t shorted to anything else (the C connectors are quite fine pitch so this can happen fairly easily) I tend to use a USb breakout on the end of a cable for testing but you can get a multimeter probe into a USB A connector if you don’t have a breakout to hand.
      Try using a USB 2.0 A-C cable if you are using a C-C cable as this will allow you to check if the basic USB functionality is the issue or if it is a problem with the type C detection or the usb 3 pins.
      In the case of USB descriptor problems I have found the linux lsusb command or the USBView utility from Microsoft to be useful in checking if it is a low level signal problem or a problem with the device firmware, usually devices with signal problems wont enumerate atall.
      I hope that is useful in getting it fixed.

      Tyler

      Reply

Leave a Reply

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