2026-03-25 5:48 AM - edited 2026-03-26 1:31 AM
Hi everyone!
I have generated a code from CubeMX for USB-PD in bare-metal configuration like this:
Then I started testing the code and the function USBPD_PE_Init at this line:
/* PE SET UP : Port 0 */
CHECK_PE_FUNCTION_CALL(USBPD_PE_Init(_port_index, (USBPD_SettingsTypeDef *)&DPM_Settings[_port_index], &DPM_Params[_port_index], &dpmCallbacks));returned false.
I have looked in the assembler window and found out that some members of
static const USBPD_PE_Callbacks dpmCallbacks =
{
USBPD_DPM_SetupNewPower,
USBPD_DPM_HardReset,
NULL,
USBPD_DPM_Notification,
USBPD_DPM_ExtendedMessageReceived,
USBPD_DPM_GetDataInfo,
USBPD_DPM_SetDataInfo,
USBPD_DPM_EvaluateRequest,
NULL,
NULL, // Like this one!!!
USBPD_PE_TaskWakeUp,
#if defined(_VCONN_SUPPORT)
USBPD_DPM_EvaluateVconnSwap,
USBPD_DPM_PE_VconnPwr,
#else
NULL,
NULL,
#endif /* _VCONN_SUPPORT */
USBPD_DPM_EnterErrorRecovery,
USBPD_DPM_EvaluateDataRoleSwap,
USBPD_DPM_IsPowerReady
};are not allowed to be NULL. So I wonder if this is normal or I'm missing something?
THX!
Solved! Go to Solution.
2026-03-26 3:41 AM
Hi @fjahn9
To better understand and reproduce the issue, could you please share your project setup (e.g. project files and configuration)?
If it contains confidential information, you can either send it to me in a private message or grant access to this GitHub account:: https://github.com/FBLSTM
We will treat any shared information as confidential and use it only to analyze this issue.
Thank you!
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.
2026-03-26 3:41 AM
Hi @fjahn9
To better understand and reproduce the issue, could you please share your project setup (e.g. project files and configuration)?
If it contains confidential information, you can either send it to me in a private message or grant access to this GitHub account:: https://github.com/FBLSTM
We will treat any shared information as confidential and use it only to analyze this issue.
Thank you!
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.
2026-03-26 6:53 AM
Hi FBL,
thank you for your reply, but somehow during preparing the project to be sent, I regenerated the project in CubeMX one more time and now I can run my softwere without errors! I can see how software reacts on cable attachments, so this question can be marked as solved. Anyway, can you post here how to switch a Data role? I have used USBPD_DPM_RequestDataRoleSwap(PortNum) function, but nothing happened. Could you have a look at my project's files anyway?
Thank you!