Debugging USB Type-C and USB power delivery system designs

Designing robust systems using a high-speed interface like USB Type-C requires a great deal of care. When the interface involves advanced features like USB power delivery, debugging designs becomes even more complex. While systems can be verified by confirming that messages are sent and received accurately, there are many issues that can arise that complicate verification.

For example, with USB power delivery, two devices must complete a power contract negotiation to determine how much power will be delivered between the devices. If there is an error during negotiations, however, it can be extremely difficult to debug the process unless you can actually capture signaling data in real-time and view them within the context of the USB protocol.

Visibility into the signaling is also important when communicating with devices from other manufacturers. With USB Type-C combining data, power, and video in one connector, it can be challenging to identify the actual capabilities of a Type-C port, such as whether it is a power source or sink, what power capabilities it offers or requires, and whether it supports Alternate modes. With signal visibility, it is a straightforward process to see how a device actually behaves. Developers can also verify communications over the Configuration Channel (CC) at both the electrical and message levels.

To assist developers, USB Type-C/PD analyzers are available, such as the CY4500 EZ-PD Protocol Analyzer from Cypress. Protocol analyzers enable non-intrusive probing and capturing of USB-PD protocol messages on the Configuration Channel (CC lines). This article describes debugging techniques using a protocol analyzer that can accelerate the development of USB-PD based designs. In addition to design and debugging, analyzers are also useful for assisting developers in understanding the USB-PD protocol. For information on the basics of the USB Type-C and Power Delivery protocol, see USB Type-C and Power Delivery: 101.

Protocol Analyzers

Protocol analyzers like the Cypress’s CY4500 EZ-PDTM Protocol Analyzer kit (see Figure 1) supports analysis of the USB-PD and USB Type-C specifications. They capture USB-PD messages on the CC line in a non-intrusive manner that does not negatively impact real-time communications. This analyzer consists of Cypress’s programmable MCU (PSoC 5LP), which monitors data on the CC line (USB Type-C Connector) and sends this data to the host application, EZ-PD Analyzer Utility, over a USB interface. The USB Type-C plug and receptacle on this analyzer provide a pass-through for CC messages transmitted between each USB-PD connection. The programmable MCU taps these CC messages without disturbing the system and transfers them over the USB interface to a PC running the CY4500 EZ-PD Protocol Analyzer, a tool that captures the USB-PD traces and displays (see Figure 2).

click for larger image

Figure 1: USB-PD Type-C Protocol Analyzer Kit (CY4500 EZ-PD)

click for larger image

Figure 2. EZ-PD Analyzer Utility user interface

Protocol analyzers enable easy electrical level and protocol level debug and analysis of any USB Type-C and USB PD system. The analyzer is powered through the USB interface to the PC and includes connector headers for the probing of USB Type-C signals (CC lines, VBUS, and SBU lines). The analyzer can trigger sets of GPIOs for timing measurements of specific (or a combination of) USB PD events. Support for CC termination by the analyzer allows for emulation of a USB Type-C source/ sink/ cable for testing without need to connect to another USB Type-C device.

On the PC side, a Graphical User Interface (GUI) enables easy capture, offline analysis, and debugging of USB PD messages at the protocol level of any USB Type-C system. The GUI simplifies triggering sets of GPIOs on the CY4500 board for timing measurements of specific (or a combination of) USB PD events. Developers can also easily enable and disable CC terminations on the CY4500 board for emulating a USB Type-C source/ sink/ cable for ease of testing. Developers can also easily search and filter messages to speed problem identification and resolution.

Debugging with a USB-PD Protocol Analyzer

To probe the USB Type-C signals of an unattached USB Type-C port, the USB Type-C receptacle (or Type-C plug) of the protocol analyzer must be connected to the USB Type-C plug (or USB Type-C receptacle) of the device under test (DUT) as in Figure 3. USB Type-C signals are brought on a header that can be used for probing the signals on an oscilloscope.

click for larger image

Figure 3. Protocol analyzer setup for debugging USB Type-C ports in detached state

For probing USB Type-C signals or for capturing USB PD messages on the configuration channel (CC lines on the Type-C port), the protocol analyzer must be connected in between the two USB Type-C ports as in Figure 4. The analyzer sends signals to the protocol analyzer utility running on a PC to capture and decode the USB PD messages coming over the USB Type-C port.

click for larger image

Figure 4. Protocol analyzer setup for debugging USB Type-C ports in attached state

Understanding USB Type-C signaling

USB Type-C DFP – Unattached State

In the default state, the Downstream Facing Port (DFP) is the power source and thus should expose Rp terminations (pullup) on its CC wires. If the DFP device has a Type-C receptacle, then both its CC wires should expose the Rp terminations as in Figure 5. Refer to the USB-PD specification for more details on the Rp requirements.

click for larger image

Figure 5. Unattached USB Type-C DFP with USB Type-C receptacle

If the DFP device has a USB Type-C plug, then Rp terminations should be exposed on its CC wire, whereas the VCONN shall be grounded (see Figure 6 ).

click for larger image

Figure 6. Unattached USB Type-C DFP with USB Type-C plug

USB Type-C UFP – Unattached State

In the default state, the Upstream Facing Port (UFP) with USB Type-C receptacle or USB Type-C plug is the power sink and thus should expose Rd terminations (pull down) on its CC wire(s) as in Figure 7 . Refer to the USB-PD specification for more details on the Rd requirements.

click for larger image

Figure 7. Unattached USB Type-C UFP

USB Type-C DRP – Unattached State

Dual Role Port (DRP) devices will initially toggle their state between DFP (by connecting Rp and disconnecting Rd ) and UFP (by disconnecting Rp and connecting Rd ) operation in the unattached state as in Figure 8 and Figure 9.

click for larger image

Figure 8. Unattached Type-C DRP with Type-C receptacle

click for larger image

Figure 9. Unattached Type-C DRP with Type-C plug

USB Type-C Attached State

When one DFP and one UFP or two DRPs are connected together, they accept the resulting DFP-to-UFP relationship (achieved randomly in case of DRP), and a successful Rp -Rd voltage divider is formed on one of the CC lines. This indicates that the Type-C connection is established (see Figure 10 and Figure 11). For example, the CC value formed here is formed due to a voltage divider of Rp = 12k pulled to 3.3V on the DFP side and Rd = 5.1k on the UFP side, resulting in a voltage of roughly 900 mV.

click for larger image

Figure 10. Direct USB Type-C connection between USB device and Host (without EMCA cable)

click for larger image

Figure 11. USB Type-C connection (without EMCA) – flipped

The status of CC wires depends on the orientation of the USB Type-C plug connected to the USB Type-C receptacle. The status of the other CC line (or VCONN signal) depends on which end the analyzer is connected to and also whether an EMCA [1] is used for the connection or not. Figure 10 and Figure 11 show the waveform captures in the absence of an EMCA. Figure 12 is a waveform capture of a USB Type-C connection with an EMCA in between DFP and UFP (as shown in Figure 13).

click for larger image

Figure 12. USB Type-C connection (with EMCA)

click for larger image

Figure 13. USB Type-C connection with EMCA

Understanding the USB-PD protocol

Observing Basic USB-PD Contract

An explicit power contract or agreement is reached between the port partners as a result of the USB Power Delivery negotiation process. The power delivery negotiation is performed using PD Messages, as defined by the USB-PD specification, over the CC wire in a USB Type-C connection.

Figure 14 shows the USB PD messages transmitted between the DFP and UFP over the CC wire during USB Power Delivery Negotiation process. USB PD uses BMC (Bi-Phase Mark Coded) signaling for the PD communication. For more details on BMC, refer USB-PD specification.

click for larger image

Figure 14. USB PD BMC signaling

Figure 15 shows the traces of a successful USB PD contract (captured using EZ-PD Analyzer Utility) between a 29W USB-C power adapter which is a DFP (Source / Power Provider) and a DRP port (like a laptop) which locks as a UFP (Sink / Power Consumer).

click for larger image

Figure 15. Source Power Data Objects (PDOs) of USB-C power adapter

During the power negotiation phase, the USB Type-C source (here, 29W Type-C power adapter) sends the “Source Capability” message to the attached USB Type-C sink. The Source Capabilities message in Figure 15 shows the custom Power Data Objects [2] (PDOs – highlighted as Power Data Obj Source 1 and Power Data Obj Source 2 in Figure 15) supported by the Type-C power adapter:

  • Power Data Obj Source 1 (SRC PDO1): 5V, 2.4A
  • Power Data Obj Source 2 (SRC PDO2): 14.8V, 2A

The “Request” message after the “Source Capabilities” message, sent by the sink, requests the power based on the Sink PDOs required. As seen from Figure 16, the sink requests the Source PDO at the object position 2, i.e. SRC PDO2.

The USB Type-C Source then accepts (using an Accept message) and then sends a PS_RDY message as an indication that the source is ready to start sourcing the new power level on VBUS. Thus a power contract is established at 14.8 V with the USB Type-C power adapter providing 14.8 V to the Type-C port of the consumer device.

click for larger image

Figure 16. Request message sent by the power consumer based on its sink PDOs

The voltage at which the power contract is established can also be verified by the values reported by the Vbus column against the PS_RDY message and Vbus Volt text boxes shown in the utility (as highlighted in Figure 16 ).

Observing Role Swaps

The USB PD specification greatly improves the USB ecosystem and defines power roles (VBUS Source and Sink) that are independent of the data roles (USB host and USB device). This includes the ability to swap power and data roles independently. Refer to the article USB Type-C and Power Delivery: 101 for more details on the concept of role swaps (Data Role and Power Role).

Figure 17 shows a successful PR_SWAP message sequence. It can be seen that following the PR_SWAP, re-negotiation happens with the new source sending out the Source capabilities. It can be seen that following the successful PR_SWAP, the USB Type-C ports will have only their power roles changed and not their data roles.

click for larger image

Figure 17. PR_SWAP message sequence

Figure 18 shows a successful DR_SWAP message sequence after which no power re-negotiation occurs. It can be seen that the USB Type-C ports will have only their data roles changed and not their power roles. It can also be noted that the power contract that was negotiated prior to the DR_SWAP (14.8V contract in this case) remains intact even after the DR_SWAP.

click for larger image

Figure 18. DR_SWAP message sequence

Observing Alternate Mode Negotiation

Alternate mode is a feature that enables multi-purposing of USB Type-C signals for alternate uses such as DisplayPort (DP), HDMI and Thunderbolt. More details on the protocol aspects of DP over USB Type-C are beyond the scope of this article. Refer to the VESA DisplayPort (DP) Standard and VESA DisplayPort Alt Mode on USB Type-C Standard for further details.

Figure 19 shows a successful alternate mode (Display Port – DP) negotiation between a USB Type-C monitor (UFP) and a USB Type-C notebook (DFP) with DP support. The DFP support queries the UFP to understand its alternate mode capabilities. Following that the DFP issues “Enter Mode” message instructing the UFP to enter the display port mode (where the display data would be transmitted over the SuperSpeed lines of Type-C connector). Figure 19 only highlights one message where the UFP reports the supported alternate mode as Display Port.

click for larger image

Figure 19. Display Port (Alternate mode) Negotiation

Identifying the presence of EMCA

Figure 20 shows a trace that helps to identify if a marker chip (that signifies an EMCA) is present on the USB Type-C cable connected in between the DFP and UFP (as in Figure 13). If an EMCA is present, then the cable marker chip responds to the SOP’ (SOP_PRIME) messages from the DFP providing the cable capabilities. For more details on the SOP’ communication and EMCA, refer article: Designing a Type-C Electronically Marked Cable and Designing USB 3.1 Type-C Cables.

click for larger image

Figure 20. Display Port (Alternate mode) Negotiation

Solving problems using CY4500 – Examples

CRC Error

A CRC Error or other packet field errors like EOP (End of Packet) can be easily identified on the captured trace as these messages are highlighted in red color, as shown in Figure 21.

click for larger image

Figure 21. Erroneous Packet delivery

If many such CRC errors are seen over the USB Type-C connection, then the problem could be due to the signal quality of the CC lines, which could then be probed on the header using an oscilloscope.

Unresponsive Sink

Figure 22 shows one example scenario where the UFP/Sink is not seen to respond to Source_Capabilities message sent by the DFP/Source. As per the PD protocol, the Source (DFP) retries the Source_Capabilities message and when the timeout (defined by the USB-PD specification) expires, a Hard Reset is seen on the bus (sent by either DFP or UFP). The protocol analyzer utility displays timing-related information, which can be useful in analyzing which device is violating the USB PD specification in terms of the timeouts specified. The Timeout expiry could be due to the USB PD messages actually not reaching the USB Type-C Sink (UFP) due to poor signal quality or no USB Type-C connection.

click for larger image

Figure 22. Unresponsive Sink

Power Contract at lower voltage

Figure 23 and Figure 24 show an example scenario where a power contract at lower voltage (5V in this case) is established, despite the source having the capability to provide more power. In Figure 23, the source advertises the support for 5V and 14.8V PDOs, out of which the Sink chooses only 5V in Figure 24 as the sink doesn’t have the support for the Sink PDO at 14.8V.

click for larger image

Figure 23. 5V contract with Source supporting Higher PDO – 1

click for larger image

Figure 24. 5V contract with Source supporting Higher PDO – 2

Display (DP) not working over USB Type-C

It can happen at times that a USB Type-C monitor capable of sourcing power (i.e. a DRP) may lock up as a DFP/ Source initially when connected to a USB Type-C notebook. For the display to work over USB Type-C (USB Type-C notebook as the DP source and USB Type-C monitor as DP Sink), the monitor should function as an UFP, for which it needs a successful DR_SWAP. Figure 25 shows one example scenario where a power contract is successful. However, the DR_SWAP is rejected by a USB Type-C device that locks initially as a UFP/ Sink (Type-C notebook in our example. If the Type-C notebook has not implemented the DR_SWAP sequence successfully (as in case of Figure 25), then DP will not work.

click for larger image

Figure 25. DR SWAP Rejected

With the USB Type-C and USB power delivery specification evolving continuously, there can be many premature (or not fully compliant) devices out in the market that exhibit faulty behaviors as described here and other. In such cases, a protocol analyzer can serve as a handy tool to debug and analyze the same quickly.

References

http://www.cypress.com/video-library/Corporate/typec-101-lesson-3-ez-pd-protocol-analyzer/499086

Specifications: Type-C Specification, USB-Power Delivery Specification

Application notes: AN95615 – Designing USB 3.1 Type-C Cables Using EZ-PD™ CCG2, AN210403 – Hardware Design Guidelines for Dual Role Port Applications Using EZ-PD™ USB Type-C Controllers, AN210771 – Getting Started with EZ-PD™ CCG4

Other web links: www.cypress.com/type-C, Designing a Type-C Electronically Marked Cable

Footnotes

[1] Electronically Marked Cable Assembly (EMCA) is a USB Type-C cable that uses USB PD to provide the cable’s characteristics. The electronic marking is accomplished by embedding a controller chip into the plug at one or both ends of the cable, which operates on the VCONN power (or VBUS power as per the cable design).

[2] Power Data Object: 32 bit field in the PD message which is used to expose a Source Port’s power capabilities or a Sink’s power requirements. Refer to the article USB Type-C and Power Delivery: 101 for more details on PD message types and fields.


Gayathri Vasudevan is a senior staff applications engineer at Cypress Semiconductor, Bangalore. Gayathri is responsible for supporting customers on all wired USB products, developing specifications for next generation products, and creating solution demos, application notes and other collateral for new products. She has a Masters degree in Embedded Systems engineering.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.