cancel
Showing results for 
Search instead for 
Did you mean: 

USB EZ-PD Type-C

NaMe_2085021
New Contributor II

Hi everyone,

I use CYPD3120.

I get the whole range of voltages from the array, but I can't get 20V.

Could you help me?

Part of the code:

........................................................................................................................................................................................

static ccg_status_t hid_output_data (usb_setup_pkt_t *pkt)

{

    uint8_t  port;

    uint8_t *ptr;

    ptr = usb_hid_get_ep0_buffer();

    pd_do_t SNK_PDO[5]; 

    SNK_PDO[0].val = 0x0001912C; //5V 3A

    SNK_PDO[1].val = 0x0002D12C; //9V 3A

    SNK_PDO[2].val = 0x0003C12C; //12 3A

    SNK_PDO[3].val = 0x0004B12C; //15V 3A

    SNK_PDO[4].val = 0x000640C8; //20V 2A

   

    for(i = 1; i < 64; i++)

    {             

        switch(ptr[1])

        {           

            case PD_5V:

                dpm_update_snk_cap(0, 1, SNK_PDO);

                dpm_update_snk_cap_mask (0, 0x0F);

                dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

            break;

            case PD_9V:

                dpm_update_snk_cap(0, 2, SNK_PDO);

                dpm_update_snk_cap_mask (0, 0x0F);

                dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

            break;

            case PD_12V:

                dpm_update_snk_cap(0, 3, SNK_PDO);

                dpm_update_snk_cap_mask (0, 0x0F);

                dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

            break;

            case PD_15V:

                dpm_update_snk_cap(0, 4, SNK_PDO);

                dpm_update_snk_cap_mask (0, 0x0F);

                dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

            break;

            case PD_20V:

                dpm_update_snk_cap(0, 5, SNK_PDO);

                dpm_update_snk_cap_mask (0, 0x0F);

                dpm_pd_command (0, DPM_CMD_SNK_CAP_CHNG, NULL,NULL);

            break;                

        }

........................................................................................................................................................................................

0 Likes
5 Replies
YiZ_31
Moderator
Moderator

Hi,

You can try to update the snk cap mask to 0x1F. It looks like you only enabled 4 sink PDOs.


Regards,
Eddie

0 Likes
NaMe_2085021
New Contributor II

Hi Eddie,

Thank you for your fast update, but your answer dosn't work for me.

Could you send part of the code example?

Best regards,

Nazar Melnichek

0 Likes
YiZ_31
Moderator
Moderator

Hi,

Do you have a PD analyzer to capture the CC log? Have you updated sink PDO with

dpm_update_snk_cap (0, 5, SNK_PDO);

dpm_update_snk_cap_mask(0, 0x1F);.

0 Likes
NaMe_2085021
New Contributor II

Hi,

I don't have a PD analyzer.

Yes, I updated that. But it doesn't work for me.

0 Likes
YiZ_31
Moderator
Moderator

Hi,

It may also be due to your adapter do not have matched 20V PDO. CYPD3120 already have 20V PDO if you have updated the code.

0 Likes