Skip to main content
Visitor II
December 14, 2020
Solved

Initialization of ADC for USBPD?

  • December 14, 2020
  • 2 replies
  • 1766 views

Does the ADC need to be initialized in a special way for the USBPD stack to work properly?

I am trying to implement PD on a STM32G431 and the USBPD stack doesn't seem to work. If a powersource is connected, the CAD state changes to ATTACHED but then it immediately changes to DETACHED and waits for the VBUS voltage to drop to zero, which doesn't happen because the source is still attached and supplies the standard 5V.

The stack is resetting right after the attached state.

    This topic has been closed for replies.
    Best answer by FGeig.1

    Nevermind, I found out what's wrong.

    CRC needs to be active for USBPD to work (I was either too dumb to find a reference for this or to make the "obvious" connection after looking at PD communications, or it's just not clearly described anywhere). In the example projects CRC is initialized with the Trace utility so you never have any issues there.

    So if you're USBPD stack is hard resetting after first successfully receiving messages from a PD device you probably forgot to activate CRC.

    2 replies

    FGeig.1AuthorAnswer
    Visitor II
    December 16, 2020

    Nevermind, I found out what's wrong.

    CRC needs to be active for USBPD to work (I was either too dumb to find a reference for this or to make the "obvious" connection after looking at PD communications, or it's just not clearly described anywhere). In the example projects CRC is initialized with the Trace utility so you never have any issues there.

    So if you're USBPD stack is hard resetting after first successfully receiving messages from a PD device you probably forgot to activate CRC.

    ST Employee
    December 16, 2020

    Dear @FGeig.1​,

    could you please provide use a cpd file (USB-PD trace)?

    Remind: https://wiki.st.com/stm32mcu/wiki/USB_Power_Delivery_overview#Specific_tools

    Thanks,

    Yohann

    FGeig.1Author
    Visitor II
    December 16, 2020

    Hi @Yohann M.​ ,

    Thank you for your response!

    Unfortunately I can't use the Trace utility but the problem was that CRC was not activated and neither was the Trace utility. Activating CRC solves the hard reset issue, everything is working as expected now.

    ST Employee
    December 16, 2020

    Our internal PD is very useful for us (but also for you) to debug the PD protocol and internal states of the USB-PD lib.

    Just for our information, what is the blocking issue to use the trace utility?

    For your information, we suggested another way to connect the trace:

    https://wiki.st.com/stm32mcu/wiki/USB_Power_Delivery_overview#How_to_connect_the_trace_TRACER_EMB_with_no_ST-LINK_on_my_board-3F

    Yohann