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