USB-PD Decoder
Decode and build USB Power Delivery Power Data Objects (PDOs), with a 32-bit bit-field map and negotiation simulation. Demonstrative tool.
1 · Hex PDOs
One PDO per line (with or without 0x). These are the raw Source Capabilities.
2 · Decoded
1 · Build a PDO
EPR AVS: minimum voltage fixed at 15 V (not encoded).
2 · Encoded PDO
— Negotiator (sink → source)
Simulates the sink request over the Decode-mode PDOs: pick a voltage/current or ask for maximum power.
What is a PDO?
A Power Data Object (PDO) is a 32-bit word a USB-C source uses to advertise a power profile, the Source Capabilities. Bits 31-30 give its type; the sink selects a PDO and replies with a Request Data Object (RDO). The tool decodes and rebuilds PDOs, but does not handle the packet level nor the physical layer.
A Power Data Object is a 32-bit word a USB-C source uses to advertise a power profile (the Source Capabilities). Bits 31-30 give its type; a sink selects a PDO and replies with a Request Data Object (RDO). This tool decodes and rebuilds PDOs, but does not handle the packet level nor the physical layer of the protocol.
What are the PDO types and how do they scale?
Field scaling depends on the family: Fixed, Battery and Variable encode voltage at 50 mV; Fixed/Variable current at 10 mA, Battery power at 250 mW. The PPS and AVS APDOs use 100 mV, with current at 50 mA or PDP power at 1 W. AVS is expressed in power because current varies with voltage.
Field scaling depends on the family — it is the most common mistake:
| Type | bit 31-30 | Voltage | Current / Power |
|---|---|---|---|
| Fixed Supply | 00 | 50 mV | 10 mA (current) |
| Battery | 01 | 50 mV | 250 mW (power) |
| Variable | 10 | 50 mV | 10 mA (current) |
| SPR PPS (APDO) | 11 · 00 | 100 mV | 50 mA (current) |
| EPR AVS (APDO) | 11 · 01 | 100 mV | 1 W (PDP, power) |
The EPR Fixed (28/36/48 V) uses the same encoding as Fixed, with voltage > 20 V. For PPS, note that the runtime adjustment step is 20 mV, but the encoding of the limits in the APDO is at 100 mV — distinct things. For EPR AVS the available current varies with voltage, so the offer is expressed in power (PDP), not current.
Fixed PDO structure
The first Fixed PDO also carries the capability flags (USB-PD R3.1 Source layout):
b31-30 PDO type (00 = Fixed) b29 Dual-Role Power b28 USB Suspend Supported b27 Unconstrained Power b26 USB Communications Capable b25 Dual-Role Data b24 Unchunked Extended Messages b23 EPR Mode Capable b22 Reserved b21-20 Peak Current b19-10 Voltage (50 mV/unit) b9-0 Max Current (10 mA/unit)
How does PDO → RDO negotiation work?
The negotiator applies a simplified selection: for a requested voltage it prefers the exact Fixed, then a programmable APDO (PPS/AVS) covering the value, finally Variable or Battery; with “maximum power” it picks the PDO with the highest available power. It is not the full Policy Engine state machine. EPR allows up to 13 PDO positions.
The negotiator above applies a simplified selection: for a requested voltage it prefers the exact Fixed, then a programmable APDO (PPS/AVS) covering the value, finally Variable/Battery; with “maximum power” it picks the PDO with the highest available power. It is not the full Policy Engine state machine: it is meant to read which PDO would be selected and the resulting RDO. EPR allows up to 13 PDO positions.
What are the tool’s limitations?
The tool decodes and encodes only the 32-bit PDO/RDO: no CRC, packet header or BMC physical layer. It runs no real electrical sanity check of the source. EPR AVS is expressed in power (PDP) and current at a given voltage is derived as P/V. The negotiator is an educational selection, not the full USB-PD negotiation with messages and timers.
- Decodes/encodes only the 32-bit PDO/RDO: no CRC, packet header or BMC physical layer.
- No real electrical sanity check of the source: values are those declared in the bits.
- EPR AVS is expressed in power (PDP); current at a given voltage is derived as P/V.
- The negotiator is an educational selection, not the full USB-PD negotiation with messages and timers.
References
- USB Power Delivery Specification R3.1 / R3.2 — USB-IF (Source Capabilities, PDO/RDO, APDO).
- Fixed PDO flag layout aligned with the Linux kernel
include/linux/usb/pd.h.