samples/subsys/usb_c/sink/README.html · samples/subsys/usb_c/sink/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · USB-C

Basic USB-C Sink

Sink attach와 policy-engine 상태부터 source capability 선택까지 추적합니다.

Official pathsamples/subsys/usb_c/sink/README.html
Source filesamples/subsys/usb_c/sink/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

TCPC Devicetree, VIF policy와 네 fixed PDO 해석을 설명합니다.

Role

Power Sink

Request

5 V · 100 mA

Policy

PDO evaluation

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 A6829C8979C442BFBB4A8DFDFF37BADDC6BB415E56D9338821EED04F00A7FAE7
.. zephyr:code-sample:: usb-c-sink
   :name: Basic USB-C Sink
   :relevant-api: _usbc_device_api

   Implement a USB-C Power Delivery application in the form of a USB-C Sink.

Overview
********

This example demonstrates how to create a USB-C Power Delivery application and
how to generate USB VIF policies in XML format using the USB-C subsystem. The
application implements a USB-C Sink device.

After the USB-C Sink device is plugged into a Power Delivery charger, it
negotiates with the charger to provide 5V@100mA and displays all
Power Delivery Objects (PDOs) provided by the charger.

.. _usb-c-sink-sample-requirements:

Requirements
************
The TCPC device used by the sample is specified in the devicetree
node that's compatible with ``usb-c-connector``.
The sample has been tested on :ref:`b_g474e_dpow1_board` and
:ref:`stm32g081b_eval_board`. Overlay files for the two boards
are provided.

Building and Running
********************

Build and flash as follows, changing ``b_g474e_dpow1`` for your board:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/usb_c/sink
   :board: b_g474e_dpow1
   :goals: build flash
   :compact:

Connect a charger and see console output:

Sample Output
=============

.. code-block:: console

 Unattached.SNK
 AttachWait.SNK
 Attached.SNK
 PE_SNK_Startup
 PRL_INIT
 PRL_HR_Wait_for_Request
 PRL_Tx_PHY_Layer_Reset
 PRL_Tx_Wait_for_Message_Request
 PE_SNK_Discovery
 PE_SNK_Wait_For_Capabilities
 RECV 4161/4 [0]0a01912c [1]0002d12c [2]0004b12c [3]000640e1
 PE_SNK_Evaluate_Capability
 PE_SNK_Select_Capability
 PRL_Tx_Wait_for_PHY_response
 PWR 3A0

 RECV 0363/0
 PRL_Tx_Wait_for_Message_Request
 PE_SNK_Transition_Sink
 RECV 0566/0
 Source Caps:
 PDO 0:
        Type:              FIXED
        Current:           3000
        Voltage:           5000
        Peak Current:      0
        Uchunked Support:  0
        Dual Role Data:    1
        USB Comms:         0
        Unconstrained Pwr: 1
        USB Susspend:      0
        Dual Role Power:   0
 PDO 1:
        Type:              FIXED
        Current:           3000
        Voltage:           9000
        Peak Current:      0
        Uchunked Support:  0
        Dual Role Data:    0
        USB Comms:         0
        Unconstrained Pwr: 0
        USB Susspend:      0
        Dual Role Power:   0
 PDO 2:
        Type:              FIXED
        Current:           3000
        Voltage:           15000
        Peak Current:      0
        Uchunked Support:  0
        Dual Role Data:    0
        USB Comms:         0
        Unconstrained Pwr: 0
        USB Susspend:      0
        Dual Role Power:   0
 PDO 3:
        Type:              FIXED
        Current:           2250
        Voltage:           20000
        Peak Current:      0
        Uchunked Support:  0
        Dual Role Data:    0
        USB Comms:         0
        Unconstrained Pwr: 0
        USB Susspend:      0
        Dual Role Power:   0
 PE_SNK_Ready

Part 3

한국어 전문 번역

개요

USB-C subsystem을 사용해 USB-C Power Delivery application을 만들고 USB VIF policy를 XML 형식으로 생성하는 방법을 보여 주는 example입니다. Application은 USB-C Sink device를 구현합니다.

USB-C Sink를 Power Delivery charger에 연결하면 charger와 5 V, 100 mA 공급을 협상하고 charger가 제공하는 모든 Power Delivery Object(PDO)를 표시합니다.

요구 사항

Sample이 사용하는 TCPC device는 Devicetree에서 usb-c-connector compatible node로 지정합니다. b_g474e_dpow1과 stm32g081b_eval board에서 시험됐으며 두 board용 overlay file이 제공됩니다.

빌드 및 실행

다음과 같이 build하고 flash합니다. 다른 board에서는 b_g474e_dpow1을 대상 board 이름으로 바꿉니다.

west build -b b_g474e_dpow1 samples/subsys/usb_c/sink
west flash

Charger를 연결하고 console output을 확인합니다.

샘플 출력

Output은 Sink attach state인 Unattached.SNK에서 시작해 Protocol Layer(PRL) 초기화, Source Capability 수신, capability 평가와 선택, 전원 전환을 거쳐 PE_SNK_Ready에 도달하는 과정을 보여 줍니다. 이어서 5 V·9 V·15 V·20 V의 네 fixed PDO와 각 current 및 capability flag가 출력됩니다.

Unattached.SNK
AttachWait.SNK
Attached.SNK
PE_SNK_Startup
PRL_INIT
PRL_HR_Wait_for_Request
PRL_Tx_PHY_Layer_Reset
PRL_Tx_Wait_for_Message_Request
PE_SNK_Discovery
PE_SNK_Wait_For_Capabilities
RECV 4161/4 [0]0a01912c [1]0002d12c [2]0004b12c [3]000640e1
PE_SNK_Evaluate_Capability
PE_SNK_Select_Capability
PRL_Tx_Wait_for_PHY_response
PWR 3A0

RECV 0363/0
PRL_Tx_Wait_for_Message_Request
PE_SNK_Transition_Sink
RECV 0566/0
Source Caps:
PDO 0:
       Type:              FIXED
       Current:           3000
       Voltage:           5000
       Peak Current:      0
       Uchunked Support:  0
       Dual Role Data:    1
       USB Comms:         0
       Unconstrained Pwr: 1
       USB Susspend:      0
       Dual Role Power:   0
PDO 1:
       Type:              FIXED
       Current:           3000
       Voltage:           9000
       Peak Current:      0
       Uchunked Support:  0
       Dual Role Data:    0
       USB Comms:         0
       Unconstrained Pwr: 0
       USB Susspend:      0
       Dual Role Power:   0
PDO 2:
       Type:              FIXED
       Current:           3000
       Voltage:           15000
       Peak Current:      0
       Uchunked Support:  0
       Dual Role Data:    0
       USB Comms:         0
       Unconstrained Pwr: 0
       USB Susspend:      0
       Dual Role Power:   0
PDO 3:
       Type:              FIXED
       Current:           2250
       Voltage:           20000
       Peak Current:      0
       Uchunked Support:  0
       Dual Role Data:    0
       USB Comms:         0
       Unconstrained Pwr: 0
       USB Susspend:      0
       Dual Role Power:   0
PE_SNK_Ready

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.