Adapt sink power capabilities dynamically

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

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

cross mob
mvic_2509051
Level 1
Level 1

For a sink to renegotiate the voltage I want to use these steps

  1. Change the sink capabilities runtime with dpm_update_snk_max_min
  2. dpm_pd_command (0, DPM_CMD_GET_SRC_CAP,NULL, pd_command_cb);
  3. dpm_pd_command (0,DPM_CMD_SNK_CAP_CHNG,NULL, pd_command_cb);

For this procedure the function dpm_update_snk_max_min requires a "max_min" array as parameter but in the SDK the structure of this array is not specified.
Is this anywhere specified and/or is there example code available for this?

0 Likes
1 Solution

Hi M Vissers,

I could like to recommend you use below example to update SINK PDO.

   pd_do_t SNK_PDO[5];

    SNK_PDO[0].val = 0xxxxx;

    SNK_PDO[1].val = 0xxxxxxx;

    SNK_PDO[2].val = 0xxxxxxx;

    SNK_PDO[3].val = 0xxxxxxx;

    SNK_PDO[4].val = 0xxxxxxx;

  

    dpm_update_snk_cap(0, 5, SRC_PDO);

      

    dpm_update_snk_cap_mask (0, 0x1F);

  

    dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

Best Regards,

Lisa

View solution in original post

0 Likes
3 Replies
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi M Vissers,

Let me assuming you are asking those question based on CCG3 project.

For dpm_update_snk_max_min, the function is : ccg_status_t dpm_update_snk_max_min(uint8_t port, uint8_t count, uint16_t* max_min);

You need define and initial with value for max_min with uint16_t if you are going to use this function. Please kindly noticed that this only

updates the sink max/min current/power at run-time, thereby overriding the sink max/min current/power specified in the config table. (Refer Ez-PD configuration Utility --SINK PDO). 

(Additional explain for Minimum or Maximum operating current required by the device. If Sink give back is enabled for the PDO, this field will have the minimum current; if not, it will have the maximum current. By default, we set Sink give back is disabled)

For example: (Update sink pdo [0]-[2]'s maximum current to 3000mA.)

uint16_t Sink_Max_Min_CNG[3];

Sink_Max_Min_CNG[0] = 0xBB8;

Sink_Max_Min_CNG[1] = 0xBB8;

Sink_Max_Min_CNG[2] = 0xBB8;

dpm_update_snk_max_min(0, 3, Sink_Max_Min_CNG);

Best Regards,

Lisa

0 Likes

So this only the maximum current can be changed? As the SDK description is

"Pointer to max/min cur/power array'"

Is it also possible to adapt the sink voltage dynamically, which function must be used for this?


Another question I have is if there is a function which returns the actual voltage and current as monitored by the CCG3?

0 Likes

Hi M Vissers,

I could like to recommend you use below example to update SINK PDO.

   pd_do_t SNK_PDO[5];

    SNK_PDO[0].val = 0xxxxx;

    SNK_PDO[1].val = 0xxxxxxx;

    SNK_PDO[2].val = 0xxxxxxx;

    SNK_PDO[3].val = 0xxxxxxx;

    SNK_PDO[4].val = 0xxxxxxx;

  

    dpm_update_snk_cap(0, 5, SRC_PDO);

      

    dpm_update_snk_cap_mask (0, 0x1F);

  

    dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

Best Regards,

Lisa

0 Likes