1.. zephyr:code-sample:: usb-c-source 2 :name: Basic USB-C Source 3 :relevant-api: _usbc_device_api 4 5 Implement a USB-C Power Delivery application in the form of a USB-C Source. 6 7Overview 8******** 9 10This example demonstrates how to create a USB-C Power Delivery application 11using the USB-C subsystem. The application implements a USB-C Source device. 12 13After a USB-C Sink device is plugged into the USB-C Source device, it 14negotiates with the Source device to provide 5V at 100mA, 9V at 100mA, 15or 15V at 100mA and the Requested Data Object (RDO) provided by the Source 16is displayed. 17 18.. _usb-c-source-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 ``stm32g081b_eval``. 25An overlay file is provided. 26 27Building and Running 28******************** 29 30Build and flash as follows, changing ``stm32g081b_eval`` for your board: 31 32.. zephyr-app-commands:: 33 :zephyr-app: samples/subsys/usb_c/source 34 :board: stm32g081b_eval 35 :goals: build flash 36 :compact: 37 38Connect a sink device and see console output: 39 40Sample Output 41============= 42 43.. code-block:: console 44 45 PRL_TX_SUSPEND 46 PRL_HR_SUSPEND 47 PE_SUSPEND 48 UnattachedWait.SRC 49 Unattached.SRC 50 AttachWait.SRC 51 Attached.SRC 52 PE_SRC_Startup 53 PRL_INIT 54 PRL_HR_Wait_for_Request 55 PRL_Tx_PHY_Layer_Reset 56 PRL_Tx_Wait_for_Message_Request 57 PE_SRC_Send_Capabilities 58 PRL_Tx_Wait_for_PHY_response 59 PRL_Tx_Wait_for_Message_Request 60 PE_SRC_Discover 61 PE_SRC_Send_Capabilities 62 PRL_Tx_Wait_for_PHY_response 63 RECV 1042/1 64 [0]1300280a 65 PRL_Tx_Wait_for_Message_Request 66 PE_SRC_Negotiate_Capability 67 PE_SRC_Transition_Supply 68 PRL_Tx_Wait_for_PHY_response 69 RECV 0441/0 70 PRL_Tx_Wait_for_Message_Request 71 PE_SRC_Ready 72 PRL_Tx_Wait_for_PHY_response 73 RECV 0641/0 74 PRL_Tx_Wait_for_Message_Request 75 REQUEST RDO: 1300280a 76 Object Position: 1 77 Giveback: 0 78 Capability Mismatch: 0 79 USB Comm Capable: 1 80 No USB Suspend: 1 81 Unchunk Ext MSG Support: 0 82 Operating Current: 100 mA 83 Min Operating Current: 100 mA 84