can I change power sink to power source by updating the default port configuration table?

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
beyuc_3712261
Level 3
Level 3

Hi,

My project has to use the recovery mode for VBUS. The project is based on the reference SDK project CYPD3120-40LQXI_dp_dongle.

The CYPD3123 is powered all the time and the high-side MOSFET switch is turned off so the VBUS has no power before Samsung is plugged.

I need the CYPD3123 functioning as power source to charge the Samsung when it is plugged in the USB-C connector.

The MOSFET will be turned on by a command in the APP_EVT_CONNECT of  the function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat).

Could you tell me where the default port configuration table is and how I can change the power sink to power source in the default configuration?

Thanks,

Derong Yuan 

0 Likes
1 Solution

Hi Derong,

const unsigned char __attribute__ ((section (".configSection"), used)) gl_config_table[0x0800] is the configuration table. But the most convience way is explained in the below threads:

change PD port configuration parameters at runtime (for Lisa)

-------------------------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

View solution in original post

0 Likes
2 Replies
beyuc_3712261
Level 3
Level 3

Hi,

here is part of the typedef pd_port_config_t  for PD port-specific configuration data from the configuration table:

typedef struct

{

....

/* Byte 32: PD port role: 0=Sink, 1=Source, 2=Dual Role. */

    uint8_t     port_role;

    /* Byte 33: Default port role in case of a dual role port: 0=Sink, 1=Source. */

    uint8_t     default_role;

...

} pd_port_config_t;

Where in the project to change the default PD port role?

Is it in const unsigned char __attribute__ ((section (".configSection"), used)) gl_config_table[0x0800] ?

Thanks,

Derong Yuan

0 Likes

Hi Derong,

const unsigned char __attribute__ ((section (".configSection"), used)) gl_config_table[0x0800] is the configuration table. But the most convience way is explained in the below threads:

change PD port configuration parameters at runtime (for Lisa)

-------------------------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

0 Likes