Skip to main content
Visitor II
July 17, 2020
Question

STM32G071RB USBPD Source auto send Source Cap

  • July 17, 2020
  • 2 replies
  • 4616 views

STM32G071RB USBPD Source auto send Source Cap when start debug: after reset, I'm not connect cable to C-Type port, I click start debug ( ST-Link ), I send about 50 packet of source

Please see in trace and config in attach file

    This topic has been closed for replies.

    2 replies

    H V N DAuthor
    Visitor II
    July 20, 2020

    @Community member​ , please support me

    ST Employee
    July 20, 2020

    Dear @H V N D​ 

    I had a look at your application.

    I can see that you did not implement a way to enable VBUS. Activation of VBUS is done when a CC connection is detected through the 'USBPD_DPM_UserCableDetection' callback:

    /**
     * @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:
     {
     if (USBPD_OK != USBPD_PWR_IF_VBUSEnable(PortNum))
     {
     /* Should not occur */
     osDelay(6000);
     NVIC_SystemReset();
     }
     break;
     }
     case USBPD_CAD_EVENT_DETACHED :
     case USBPD_CAD_EVENT_EMC :
     default :
     {
     if (USBPD_OK != USBPD_PWR_IF_VBUSDisable(PortNum))
     {
     /* Should not occur */
     while(1);
     }
     break;
     }
     }
    /* USER CODE END USBPD_DPM_UserCableDetection */
    }

    To help you in the integration of USB-PD application, I advise you to enable Utilities/TRACER_EMB feature in CubeMX. Please refer to following Wiki page for further details:

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

    Regards,

    Yohann

    H V N DAuthor
    Visitor II
    July 20, 2020

    Hi Yohann,

    the problem is when I enable SRC or DRP mode, I'm not code anything, just build and run, and I see the CAD and PE task running and send some message when I'm not connect anything

    ST Employee
    July 20, 2020

    Hi

    Could you please provide a .cpd trace of your issue?

    I flashed your application in my side and I have no USB-PD activities in my side. PE task is not running when there are no connected cables.

    Regards,

    Yohann