OverviewThis page describes a USB-PD sniffing dongle with Type-C connectors. The dongle can be supported by Chrome devices as part of a USB-Type C implementation.
Hardware Capabilities
Firmware Source CodeThe firmware is located In the Chromium Embedded Controller repository under board/twinkie/, the release version is on the firmware-twinkie-9628.B branch :
Building FirmwareWithin your Chromium OS chroot, the syntax is:
For the impatient, here is a very cut-down version of the detailed instructions. If anything here gives you trouble, refer to the official documentation instead. Install the prerequisite toolsgoobuntu$ sudo apt-get install git-core gitk git-gui subversion curl goobuntu$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git goobuntu$ export PATH=$(pwd)/depot_tools:$PATH Check out the sourcesgoobuntu$ mkdir chromiumos && cd chromiumos goobuntu$ repo init -u https://chromium.googlesource.com/chromiumos/manifest.git \ --repo-url https://chromium.googlesource.com/external/repo.git \ -g minilayout -b firmware-twinkie-9628.B goobuntu$ repo sync Enter the chrootgoobuntu$ cros_sdk Install the board-specific compiler toolchainchroot$ ./setup_board --board=falco Check out the EC sourceschroot$ cros_workon-falco start chromeos-ec chroot$ repo sync ../platform/ec Build thingschroot$ cd ../platform/ec chroot$ make BOARD=twinkie -j Alternately, you can use the pre-built firmware twinkie_v1.11.19-9e81762f2.bin attached at the bottom of this page.
Flashing FirmwareThe USB-PD dongle behaves as a USB DFU device when the ID pin is grounded on the USB micro-B connector.
This is done either by plugging an A-A USB cable into an A-to-microB OTG adapter as shown in the photo below or by typing the
dfu command on the USB console (if you already have a recent firmware, e.g. v1.11.19+).Within your Chromium OS chroot:
./util/flash_ec --board=twinkie or on Ubuntu Linux:
sudo dfu-util -a 0 -s 0x08000000 -D twinkie_v1.11.19-9e81762f2.bin if you have entered the DFU mode by using the dfu console command, you need to use the following command to exit it : sudo dfu-util -a 0 -s 0x08000000:force:unprotect -D twinkie_v1.11.19-9e81762f2.bin else plugging the regular USB cable will do it automatically.
Using the Integrated Command Line over USBThe USB-PD dongle exports its internal command-line console as a pair of USB bulk endpoints. On a Linux system, you get the console as a /dev/ttyUSBn device. On recent systems (kernel v3.19+), this ttyUSB device should be instantiated automatically, or other systems you can try using the usbserial kernel module :
echo '18d1 500A' | sudo tee /sys/bus/usb-serial/drivers/generic/new_id If this fails, you might need to run
sudo modprobe usbserial first.Using as a PD Packet SnifferYou can use the opensource Sigrok framework to acquire and decode USB Power Delivery traces with the USB-PD dongle. You can then use Pulseview to display them. The patches for the Sigrok hardware driver for the dongle is not in the upstream packages yet. The packages below also include the bleeding edge version of Pulseview which has a convenient "Tabular Decoder Output View". If your machine has an x86_64 processor, you can try the following experimental pre-built packages: - for Ubuntu Focal Fossal (20.04 LTS) cd $(mktemp -d) wget https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_20.04/libsigrok4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_20.04/libsigrokcxx4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_20.04/libsigrokdecode4_0.5.3-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_20.04/sigrok-cli_0.7.1-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028 / ubuntu_20.04/pulseview_0.5.0~git20200910 +1acc207a-1_amd64.debsudo dpkg -i *.debsudo apt-get install -f - for Ubuntu Bionic Beaver (18.04 LTS) cd $(mktemp -d) wget https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_18.04/libsigrok4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_18.04/libsigrokcxx4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_18.04/libsigrokdecode4_0.5.3-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_18.04/sigrok-cli_0.7.1-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/ubuntu_18.04 /pulseview_0.5.0~git20200910 +1acc207a-1_amd64.debsudo dpkg -i *.debsudo apt-get install -f - for Debian Buster (stable) or Chrome OS Crostini container cd $(mktemp -d) wget https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/debian-buster/libsigrok4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/debian-buster/libsigrokcxx4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/debian-buster/libsigrokdecode4_0.5.3-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/debian-buster/sigrok-cli_0.7.1-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_ 20201028/debian-buster/pulseview_0.5.0~git20200910 +1acc207a-1_amd64.debsudo dpkg -i *.debsudo apt-get install -f - for Rodete cd $(mktemp -d) wget https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/rodete/libsigrok4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/rodete/libsigrokcxx4_0.5.2-2+twinkie_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/rodete/libsigrokdecode4_0.5.3-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028/rodete/sigrok-cli_0.7.1-1_amd64.deb \ https://storage.googleapis.com/chromeos-vpa/twinkie_20201028 /rodete/pulseview_0.5.0~git20200910 +1acc207a-1_amd64.debsudo dpkg -i *.debsudo apt-get install -f If you want to do a full build from sources of sigrok and pulseview with Twinkie support, now the USB PD protocol decoder is now upstreamed in libsigrokdecode (and sigrok-cli / pulseview are working out-of-the-box). You only need to add the Chromium Twinkie hardware driver in libsigrok : last version of the patch applying on libsigrok-0.5.2 plus the VBUS support Capturing traces with the Sigrok toolsigrok-cli -d chromium-twinkie --continuous -o test.sr Real-time decoding of USB PD packets while capturingsigrok-cli -d chromium-twinkie --continuous -P usb_power_delivery:cc=CC1:fulltext=yes -P usb_power_delivery:cc=CC2:fulltext=yes -A usb_power_delivery=text Add the USB PD decoder from the Decoders menu, then edit the instantiated decoder to select the appropriate CC line. Experimental VBUS analog tracesAs shown on the pictures above, you can try to capture the VBUS analog voltage and current along with the CCx lines traffic. This feature is still experimental and might have negative side effects on your PD packets capture ! Capturing VBUS voltage only and CCx traffic: sigrok-cli -d chromium-twinkie:analog_ channels=1 --continuous -o testvbusV.sr Capturing VBUS voltage and current and CCx traffic: sigrok-cli -d chromium-twinkie:analog_ channels=2 --continuous -o testvbusVA.sr then you can display the .sr files in Pulseview.
Using as a Power Sink
|
Chromium OS >