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

cross mob

High Frequency functions in CCG2 firmware customize

High Frequency functions in CCG2 firmware customize

ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

1. [CCG2 is power sink role] Adjust request PDO as per SOURCE CAP advertised.

 

{CCG2 firmware is following PD 2.0 SPEC, the function static bool is_src_acceptable_snk(tPD_DO* pdo_src, tPD_DO* pdo_snk) @ file cy_solution.c is for checking which sink PDO is acceptable based on the SOURC_CAP from DFP. CCG2 firmware is select out the one match the SOURCE_CAP as per Power Delivery SPEC, which is means, the sink voltage and current shall be covered by SOURCE_CAP (Voltage shall be match, Current of SOUCE CAP s larger or equal sink capabilities), otherwise, CCG2 will request 5V request.}

>> Need update the case PDO_FIXED_SUPPLY. Example is below

case PDO_FIXED_SUPPLY:

                    if(fix_volt == pdo_snk->fixed_snk.voltage)

                    {

                        max_type_cur = get_max_cur(0u, pdo_snk, fix_volt);

                        if(pdo_src->fixed_src.max_current >= max_type_cur)

                        {

                            contract_power = udiv_round_up(fix_volt * pdo_snk->fixed_snk.op_current, 500u);

                            contract_voltage = fix_volt;

                            op_cur_power = pdo_snk->fixed_snk.op_current;

                            out = true;

                        }

                        //Added for update current for mismatch current only

                        else if(fix_volt > V_SAFE_5V)

                        {

                            contract_power = udiv_round_up(fix_volt * pdo_src->fixed_src.max_current, 500u);

                            contract_voltage = fix_volt;

                            op_cur_power = pdo_src->fixed_src.max_current;

                            max_type_cur = pdo_src->fixed_src.max_current;

                            out = true;

                        }

                    }

                    break;

 

2. [CCG2 is power sink role] Request DR_SWAP or PR_SWAP

 

{Type-C SPEC defines Power source role as data host by default and power sink role as data device. Type-C can support Power role is not sync with data role. For example, Power source role and data sink role.}

>> Firmware implement process is: (PR_SWAP for example, and expect to work as Power source role.)

a. Check current role.((get_current_port_role() == PRT_ROLE_SINK) )

{There may need add more conditions to go ahead to next step, for example, make sure power source is already asserted.}

b. send PR_SWAP if the current role is not match the expect. (handle_pd_command (DPM_CMD_PR_SWAP, NULL, NULL); )

 

 

0 Likes
353 Views