2025-07-22 6:29 AM - edited 2025-07-22 7:26 AM
I have been testing the USBPD firmware examples SNK1M1_Sink and DRP1M1_DRP (the board is the NUCLEO-G474RE). When a PD source is connected to the board running either example and then the board is reset, it will then renegotiate the contract with the source.
I have my own project (STM32G0B1RE) with two ports, a UFP (sink) and a DRP (sink/source). When I connect a source to either port and then reset the board, it doesn't renegotiate the contract like the firmware examples. I need to get this behaviour so that the board will behave correctly if it has to reset.
Can anyone help me to work out why? I have tried resetting the board with the debugger attached, and confirmed that USBPD_DPM_UserCableDetection() gets called with State=USBPD_CAD_EVENT_ATTACHED on the connected port after reset (so the source is detected).
For now I am focussing only on the UFP, so please ignore any DRP/tcpp03 code below.
Here are the parts that I've changed from the defaults. Please let me know if you need any other code.
Code: https://pastebin.com/cyBgLdFK
Thanks in advance,
Richard