Skip to content

Conversation

@tako0910
Copy link
Contributor

As for the USB PD sink functionality, the current implementation of the usbpd_sink_set_request_fixed_voltage function sets the value of pdControl_g.cc_SetPDONum to request the voltage specified in the argument.
But the problem is that if the source side of the USB PD does not support the requested voltage, the current implementation sets the last index (excluding the PPS) of the PDO in pdControl_g.cc_SetPDONum.

This is not a problem when requests the voltage supported by PD source, but means that unexpected voltage will be output when requests unsuppoted voltage by source.

For example, in the following cases:

  • Supported voltages on the USB PD source: 5V, 9V, 15V, 20V
  • Requested voltage to the usbpd_sink_set_request_fixed_voltage function: 12V (unsupported in this case)
  • Actual output voltage: 20V

The return value of the usbpd_sink_set_request_fixed_voltage function is void, so the developer cannot determine whether the request is possible.
And also, they would not want to output the maximum voltage supported by the PD source when the specified voltage is unsupported.

Therefore, the implementation of the usbpd_sink_set_request_fixed_voltage function should be improved.

  1. Change the return type to bool, and return false when an unsupported voltage is specified.
  2. When an unsupported voltage is specified, do not request the wrong voltage to the USB PD source.

@21km43
Copy link

21km43 commented Sep 15, 2024

To check supported voltages, I think it would be good to implement a function to get the number of PDO indexes and the voltage of each index. (Already implemented usbpd branch?)

@tako0910
Copy link
Contributor Author

To check supported voltages, I think it would be good to implement a function to get the number of PDO indexes and the voltage of each index. (Already implemented usbpd branch?)

Thank you for the suggestion!
You're right, and those features have already been implemented in another branch.
I considered adding the corresponding commit here, but since it deviates from the main focus of this pull request, I plan to create a separate pull request for that.

Taoyukai

This comment was marked as resolved.

@TianpeiLee TianpeiLee merged commit 1a6767a into openwch:main Sep 30, 2024
@tako0910 tako0910 deleted the improve_usbpd branch January 20, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants