CAT2 Peripheral Driver Library
USBPD (USB Power Delivery)

The USBPD driver provides APIs to configure and access the M0S8-USBPD and MX-USBPD IP block on the EZ-PD PMG1 family of devices into a high-quality, versatile analog front-end for PD applications. More...

Modules

 Common
 USBPD driver common data structures.
 
 HPD (USBPD)
 USBPD Hot-Plug Detect driver.
 
 Legacy Charging (USBPD)
 USBPD Legacy Charging driver.
 
 MUX (USBPD)
 USBPD MUX Control driver.
 
 Phy (USBPD)
 USBPD Phy transceiver driver.
 
 Type C (USBPD)
 USBPD Type C driver.
 
 VBus Ctrl (USBPD)
 USBPD VBus Control driver.
 
 IDAC (USBPD)
 USBPD IDAC Control driver.
 
 Buck Boost (USBPD)
 USBPD VBus Buck Boost driver.
 
 LF Counter (USBPD)
 USBPD LF Counter driver.
 

Detailed Description

The USBPD driver provides APIs to configure and access the M0S8-USBPD and MX-USBPD IP block on the EZ-PD PMG1 family of devices into a high-quality, versatile analog front-end for PD applications.

The PMG1 family is a set of USB Power-Delivery (USBPD) enabled Micro-Controllers for the general market. The devices in this family support one or two instances of the Power Delivery Sub-System (PDSS) in addition to other standard MCU peripherals available on PSoC4 devices.

usbpd_driver.png
USBPD Driver Solution

The USBPD driver interacts directly with the hardware and provides support of the features available in the hardware. It implements the API interface and callbacks/hooks requested by the PDStack middleware to operate.

The functions of the USBPD driver include

  1. Configure the terminations on the CC pins of the PMG1 device, including support for automatic Rp-Rd toggle on parts that support Dual Role Port (DRP) functionality.
  2. Determine the external terminations applied on the CC pins using the line comparators.
  3. Measure Type-C VBus voltage using the 8-bit ADC.
  4. Configure the USB-PD Transceiver (PHY) and send/receive messages, including support for Extended Data Messages.
  5. Configure the gate driver outputs of the PMG1 device to enable power output or charging paths.
  6. Configure the comparators and cut-off circuits to provide Over-Voltage (OV), Under-Voltage (UV), Over-Current (OC), Short-Circuit (SC) and Reverse-Current (RC) Protection.
  7. Configure the in-built USB 2.0 and Side Band Use (SBU) Multiplexers for USB, Display and Thunderbolt data connections.
  8. Drive/detect transitions on the HotPlug Detect (HPD) pin as required by the Display function.
  9. Configure the terminations and measure the voltages on the D+/D- pins for BC 1.2. Most of the USBPD driver functions are not intended to be called directly from the user application as the PDStack middleware makes use of them to manage the functionality in a specification compliant manner.

Configuration Considerations

Use ModusToolbox Device Configurator Tool to generate initialization code

The following are the steps to generate initialization code using the ModusToolbox Device Configurator Tool:

  1. Launch the ModusToolbox Device Configurator Tool
  2. Switch to the Peripherals tab. Enable the USB-C Power Delivery personality under Communication
  3. Go to the Parameters Pane for the USBPD Personality and configure it with the desired parameters (Configure the clock inputs, set the fault protection parameters per configuration considerations, etc)
    usbpd_driver_clocks.png
    USBPD Driver Clock Configuration
    usbpd_driver_fault_protection.png
    USBPD Driver Fault Protection Configuration
  4. Perform File->Save for the initialization code to generate

Now, all required USBPD driver initialization code and configuration prerequisites will be generated:

  1. The Peripheral Clock Divider assignment and analog routing are parts of the init_cycfg_all() routine. Place the call of cybsp_init () function before using any USBPD driver API functions to ensure initialization of all external resources required for the USBPD driver operation.
  2. The USBPD driver configuration structure declaration is in the cycfg_peripherals.h file and its initialization is in the cycfg_peripherals.c file. The variable name is mtb_usbpd_port<port_num>_config. It must be used with Cy_USBPD_Init() function.
    cy_stc_fault_vbus_ovp_cfg_t mtb_usbpd_port0_ovp_config =
    {
    .enable = true,
    .mode = 2,
    .threshold = 20,
    .debounce = 10,
    .retryCount = 2,
    };
    cy_stc_fault_vbus_uvp_cfg_t mtb_usbpd_port0_uvp_config =
    {
    .enable = true,
    .mode = 2,
    .threshold = 20,
    .debounce = 10,
    .retryCount = 2,
    };
    cy_stc_usbpd_config_t mtb_usbpd_port0_config =
    {
    .vbusOvpConfig = &mtb_usbpd_port0_ovp_config,
    .vbusUvpConfig = &mtb_usbpd_port0_uvp_config,
    .vbusOcpConfig = NULL,
    .vbusScpConfig = NULL,
    .vbusRcpConfig = NULL,
    .vconnOcpConfig = NULL,
    .ccOvpConfig = NULL,
    .sbuOvpConfig = NULL,
    .legacyChargingConfig = NULL,
    };
    /* Initialize the USBPD driver */
    (void)Cy_USBPD_Init(&usbpdCtxt, 0, base, trimsBase, &mtb_usbpd_port0_config, cy_pd_dpm_get_config);

More Information

For more information on the USBPD peripheral, refer to the technical reference manual (TRM) and the Datasheet.

Changelog

VersionChangesReason for Change
2.100 Added new APIs to enable or disable the SBU ADFT block. New feature support
Updated the USBPD driver to enable battery charging support on Type-A port for the CYPM1011 device. New feature support
2.90 Updated the USBPD driver to enable support for CCG6xF_CFP family devices. New family devices support.
2.80 Updated the USBPD driver to enable dual port support for CYPM1321 device. Defect Fix.
2.70 Corrected REFGEN control settings for PMG1S3. Defect Fix.
Updated configuration table space for Dock solutions. New feature support.
Updates related to HPD handling for PMG1S3. Defect Fix.
2.60 Added PMG1B1 BB VOUT RCP support. New feature support.
Added PMG1B1 VBBOUT/VBAT protection functions to API reference manual. API reference manual update
Updates to resolve compilation warnings related to casting of variables. Defect Fix.
2.50 Updates to resolve compilation warnings related to unused variables. Defect Fix.
PFET operation enabled for PMG1-B1 in a USB-PD Sink only Role. Defect Fix.
2.40 Added LF Counter driver. New feature support.
Updated configuration table space to support CCG8 device series. Feature support.
Corrected the ADC detach detection input used in PMG1-S1 device. Defect Fix.
2.30 Use WLC1 Series Code compile directive Defect Fix
Changed from Cy_USBPD_Bch_Set_AfcTxData to Cy_USBPD_Bch_Afc_Set_Tx_Data API Name Change
Added Cy_USBPD_Bch_AfcGetRxDataPtr and Cy_USBPD_Bch_AfcGetRxDataCount functions APIs added for Adaptive fast charge feature(AFC)
2.20 Added support for PMG1B1 device. New device support.
Added API to measure Vbus current. New feature support.
Vsys-Vbus switch issue fixed. Defect Fix
Fixed deep sleep reference not enabled during Type-C restart. Defect Fix
2.10 CCG7D updates. Feature support.
2.0 Added support for CCG7D, CCG7s and WLC1 devices. New device support.
Added support for PPS source and regulation control via internal error amplifier New feature support
1.30 Added SBU Level Detection New feature support.
Updates for EPR support New feature support
Added legacy charging drivers New feature support
1.20.1 Update the paths to the code snippets. PDL structure update.
1.20 Added APIs to control NGDO drive strength. New feature support
1.10 Added drivers for HPD and MUX feature. New feature support.
Added support for VBus Over Current Protection, VBus Short Circuit Protection, VBus Reverse Current Protection and VConn Over Current Protection. New feature support.
Added support for PMG1S3 device. New device support.
1.0 Initial version