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

USB EZ-PD™ Type-C

NaMe_2085021
Level 4
25 replies posted 10 replies posted 10 questions asked
Level 4

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