Skip to main content
Visitor II
March 6, 2025
Question

STM32G4 UCPD:Debug issue

  • March 6, 2025
  • 3 replies
  • 888 views

Hello, 

I have encountered a similar problem to the one in this link .

I am also trying to use the UCPD Monitor to send message. For example, I request a new voltage from the source using the "Request Power Profile" message from the "Message Selector" , and I always get "Message rejected for this port configuration". 

After some investigations ,I find out that the USBPD_PE_Send_Request() function in the  USBPD_DPM_RequestMessageRequest() function is not working. It returns USBPD_OK the first time I use this function to request another fixed voltage PDO(9V),but actually it is not working. And when I use it again , it returns USBPD_BUSY. Besides, if I request the APDO, it returns USBPD_ERROR.

USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage)
{
 USBPD_StatusTypeDef _status = USBPD_ERROR;
 uint32_t voltage, allowablepower;
 USBPD_SNKRDO_TypeDef rdo;
 USBPD_PDO_TypeDef pdo;
 USBPD_CORE_PDO_Type_TypeDef pdo_object;
 USBPD_USER_SettingsTypeDef *puser = (USBPD_USER_SettingsTypeDef *)&DPM_USER_Settings[PortNum];
 USBPD_DPM_SNKPowerRequestDetails_TypeDef request_details;
 rdo.d32 = 0;

 /* selected SRC PDO */
 pdo.d32 = DPM_Ports[PortNum].DPM_ListOfRcvSRCPDO[(IndexSrcPDO - 1)];
 voltage = RequestedVoltage;
 allowablepower = (puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits * RequestedVoltage) / 1000U;

 if (USBPD_TRUE == USBPD_DPM_SNK_EvaluateMatchWithSRCPDO(PortNum, pdo.d32, &voltage, &allowablepower))
 {
 /* Check that voltage has been correctly selected */
 if (RequestedVoltage == voltage)
 {
 request_details.RequestedVoltageInmVunits = RequestedVoltage;
 request_details.OperatingCurrentInmAunits = (1000U * allowablepower)/RequestedVoltage;
 request_details.MaxOperatingCurrentInmAunits = puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits;
 request_details.MaxOperatingPowerInmWunits = puser->DPM_SNKRequestedPower.MaxOperatingPowerInmWunits;
 request_details.OperatingPowerInmWunits = puser->DPM_SNKRequestedPower.OperatingPowerInmWunits;

 DPM_SNK_BuildRDOfromSelectedPDO(PortNum, (IndexSrcPDO - 1), &request_details, &rdo, &pdo_object);

 _status = USBPD_PE_Send_Request(PortNum, rdo.d32, pdo_object);
 }
 }
 DPM_USER_DEBUG_TRACE(PortNum, "build rdo! _stauts = %d",_status);
/* USER CODE END USBPD_DPM_RequestMessageRequest */
 DPM_USER_ERROR_TRACE(PortNum, _status, "REQUEST not accepted by the stack");
 return _status;
}

Susu_0-1741242599589.png

Susu_1-1741242623726.png

 

 

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    March 11, 2025

    Hi @Susu 

    Thank you for reporting the issue.

    Are you using G474 Nucleo + X nucleo DRP? Would you attach a minimum project to reproduce on my end?

    Explorer
    April 3, 2025

    Hi @Susu , 

    Were you able to implement the complete SINK application? 

    I am facing an issue with SRC PDO selection in cubemonitor.

    Explicit contract has done correctly but unable to select a source PDO.

    RJain1_0-1743701322440.png

     

    Do you have any solution for it!

    Technical Moderator
    April 22, 2025

    Hi @Susu 

    I couldn't reproduce on my hardware setup (using X nucleo DRP).

    First, check if the first request is completed. The USBPD_BUSY indicates that a request is already ongoing. This can happen if the first request did not complete successfully.