1.. zephyr:code-sample:: usb-c-sink 2 :name: Basic USB-C Sink 3 :relevant-api: _usbc_device_api 4 5 Implement a USB-C Power Delivery application in the form of a USB-C Sink. 6 7Overview 8******** 9 10This example demonstrates how to create a USB-C Power Delivery application and 11how to generate USB VIF policies in XML format using the USB-C subsystem. The 12application implements a USB-C Sink device. 13 14After the USB-C Sink device is plugged into a Power Delivery charger, it 15negotiates with the charger to provide 5V@100mA and displays all 16Power Delivery Objects (PDOs) provided by the charger. 17 18.. _usb-c-sink-sample-requirements: 19 20Requirements 21************ 22The TCPC device used by the sample is specified in the devicetree 23node that's compatible with ``usb-c-connector``. 24The sample has been tested on :ref:`b_g474e_dpow1_board` and 25:ref:`stm32g081b_eval_board`. Overlay files for the two boards 26are provided. 27 28Building and Running 29******************** 30 31Build and flash as follows, changing ``b_g474e_dpow1`` for your board: 32 33.. zephyr-app-commands:: 34 :zephyr-app: samples/subsys/usb_c/sink 35 :board: b_g474e_dpow1 36 :goals: build flash 37 :compact: 38 39Connect a charger and see console output: 40 41Sample Output 42============= 43 44.. code-block:: console 45 46 Unattached.SNK 47 AttachWait.SNK 48 Attached.SNK 49 PE_SNK_Startup 50 PRL_INIT 51 PRL_HR_Wait_for_Request 52 PRL_Tx_PHY_Layer_Reset 53 PRL_Tx_Wait_for_Message_Request 54 PE_SNK_Discovery 55 PE_SNK_Wait_For_Capabilities 56 RECV 4161/4 [0]0a01912c [1]0002d12c [2]0004b12c [3]000640e1 57 PE_SNK_Evaluate_Capability 58 PE_SNK_Select_Capability 59 PRL_Tx_Wait_for_PHY_response 60 PWR 3A0 61 62 RECV 0363/0 63 PRL_Tx_Wait_for_Message_Request 64 PE_SNK_Transition_Sink 65 RECV 0566/0 66 Source Caps: 67 PDO 0: 68 Type: FIXED 69 Current: 3000 70 Voltage: 5000 71 Peak Current: 0 72 Uchunked Support: 0 73 Dual Role Data: 1 74 USB Comms: 0 75 Unconstrained Pwr: 1 76 USB Susspend: 0 77 Dual Role Power: 0 78 PDO 1: 79 Type: FIXED 80 Current: 3000 81 Voltage: 9000 82 Peak Current: 0 83 Uchunked Support: 0 84 Dual Role Data: 0 85 USB Comms: 0 86 Unconstrained Pwr: 0 87 USB Susspend: 0 88 Dual Role Power: 0 89 PDO 2: 90 Type: FIXED 91 Current: 3000 92 Voltage: 15000 93 Peak Current: 0 94 Uchunked Support: 0 95 Dual Role Data: 0 96 USB Comms: 0 97 Unconstrained Pwr: 0 98 USB Susspend: 0 99 Dual Role Power: 0 100 PDO 3: 101 Type: FIXED 102 Current: 2250 103 Voltage: 20000 104 Peak Current: 0 105 Uchunked Support: 0 106 Dual Role Data: 0 107 USB Comms: 0 108 Unconstrained Pwr: 0 109 USB Susspend: 0 110 Dual Role Power: 0 111 PE_SNK_Ready 112