2021-10-29 12:19 AM
We are planning to use STM32G071 in our next project.
We would like to have 9V@3A in PDO1.
So we edited the PDO1 data in the usbpd_pdo_defs.h file as follows.
[0x0202D12C]
00 0 0 0 0 1 00 000 0010110100 0100101100
Bit Description Applied value
[31,30] Fixed supply 00b
[29] Dual-role power 0b
[28] Higher capability 0b
[27] Unconstrained power 0b
[26] USB communication capable 0b
[25] Dual-role data 1b
[24,23] Value 00b
[22-20] Reserved 000b
[19-10] Voltage 0010110100b
[9-0] Current 0100101100b
However, only 5v output has been confirmed.
Where should we fixed?
Solved! Go to Solution.
2021-11-16 01:37 AM
I just compiled and tested your application, it works fine and I am able to select the 15V PDO.
I even flashed the binary you compiled on your PC (as you sent it with the project in your previous message). It works fine and selects the 15V PDO.
As you can see in my trace, the sink asks for position 4 which correspond to 15V.
I suggest you to retry by first erasing your STM32 completely (using STM32CubeProgrammer), then re-flash.
Regards
2021-11-02 05:51 AM
Hello @Sodag.1 ,
Could you please provide us a .cpd file (USB-PD trace) in order for us to have a look at your problem?
You can find information on how to do that here: https://wiki.st.com/stm32mcu/wiki/USB_Power_Delivery_overview#Specific_tools
Can you also check that your USBPD_DPM_SNK_EvaluateCapabilities() function in usbpd_dpm_user.c file contains user code that handles the sink PDO you defined? You can find example project for reference under STM32Cube_FW_G0_V1.5.0\Projects\STM32G071B-DISCO\Demonstrations\USBPD_Analyzer.
Thank you,
Regards
2021-11-04 01:53 AM
2021-11-04 06:58 AM
As can be seen in the trace, your source support 5 PDO (5V, 9V, 12V, 15V an 20V), but your sink asks for the 5V PDO (the first one).
Assuming you followed application note AN5418, you built the most simple sink possible, which doesn't handles matching the sink and source PDO. This must be done with user code.
This is done in USBPD_DPM_SNK_EvaluateCapabilities function. If you followed the application note, this function does nothing more than to ask for the first available source PDO, which in your case is 5V.
In order to select the 9V PDO, you must select PDO number 2 (in your case). This can be done with user code that matches the sink PDO you defined in CubeMX, and the corresponding available source PDO.
I suggest you to take look at a possible implementation of this system in this more complete example: https://github.com/STMicroelectronics/x-cube-tcpp/tree/main/Projects/NUCLEO-G071RB/Applications/USB_PD/SNK1M1_Sink.
2021-11-12 02:27 AM
Hello @Sodag.1 ,
Were you able to build your 9V sink ?
For your information, I updated our wiki article on how to build a sink with a new chapter dedicated to the source/sink PDO matching.
If you want to build a 9V sink, you could follow it as it provides the necessary user code to better handle the PDOs.
It is based on AN5418, but provides a much more complete sink application example.
WIKI: https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:STM32_Advance_USB-Power_Delivery_Sink
Regards
2021-11-15 11:33 PM
Thank you for your answer.
I built it according to the link you provided, I was able to take out 9V.
Thank you for your cooperation.
I have additional questions.
In Chapter 9.1 of the link page, 15V-1.5APDO is set in addition to 9V-1.5A, but the voltage actually taken out was 9V.
If I want to change the voltage depending on the application other than 9V, where should I set it?
2021-11-15 11:45 PM
Thank you for your feedback, glad to know you were able to select 9V.
For your question, I will say that it depends on your source. If you followed the wiki, you defined 3 PDO 5V/1.5A, 9V/1.5A, and 15V/1.5A. The code provided in the wiki will select the highest power (in W) match between the source and sink PDOs.
As you defined that your sink needs 1.5A at 15V, it could be that your source cannot deliver as much current needed by your sink at 15V and the sink will select the next highest-power PDO, which in your case is 9V/1.5A (because your source supports it)
If you want to select 15V, you will need to ask for a current smaller or equals to the max of your source or change your source for a more powerful one.
In case you don't want to select the highest-power PDO among the ones that are compatibles between the sink and the source, but say you want to select the maximum voltage (for example), you could modify DPM_FindVoltageIndex function accordingly.
Regards
2021-11-16 12:04 AM
2021-11-16 12:44 AM
Did you set the 15V 1.5A PDO for your sink in CubeMX ?
Could you please send me your usbpd_pdo_defs.h file to check ?
2021-11-16 12:55 AM