Skip to main content
Visitor II
October 4, 2022
Solved

Dynamically set PDO with G0 and ucpd - charge through dongle

  • October 4, 2022
  • 2 replies
  • 1302 views

The background is I am trying to build a pass through or charge through dongle like application. Using a G0 with 2 UCPD ports, port 0 as sink, and port 1 as DRP, using the respective TCPP chips

My goal is to have the input port 0, get the available PDO's, subtract the power consumed by the device, then pass these adjusted PDO's to the output, port 1, letting the up stream device chose. Once a PDO is selected on port 1, port 0 would also select the corresponding PDO

I have a couple questions about implementing this with UCPD on STM. I'm just fumbling around with a test project (no HW yet) but I can't seem to see how one would dynamical set PDO's. Specifically:

Can PDO's be set and removed dynamically during run time?

What part of the PD code would be the best area to edit / add this functionality ?

Cheers

    This topic has been closed for replies.
    Best answer by HFISTM

    Hello @Community member​ ,

    I would suggest first to have a look at the following wikis (including the optional sections) in order to have a complete code which is able to handle multiple PDO.

    https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Sink

    https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB_Type-C_only_Source

    Then, you should be able to modify the software to declare PDO dynamically, and handle them accordingly.

    In our example applications, PDOs are declared statically in file usbpd_pdo_defs.h. They are declared in arrays, PORT0_PDO_ListSRC & PORT0_PDO_ListSNK.

    The section of code that handles the actual PDOs is in the advanced section of the wiki for example for a SNK.

    So, yes, you can manage PDOs dynamically, but you will need to modify these sections of code according to your needs to implement this functionality.

    Best regards,

    2 replies

    HFISTMAnswer
    ST Employee
    October 13, 2022

    Hello @Community member​ ,

    I would suggest first to have a look at the following wikis (including the optional sections) in order to have a complete code which is able to handle multiple PDO.

    https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Sink

    https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB_Type-C_only_Source

    Then, you should be able to modify the software to declare PDO dynamically, and handle them accordingly.

    In our example applications, PDOs are declared statically in file usbpd_pdo_defs.h. They are declared in arrays, PORT0_PDO_ListSRC & PORT0_PDO_ListSNK.

    The section of code that handles the actual PDOs is in the advanced section of the wiki for example for a SNK.

    So, yes, you can manage PDOs dynamically, but you will need to modify these sections of code according to your needs to implement this functionality.

    Best regards,

    IOTkidAuthor
    Visitor II
    October 19, 2022

    Thanks @HFISTM​ 

    The advanced section is helpful, I see there is a git with a DRP example as well

    Cheers