Plugable USB 3.1 Type-C Power Delivery Sniffer User Guide
The Plugable USB 3.1 Type-C Power Delivery Sniffer (hereafter USBC-TKEY or just TKEY for short) is a product based on Google’s open design of the ‘twinkie’ device (https://www.chromium.org/chromium-os/twinkie) and can be used to sniff USB Power Delivery data packets between a USB Type-C host and Type-C power supply using an Ubuntu Linux 14.04.2 system. This guide will provide a walk-through of this process as well as some advanced features.
In your product package you should have received the following items:
1 Qty. USB 2.0 OTG Micro-B to Female A Cable
1 Qty. USB 2.0 Male A to Male A Cable
1 Qty. USB 2.0 Micro-B to Male A Cable
1 Qty. USBC-TKEY
Using TKEY as a PD sniffer
To start capturing USB PD packets, we will just be using the TKEY and the USB 2.0 to Micro-B cable. Connect the TKEY between a Type-C host and Type-C power supply. Then connect the Micro-B USB cable to your Ubuntu 14.04.2 system. An example of this setup using a USB Type-C MacBook is shown below:
The Sigrok framework (http://sigrok.org/) is used to capture and decode USB PD packets while PluseView (http://sigrok.org/wiki/PulseView) can be used to view them. To install this software on your Ubuntu 14.04.2 system:
1. Download the chromium-sigrok.list file from here → https://www.chromium.org/chromium-os/twinkie/chromium-sigrok.list?attredirects=0&d=1 and then copy it to your /etc/apt/sources.list.d directory. This will update the apt-get sources list of your system to include the sigrok and pulseview packages.
2. Update the apt-get cache and install sigrok by entering the following commands:
sudo apt-get update sudo apt-get install sigrok
3. To start the trace capture, enter:
sudo sigrok-cli -d chromium-twinkie --continuous -o captured.sr
4. Once the capture is started, connect your power source to the USBC-TKEY. If the power source was already plugged in, disconnect it for a moment and then reconnect it. This will capture the traces and save them to a file called captured.sr.
5. To stop the capture press CTRL+C
6. To view and decode the captured traces file with pulseview enter:
pulseview captured.sr &
PulseView will now open and display the captured trace. The results should look similar to the following:
You should be able to see the signal waveform on either CC1 or CC2 depending on the cable orientation. In the example above, the PD packet are being sent using CC1. If you zoom in, you can see the actual binary signal waveform captured. USB Type-C cables use an encoding called BMC (By-Phase Mark Coding) to encode the packets sent on the CC lines. To decode the signal, you’ll need to add a BMC decoder to your signal as shown in the example below:
Then you need to choose the CC channel on which the packets were being sent by:
The Stack Decoder then needs to be specified. The usb_pd_packet should be chosen from the Stack Decoder drop menu:
And that’s it! Along with the basic binary waveform, you’ll be able to view the packet symbols, parts, payload and even the packet type.
To learn more about the command line features and how to flash the firmware, please continue on to our advanced guide here -> https://plugable.com/products/advanced-features-of-the-usbc-tkey