Skip to main content
Visitor II
December 2, 2019
Solved

When using stm32g0 ucpd as source, it won't send source capabilities?

  • December 2, 2019
  • 1 reply
  • 1390 views

I setted it by stm32cubemx, and just used ucpd1 as source, but it won't send source capabilities when connected the sink devices.

I'm not sure it's the code or the hardware influenced it. I tested it in nucleo-stm32g071rb, and connected sink devices by ucpd1_cc1, ucpd1_cc2 and GND.

And I try to use USBPD_PE_Request_DataMessage(port_num, USBPD_DATAMSG_SRC_CAPABILITIES, NULL); to send a source capabilites, but return USB_BUSY.

    This topic has been closed for replies.
    Best answer by Yohann M.

    EVAL-G0 description with extension board MB1350 is available in UM2403.

    1 reply

    ST Employee
    December 2, 2019

    In source, PE should start only if VBUS has been enabled, please refer to application '.\Projects\STM32G081B-EVAL\Applications\USB-PD\USB-PD_Provider_1port\' in usbpd_dpm_user.c:

    /**
     * @brief UserCableDetection reporting events on a specified port from CAD layer.
     * @param PortNum The handle of the port
     * @param State CAD state
     * @retval None
     */
    void USBPD_DPM_UserCableDetection(uint8_t PortNum, USBPD_CAD_EVENT State)
    {
    /* USER CODE BEGIN USBPD_DPM_UserCableDetection */
     switch(State)
     {
     case USBPD_CAD_EVENT_ATTACHED:
     case USBPD_CAD_EVENT_ATTEMC:
     {
     osDelay(110);
     if (USBPD_OK != USBPD_PWR_IF_VBUSEnable(PortNum))
     {
     /* Should not occurr */
     HAL_Delay(6000);
     NVIC_SystemReset();
     }
     break;
     

    USBPD_BUSY answered by  USBPD_PE_Request_DataMessage function is linked to the fact that there is no explicit contract yet.

    I suggest you to adapt your application with the source application delivered on EVAL-G0.

    To debug such issues, you can use the debug trace. You can enable it through TRACER_EMB utility available in CubeMX (please refer to this video to enable it).

    Thanks to CubeMonitor-UCPD, you can generate the log.

    GbangAuthor
    Visitor II
    December 2, 2019

    Hello, is there any information for which Pin to check and what voltage is in STM32G081B-EVAL\Applications\USB-PD\USB-PD_Provider_1port?

    And I tested the callback function USBPD_DPM_UserCableDetection won't be tigger.

    0690X00000AtBFbQAN.png

    Yohann M.Answer
    ST Employee
    December 2, 2019

    EVAL-G0 description with extension board MB1350 is available in UM2403.