2024-12-20 11:03 AM
Hi, I am asking about the STM32 usb power delivery middleware. Is there a way to delay/stop the PS_RDY (power supply ready) message from being sent out, or is that completely automatic? Thank you.
Solved! Go to Solution.
2024-12-20 1:37 PM - edited 2024-12-20 1:38 PM
I figured it out. In the function USBPD_DPM_Notification add the case USBPD_NOTIFY_POWER_STATE_CHANGE. Inside that case statement, don't allow the function to return until your power supply is where it should be (but be sure not to take forever or the other device might send a hard reset).
(I also check in that case statement to make sure I am indeed acting as a source, since my device is dual role, but idk for sure if that is needed.)
2024-12-20 1:37 PM - edited 2024-12-20 1:38 PM
I figured it out. In the function USBPD_DPM_Notification add the case USBPD_NOTIFY_POWER_STATE_CHANGE. Inside that case statement, don't allow the function to return until your power supply is where it should be (but be sure not to take forever or the other device might send a hard reset).
(I also check in that case statement to make sure I am indeed acting as a source, since my device is dual role, but idk for sure if that is needed.)
2024-12-20 1:39 PM
Also note that if you don't do this bad things may happen since you aren't supposed to send a PS_RDY message until the power supply is ready.
2025-09-19 5:42 PM
Hi, thank you for this post, bad things did happen lol.
I'd like to note that NOTIFY_POWER_STATE_CHANGE is received multiple times during negotiation, as shown in the screenshot from the manual:
To avoid issues, ensure you don't check Vbus prematurely, as this notification occurs before the new power is set. This prevents a protocol timeout while awaiting a higher voltage.
Consider setting a flag upon NOTIFY_REQUEST_ACCEPTED. Once this flag is set and a subsequent NOTIFY_POWER_STATE_CHANGE is received, use the ADC to monitor Vbus.
2025-09-23 9:42 AM
Note that the reason for the new NOTIFY_POWER_STATE_CHANGE is because of an explicit negotiation. When you plug in ubsc 5v is delivered by the source right away without any usb power delivery communications. Then the device may ask for something specific (like 9v or something) according to the usb power delivery specification.