Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

How to update source/sink PDOs during runtime in CCGx firmware?

How to update source/sink PDOs during runtime in CCGx firmware?

Wang_Fred
Moderator
Moderator
Moderator
100 solutions authored 250 sign-ins 25 likes received

In this article you can find typical methods for 2 different scenarios over updating source/sink PDOs in CCGx firmware. Get to know how to update PDO Mask and Source PDOs Value with examples. 

Update PDO Mask

 

For example, the 1st, 4th, and 5th source PDO need to be enabled, and the others need to be disabled. Below code snippet should be called:

dpm_update_src_cap_mask(0, 0x19);
dpm_pd_command(0, DPM_CMD_SRC_CAP_CHNG, NULL, NULL);

Where each bit of parameter 0x19 represents one source PDO.

  • Bit value 1 means the target PDO is enabled.
  • Bit value 0 means the target PDO is disabled. Bit0 - Bit6 match with 1st to 7th source PDO respectively.

The sequence of PDOs follows the sequence shown in Source Capbility message or configuration file generated by EZ-PD™ Configuration Utility.

After the PDO mask is updated, source capabilities will be advertised again after DPM_CMD_SRC_CAP_CHNG is issued and trigger a new PD contract .

Update source PDOs value

 

The below steps show an example to change values of all 4 PDOs:

a. Define a data array to hold the PDO values:

pd_do_t SRC_PDO[4];

b. Prepare the values of 4 PDOs with filling out SRC_PDO[i].val. The raw data of PDO could be get from the configuration file generated by EZ-PD™ Configuration Utility after you input and save the target value in this tool.

c. Call the following code snippet to update PDOs, set the mask and trigger a new PD contract:

dpm_update_src_cap(0, 4, SRC_PDO);
dpm_update_src_cap_mask(0, 0x0f);
dpm_pd_command(0, DPM_CMD_SRC_CAP_CHNG, NULL, NULL);


Note:

  1. All PDOs should be updated again even though only one PDO values need be changed;
  2. Check PD Stack status before form any PD commands;
  3. Collect return value for each APIs in progress and add re-try for whole routine.
0 Likes
223 Views