Correct way to disable PD port

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
MiMo_4023676
Level 2
Level 2
5 replies posted 5 questions asked First solution authored

Hello,

I want to disable PD (no PDOs advertised, port disabled) based on an ADC reading.

What is the correct way to do this using the CCGx API?

  • dpm_stop(PORT) does indeed disable the port... but it also seems to disable the ADC measurement.
  • dpm_disable(PORT) does not seem to do anything at all (port is not disabled).

Is there another way to disable the port using the API?

Thanks for your help,

m

0 Likes
1 Solution

Hi Mike,

The best API function to use in this case would be

app_disable_pd_port(uint8_t port, dpm_typec_cmd_cbk_t cbk);  //@file app.c

You will have to create a dummy callback function (to do nothing) since we don't require a callback here (you cannot pass NULL).

The periodic VBUS measurement will be disabled inevitably, but you can use this API to access the VBUS ADC:

vbus_get_value(uint8_t port);  //@file app.c

You can use lower level functions like dpm_stop(port) and pd_hal_measure_vbus(port) but it is not recommended unless you know you how to call them from the correct place. dpm_disable(port) only disables PD on the port, the port is still functional.

Regards,

Rajath

View solution in original post

0 Likes
3 Replies
RajathB_01
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hi,

Which CCGx are you using?

Are you measuring from the ADC to re-enable the port? Is it VBUS ADC you are using?

Regards,

Rajath

0 Likes

Hi Rajath,

Thanks for your questions.

I'm using a CCG3PA. Yes, I want to measure from the ADC to re-enable the port.

The ADC is on a GPIO, P1.3/DM1.

Thank you,

mike

0 Likes

Hi Mike,

The best API function to use in this case would be

app_disable_pd_port(uint8_t port, dpm_typec_cmd_cbk_t cbk);  //@file app.c

You will have to create a dummy callback function (to do nothing) since we don't require a callback here (you cannot pass NULL).

The periodic VBUS measurement will be disabled inevitably, but you can use this API to access the VBUS ADC:

vbus_get_value(uint8_t port);  //@file app.c

You can use lower level functions like dpm_stop(port) and pd_hal_measure_vbus(port) but it is not recommended unless you know you how to call them from the correct place. dpm_disable(port) only disables PD on the port, the port is still functional.

Regards,

Rajath

0 Likes