/vdmtool

USB-C Power Delivery VDM exploration tool for Arduino

Primary LanguageCMIT LicenseMIT

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 → 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 session:

Device ID: 0x91
Init
STATUS0: 0x0
IRQ: VBUSOK (VBUS=OFF)
State: DISCONNECTED
State: DISCONNECTED
IRQ: VBUSOK (VBUS=ON)
Connected: cc1=7 cc2=0
Polarity: CC1 (normal)
State: 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
State: READY
>VDM SET ACTION serial -> SBU1/2
State: 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