GithubHelp home page GithubHelp logo

jannau / vdmtool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asahilinux/vdmtool

0.0 1.0 0.0 109 KB

USB-C Power Delivery VDM exploration tool for Arduino

License: MIT License

C 64.16% C++ 35.84%

vdmtool's Introduction

Introduction

This is a simple tool for sending and receiving USB-PD VDM messages using a FUSB302, based on usb-c-arduino.

USB-PD VDM documentation is here

Example Usage

You can use a breakout board or a bare FUSB302. You need to wire it as follows:

  • 1 CC2 → Type-C CC2 (B5) - ONLY wire this to a Type-C socket used with a cable. Otherwise leave open.
  • 2 VBUS → Arduino D4, Type-C VBUS (A4/A9/B4/B9)
  • 3 VDD → Arduino 3.3V
  • 4 VDD ↑
  • 5 INT_N → Arduino D12
  • 6 SCL → Arduino A5
  • 7 SDA → Arduino A4
  • 8 GND → Arduino GND, Type-C GND (A1/A12/B1/B12)
  • 9 GND ↑
  • 10 CC1 → Type-C CC1 (A5)
  • 11 CC1 ↑
  • 12 VCONN output - leave open
  • 13 VCONN output - leave open
  • 14 CC2 - See pin 1 ↑

You can get away without decoupling and with only connecting one of the duplicated pins. The exposed pad is NC.

Interface

By default the code will perform trivial (mostly hardcoded) USB-PD negotiation, then request to mux the debug UART over SBU1/SBU2. You can send custom VDMs using the Arduino serial terminal at 500000 baud.

Sample DFP mode session:

VBUS OFF
Device ID: 0x91
Init
STATUS0: 0x0
VBUS OFF
Disconnected
S: DISCONNECTED
Poll: cc1=0 cc2=0
Poll: cc1=2 cc2=0
Connected: cc1=2 cc2=0
Polarity: CC1 (normal)
VBUS ON
S: DFP_VBUS_ON
IRQ: VBUSOK (VBUS=ON)
>SOURCE_CAP
S: DFP_CONNECTED
IRQ: HARDRESET
VBUS OFF
Disconnected
S: DISCONNECTED
Poll: cc1=2 cc2=0
Connected: cc1=2 cc2=0
Polarity: CC1 (normal)
VBUS ON
S: DFP_VBUS_ON
IRQ: VBUSOK (VBUS=ON)
>SOURCE_CAP
S: DFP_CONNECTED
<REQUEST: 12000000
>ACCEPT
>PS_RDY
S: IDLE
<GET_SINK_CAP
>SINK_CAP
S: READY
>VDM SET ACTION serial -> SBU1/2
S: IDLE
<VDM RX SOP"DEBUG (5) [504F] 5AC8052 44740000 306 0 0

Sample UFP mode session:

VBUS OFF
Device ID: 0x91
Init
STATUS0: 0x0
Disconnected
IRQ: VBUSOK (VBUS=OFF)
S: DISCONNECTED
S: DISCONNECTED
IRQ: VBUSOK (VBUS=ON)
Connected: cc1=7 cc2=0
Polarity: CC1 (normal)
S: CONNECTED
<SOURCE_CAP: 3F01912C
>REQUEST
<ACCEPT
<PS_RDY
<SOURCE_CAP: 3E019096
>REQUEST
<ACCEPT
<PS_RDY
<GET_SINK_CAP
>SINK_CAP
<VDM DISCOVER_IDENTITY
>VDM DISCOVER_IDENTITY
S: READY
>VDM SET ACTION serial -> SBU1/2
S: IDLE
  input: "5AC8010\n"
>VDM 5AC8010
<VDM RX SOP'DEBUG (7) [724F] 5AC8050 46060606 2060301 3060106 1050303 8030809 1030000
  input: "5AC8011,306\n"
>VDM 5AC8011 306
<VDM RX SOP'DEBUG (3) [344F] 5AC8051 187020C 800C0000
  input: "5AC8012,1840306\n"
>VDM 5AC8012 1840306
<VDM RX SOP'DEBUG (5) [504F] 5AC8052 44740000 306 0 0

vdmtool's People

Contributors

graycat avatar marcan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.