1 Reply Latest reply on Apr 9, 2019 12:01 AM by ShifangZ_26

    change PD port configuration parameters at runtime (for Lisa)

    beyuc_3712261

      Hi Lisa,

      Can I use this function "ccg_status_t dpm_update_port_config(uint8_t port, uint8_t role, uint8_t dflt_role, uint8_t toggle_en, uint8_t try_src_snk_en);" to make the CYPD3123 change its to role as power source and send a Type-C command to the Samsung to change its role as power sink 1 second after the Samsung plugged?

       

      If yes can you tell me how?

       

      Thanks,

      Derong Yuan

        • 1. Re: change PD port configuration parameters at runtime (for Lisa)
          ShifangZ_26

          Hi Derong,

           

          Of course you can use this function to reconfigure CCG3 at run time. If you could like to reconfiguration it after CYPD3123 is power sink and power negotiation is settled.

           

          The process could be below:

          1. Start a timer after EVENT case APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE:  at function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat). The timer is 1s period and then callback function XXXX_callback();

           

          2. The XXXX_callback() can be call dpm_update_port_config(uint8_t port, uint8_t role, uint8_t dflt_role, uint8_t toggle_en, uint8_t try_src_snk_en) after check the current port type. If it is power sink, you can try to configure it as power source only.

           

          Set to power source only:

          dpm_update_port_config(0, 1, 1, 0, 0); >> Source only and without TRY.SRC.

           

          -------------------------Refer  brief of the function dpm_update_port_config-------------------------------

          /**

          * @brief Change the PD port configuration at runtime.

          *

          * This function allows changing the PD port configuration parameters like port

          * role, default port role, DRP toggle enable and Try.Src enable at runtime.

          * These changes are only allowed while the corresponding PD port is disabled.

          *

          * @param port USB-PD port to be configured.

          * @param role New port role selection (0 = Sink, 1 = Source, 2 = Dual Role).

          * @param dflt_role New default port role selection (0 = Sink, 1 = Source).

          * @param toggle_en New value for DRP toggle enable flag.

          * @param try_src_snk_en New value for Try.SRC/ TRY.SNK enable flag( 0 =

          * Both Try.SRC and TRY.SNK are disabled, 1 = Try.SRC is enabled,

          * 2 = TRY.SNK is enabled).

          * @return CCG_STAT_SUCCESS if operation is successful, CCG_STAT_BAD_PARAM

          * if port index is not correct or other parameters are not correct,

          * CCG_STAT_FAILURE if port is not disabled.

          */

          ccg_status_t dpm_update_port_config(uint8_t port, uint8_t role, uint8_t dflt_role,

                                         uint8_t toggle_en, uint8_t try_src_snk_en);

          -----------------------------------------------------------------------------------------------------------------------------------

           

          Best Regards,

          Lisa