USB Power Delivery (USB PD) along with Type-C specification aims at providing Universal Charger functionality where multiple different devices requiring different voltages and currents can be charged using a single USB PD charger. Even though universality is a key feature of USB PD Chargers, some charger designs requires recognition of a particular sink connected to it.

Any USB PD capable device is recognized through the combination of its VID and PID. VID refers to Vendor ID, which is allotted by USB-IF. PID refers to Product ID which is fixed by vendor for a particular product. This VID and PID information can be obtained from the sink by sending “Discover Identity VDM” message. Sink in response to this VDM message sends Acknowledgement which includes VID and PID of the sink device.

 

Following is the code snippet to send Discover Identity VDM message after the completion of PD negotiation between source and sink. The PD port is disabled if VID and PID of sink doesn’t match the expected values (expected sink device).

CYPD3171-24LQXQ_CLA project from CCGx Power SDK is used to test the code functionality.

 

bool send_discover_id(uint8_t port)
{
/* Format the command parameters.
Single DO with standard Discover_ID command to SOP controller.
Timeout is set to 100 ms.
*/
ccg_status_t stat;
cmd_buf.cmd_sop = SOP;
cmd_buf.cmd_do[0].val = 0xFF008001;
cmd_buf.no_of_cmd_do = 1;
cmd_buf.timeout = 100u;


/* Initiate the command. Keep trying until accepted. */
while ((stat = dpm_pd_command(port, DPM_CMD_SEND_VDM, 
    &cmd_buf, pd_command_cb)) != CCG_STAT_SUCCESS)
{
/* Can implement a timeout/abort here. */
if (abort_cmd)
return false;
}
/* Command has been queued. We cannot block for callback here. */
return true;
}

 

App event APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE is triggered in app_event_handler function once the PD negotiation is complete. Discover Identity message is sent after negotiation complete event through a timer callback.

Attached to this post is the project which recognizes Ez-PD BCR as valid sink and turns the provider FET off when sinks other than BCR are connected. All changes to project are made in app.c file.