Skip to main content
H V N D
Associate III
July 28, 2021
Question

USB-PD default role initialize & change

  • July 28, 2021
  • 1 reply
  • 2500 views

Hi supporter,

I have one question: I want to change Port Role when no cable connect, can I do it?

my behavior:

  1. Init usbpd with default role is Sink
  2. when my application running, I see my adapter plugin, I want change my port to sink

Can I do that?

1 reply

Nicolas P.
ST Employee
July 28, 2021

Hello @H V N D​ ,

I'm not sure to fully understand.

If you have DRP, and nothing is connected, your port Role has to toggle.

You have a DRP, and in case you are connected as a source, you want to switch to sink role ?

In this case you have to request a power role swap.

Sequence is indicated on our wiki.

Is that what you are looking for ?

Nicolas

H V N D
H V N DAuthor
Associate III
July 28, 2021

My problem is:

  • when I power my STM32, I don't know the power supply to STM32 is from Adapter or Vbus of Phone ( because ADC init and convert slow, when app task run I can know )
  • If I want my Port is source, I must wait cable connect and change to source by PowerRoleSwap ( because default is Sink )

Can I change my port is source even no cable connect?

Nicolas P.
ST Employee
July 30, 2021

You can change role when you are not yet attached; that's the purpose of role toggling when you are DRP (dual role power) capable.

And when you are attached, you can request a role change by sending a message, like mentioned in previous message on the wiki.

Using the UCPD in our microcontrollers, the role toggling has to be done by the application : it is not automatically done by hardware.