One of the early adopters of USB Type-C and USB Power Delivery is Google for their Chromium projects. More interestingly Google shared the complete design of the USB Type-C products in public domain right from schematic to source code of the solutions. This article explores how to use USB C-Thru board to explore Google’s designs there by enabling you to develop custom USB Type-C design of your own.
This article enables you to make your own Google USB-PD Sniffer aka “Twinkie” using USB C-Thru and a STM32 development board for just 65$ in 3 steps
Hardware requirements:
[LIST=1]
Step – 1: Preparing software and firmware binary for Google’s USB PD Sniffer
- Google has made its USB Type-C designs public in its Chromium websitehttp://www.chromium.org/chromium-os as shown in Figure 1 below
Figure 1: List of USB Type-C design examples from Chromium website
- In this exercise let us explore “USB Type-C debug dongle and sniffer for USB-PD communications” The USB PD Sniffer tool is known as Twinkie.
- A complete setup guide for Twinkie is available at:http://www.chromium.org/chromium-os/twinkie
- Order a STM32F072 Discovery kit, which is the base platform that Twinkie uses. (http://www.mouser.in/search/ProductDetail.aspx?R=0virtualkey0virtualkeySTM32F072B-DISCO)
- Generate binary file “twinkie.bin” and flash it to the STM32 Discovery kit using the “dfu-utils” host utility as described in Chromium website.
Step – 2: Setting up Hardware STM32F072B-DISCO with USB C-Thru
Having setup the necessary software and flashing the board with firmware, let us explore how to setup the hardware to build a Twinkie.
- Twinkie schematic “810-10114-04_sch.pdf” can be downloaded fromhttp://www.chromium.org/chromium-os/twinkie/chromium-os-twinkie-v2.tar.bz2
- When you analyze the schematic you would find pins PA1 and PA3 are used to sniff the CC data as shown in Figure -2 below:
Figure 2: Schematic of Twinkie indicating CC pins
- Now connect pins PA1(grey), PA3(orange) and ground(black) from the STM32 board to USB C-Thru( PA1 to CC1, PA3 to CC2) as shown in the Figure-3 below:
Figure 3: Schematic of Twinkie indicating CC pins
- This setup gives you a part of the Twinkie design that is sufficient to act as a USB PD sniffer.
Step – 3: Start sniffing USB PD data with homemade sniffer
With USB C-Thru board and STM32 discovery board we have the sniffer ready to get deployed for debugging. In the example setup I am using a laptop with a USB Type-C charger and USB-C Thru based Sniffer connected to my Ubuntu PC.
- Using a USB2.0 mini cable connect the STM32 development board to the host PC in which the Google’s USB PD sniffer software was setup (Step 1). A “lsusb” on the host PC shows the USB PD Sniffer as shown in the Figure-4 below:
Figure 4: Enumeration of STM32 development board as Twinkie device
- Plug USB C-Thru to the laptop and the USB Type-C Charger to the receptacle end of the USB C-Thru as shown in Figure-5 below:
Figure 5: Google’s USB Type-C example design Twinkie implementation usingUSB C-Thru and STM32
Conclusion
This article provided a quick walk through of how to use USB C-Thru board with an existing development kit and make your own USB Type-C example design. You can explore other Chromium USB Type-C design examples in similar manner with few wire wrapped electronics or a breadboard setup.
You can order USB C-Thru ( www.goarks.com ) from https://www.crowdsupply.com/goarks/usb-c-thru and write to us for any clarifications at info@goarks.com
Podcast EP267: The Broad Impact Weebit Nano’s ReRAM is having with Coby Hanoch