cancel
Showing results for 
Search instead for 
Did you mean: 

stm32g431 ucpd sink USBPD_DPM_RequestMessageRequest busy forever

IvanFromCyberia
Associate II

Hello,

 

I am running STM32G431 board with USBC PD feature.

CubeIDE 1.14.1

I am trying to bring up the UCPD stack.

I refer the basic guideline:

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Sink

It worked ideally.

Next step I made 2 simple steps:

  1. Save Source capabilities (parse and display it on default thread):

 

 

case USBPD_CORE_DATATYPE_RCV_SRC_PDO: /*!< Storage of Received Source PDO values */ memcpy(my_pdo_rdo_ctrl.pdo, Ptr, Size); my_pdo_rdo_ctrl.num_of_pdo = Size/4;

 

 

     b. Send request with my function (also on default thread):

 

 

USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest_fix(uint8_t IndexSrcPDO){ USBPD_StatusTypeDef _status = USBPD_ERROR; USBPD_SNKRDO_TypeDef rdo; rdo.d32 = 0; rdo.GenericRDO.ObjectPosition = IndexSrcPDO; rdo.FixedVariableRDO.OperatingCurrentIn10mAunits = my_pdo_rdo_ctrl.pdo[IndexSrcPDO - 1].SRCFixedPDO.MaxCurrentIn10mAunits; rdo.FixedVariableRDO.MaxOperatingCurrent10mAunits = my_pdo_rdo_ctrl.pdo[IndexSrcPDO - 1].SRCFixedPDO.MaxCurrentIn10mAunits; _status = USBPD_PE_Send_Request(0, rdo.d32, USBPD_CORE_PDO_TYPE_FIXED); ucpd_printf(0, "FIX USBPD_DPM_RequestMessageRequest %x", _status); return _status; }

 

 

 

Eventually I get this capabilities from my power supply:

 

 

0 IN 256 0 SOP PD3 s:026 H:0x63A1 (id:1, DR:DFP, PR:SRC) SRC_CAPABILITIES DATA: 2C9101082CD102002CC103002CB10400F44106006421A4C1 Option: EPW [1] Fixed : 5V - 3A / [2] Fixed : 9V - 3A / [3] Fixed : 12V - 3A / [4] Fixed : 15V - 3A / [5] Fixed : 20V - 5A / [6] Programmable : [3.3V - 21V] - 5A /

 

 

 

Using this information, I call every 5 second either one:

USBPD_DPM_RequestMessageRequest_fix(2)

or

USBPD_DPM_RequestMessageRequest_fix(3)

 

It operates normally, and I can see requested voltages 9 and 12 volts changing.

However, after some time (always different), the USBPD_DPM_RequestMessageRequest_fix reports it is BUSY, and without reason communications with power supply is not seen.

This is my log:

 

 

2841 PE 640288 0 PE_STATE_READY_WAIT 2842 PE 645150 0 PE_SNK_SEND_REQUEST 2843 OUT 645150 0 SOP PD3 REQUEST s:006 H:0x1282 (id:1, DR:UFP, PR:SNK) DATA: 2CB10420 / ObjectPosition:2 / GiveBack:0 / CapabilityMismatch:0 / USBCommunicationCapable:0 / NoUSBSuspend:0 / UnchunkedExtendedMessagesSupported:0 / MaximumOperatingCurrent:440mA / OperatingCurrent:3000mA 2844 IN 645151 0 SOP s:002 H:0x0321 (id:1, DR:DFP, PR:SRC) GOODCRC 2845 PE 645151 0 PE_SNK_SELECT_CAPABILITY 2846 DEBUG 645151 0 FIX USBPD_DPM_RequestMessageRequest 0 2847 IN 645155 0 SOP PD3 ACCEPT s:002 H:0x09A3 (id:4, DR:DFP, PR:SRC) 2848 OUT 645155 0 SOP s:002 H:0x0841 (id:4, DR:UFP, PR:SNK) GOODCRC 2849 NOTIF 645155 0 POWER_STATE_CHANGE 2850 DEBUG 645155 0 ADVICE: USBPD_DPM_Notification:90 2851 NOTIF 645155 0 REQUEST_ACCEPTED 2852 DEBUG 645155 0 ADVICE: USBPD_DPM_Notification:1 2853 PE 645156 0 PE_SNK_TRANSITION_SNK 2854 IN 645287 0 SOP PD3 PS_RDY s:002 H:0x0BA6 (id:5, DR:DFP, PR:SRC) 2855 OUT 645287 0 SOP s:002 H:0x0A41 (id:5, DR:UFP, PR:SNK) GOODCRC 2856 NOTIF 645288 0 POWER_STATE_CHANGE 2857 DEBUG 645288 0 ADVICE: USBPD_DPM_Notification:90 2858 NOTIF 645288 0 POWER_EXPLICIT_CONTRACT 2859 DEBUG 645288 0 ADVICE: USBPD_DPM_Notification:16 2860 PE 645288 0 PE_STATE_READY 2861 NOTIF 645288 0 STATE_SNK_READY 2862 DEBUG 645288 0 ADVICE: USBPD_DPM_Notification:32 2863 PE 645288 0 PE_STATE_READY_WAIT 2864 DEBUG 650151 0 FIX USBPD_DPM_RequestMessageRequest 0 2865 DEBUG 655151 0 FIX USBPD_DPM_RequestMessageRequest 3 2866 DEBUG 660151 0 FIX USBPD_DPM_RequestMessageRequest 3

 

 

 

USBPD_DPM_RequestMessageRequest 3 ---->>> USBPD_BUSY,

 

Simple Unplug-Plug USB cable restarts UCPD stack and it again operates normally until stops again the same way after some time.

 

I searched for reasonable explanation, but cannot find - what may be the reason of this behaviour? Is it bug or feature? How to debug it?

I observe this with some of UCPD power supplies I have. Not all.

Please help.

 

Kind regards,

Ivan.

1 REPLY 1
FBL
ST Employee

Hello @IvanFromCyberia 

Would you share the trace .cpd ? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.