cancel
Showing results for 
Search instead for 
Did you mean: 

USB PD change voltage during active contract

abtq
Associate II

Dear ST Community,

 

I have a working application for USB PD SPR and EPR and now I want to change the voltage (power profile) during an active contract.
So e.g. I have 5V currently and want to request 9V from the source, or I have 20V currently and want to switch to 28V (EPR).
How to do that? According to the USB Specification you would send a "Get Source Capability" Request so I used USBPD_DPM_RequestGetSourceCapability() [or USBPD_PE_Send_ExtendeControlMessage(m_uPort, USBPD_EXTENDED_CONTROL_EPR_GETSRCCAPA) in EPR]. Then the source responds with it's capabilities. USBPD_DPM_SetDataInfo gets called with the PDOs but USBPD_DPM_SNK_EvaluateCapabilities is never called afterwards....
In SPR Mode nothing happens, voltage stays the same. In EPR Mode 30ms later a hard reset is triggered.

 

Why does the ST Stack not Evaluate Capabilities after successfull reception of PDOs? According to USB Spec as a Sink we always need to respond to a capabilities message with our "wish".....

 

How to fix that?

I am using Core Stack version V5.3.0 (latest version as of writing this post). Microcontroller used is STM32H523.

 

Regards,

Adrian

4 REPLIES 4
FBL
ST Employee

Hi @abtq 

Would you share minimum firmware to reproduce the issue on a reference board? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


abtq
Associate II

Hi @FBL ,

I now have added a workaround: In USBPD_DPM_SetDataInfo() for USBPD_CORE_DATATYPE_RCV_SRC_PDO and USBPD_CORE_DATATYPE_RCV_SRC_PDO_EPR I added

if(usb.m_bChangingProfile && DPM_Params[PortNum].PowerRange == USBPD_EPR_MODE) {
    evaluateAndRequest(); // if an contract is active we need to evaluate our selves
}

(or check for SPR mode in similar fashion).

With:

bool CUSBPowerDelivery::evaluateAndRequest() {
	USBPD_SNKRDO_TypeDef uRequestData;
	USBPD_CORE_PDO_Type_TypeDef type;
	USBPD_DPM_SNK_EvaluateCapabilities(m_uPort, &uRequestData.d32, &type);
	USBPD_StatusTypeDef status = USBPD_PE_Send_Request(m_uPort, uRequestData.d32, type);
	if(status != USBPD_OK) {
        return false;
	}
	return true;
}

 

But in fact the ST stack should do that on its own? If so I will have to look into that and compose a minimal example to see whether this is a problem in my environment or whether the behaviour is the same in the minimal example.

 

FBL
ST Employee

Hi @abtq 

That would be great to share minimal project to reproduce on ! An internal ticket 215626 is submitted to USB PD stack team to answer all related questions!

Thank you

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


abtq
Associate II

Hi @FBL ,

I now finally made a minimal example.
Please find it attached. Its just "quickly" thrown together.

I found out as long as I don't go into EPR Mode Source Capabilities Message is automatically handled by the stack (change the code so it does not go into EPR).
But in the provided configuration I couldn't even get it to send the 

USBPD_PE_Send_ExtendeControlMessage(0, USBPD_EXTENDED_CONTROL_EPR_GETSRCCAPA);

message. That call always returns USBPD_FAIL. But without code to look into I find it really hard to debug the issue.

abtq_0-1756993696834.png

With my EPR Source communication seems fine. After that only keep alive and acknowledges can be seen but no epr get source capabilities.



Just to be clear: In my main application (not the minimal sample) it does actually send the USBPD_EXTENDED_CONTROL_EPR_GETSRCCAPA message, the source responds accordingly:

abtq_1-1756993884829.png

but the ST Stack does not evaluate and respond with a request message.

 

Also sending the non-EPR equivalent USBPD_DPM_RequestGetSourceCapability(0) in EPR mode does not work. This message is sent and the source responds accordingly but also no evaluation and no request from our side.

abtq_2-1756994056144.png

But notice there is no hard reset in this case!

 

Source used is a Delta Electronics USB PD 3.1 device.

 

I hope you can help with actually sending the epr get source capabilities message and then help debugging why the ST Stack does not evaluate and request.

Thanks and best regards,

Adrian