cancel
Showing results for 
Search instead for 
Did you mean: 

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

Gbang
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3
Yohann M.
ST Employee

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.

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

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