Skip to main content
Visitor II
December 20, 2024
Solved

usb power delivery PS_RDY message

  • December 20, 2024
  • 1 reply
  • 981 views

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.

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

    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.)

    1 reply

    alex33AuthorAnswer
    Visitor II
    December 20, 2024

    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.)

    alex33Author
    Visitor II
    December 20, 2024

    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.

    Explorer
    September 20, 2025

    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:

    https://www.st.com/resource/en/user_manual/um2552-managing-usb-power-delivery-systems-with-stm32-microcontrollers-stmicroelectronics.pdf.

     

    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.