cancel
Showing results for 
Search instead for 
Did you mean: 

stm32g431 ucpd sink stack fail at -o2/-o3/-oFast optimization levels

IvanFromCyberia
Associate II

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.

However, if I add in my code a call "USBPD_DPM_RequestMessageRequest()", the operation gets broken.

Negotiation with Source fails, leading to power loss, and call "USBPD_DPM_RequestMessageRequest()" is not even reached.

I tried to search for the solution, but only found this, something probably related:

https://community.st.com/t5/stm32-mcus-other-solutions/stm32g0-usb-pd-source-stack-periodically-sends-hard-resets-when/td-p/230775 

 

Is there anybody, who hit the same issue?

It is definitely source code issue. Is there a fix?

 

Kind regards, Ivan.

1 REPLY 1
Pavel A.
Evangelist III

While waiting for more helpful replies - can you shuffle the working code a little, to see if there's something like code/data memory overflow? Add some debug prints, led blinking...