cancel
Showing results for 
Search instead for 
Did you mean: 

Are some STM32 MCU development board libraries incomplete purposefully?

JNiin.1
Associate II

Hello, this is my first time asking something in here.

I'm trying to create a USB PD consumer application on STM32G071B Discovery board.

I've created a USB PD project in STM32 Cube MX.

Many critical functions relating to USB PD have no content.

Downloadable library for mentioned board:

STM32Cube_FW_G0_V1.3.0

More specifically the USBPD_Analyzer demonstration project. 

Many critical functions relating to USB PD have no content.

Also I've tried crossreferencing some functions with a similar library meant for a Nucleo board:

STM32CubeExpansion_USBPD_F0

It has many functions named the same way, but with contents.

Am I supposed to write those critical functions myself?

And if that's the case, then I don't even know where to begin.

I can't help but feel like I'm missing something here.

Any kind of help is much appreciated!

Edit:

Also I'm following stm32 UM2552.

8 REPLIES 8
KnarfB
Principal III

Can you pls. give an example what you are missing?

JNiin.1
Associate II

Thank you for your reply!

USBPD_DPM_UserInit() and USBPD_DPM_SetupNewPower - both located in usbpd_dpm_user.c

Every function located in usbpd_pwr_if.c

For example USBPD_PWR_IF_Init()

So these functions for example don't have any contents. Just a fixed "return USBPD_ERROR;".

Hmm. Don't have your board, so I cannot run the code.

But in the STM32CubeIDE project

STM32Cube_FW_G0_V1.3.0\Projects\STM32G071B-DISCO\Demonstrations\USBPD_Analyzer\SW4STM32\STM32G071B-DISCO_USBPD_Analyzer

file

/STM32G071B-DISCO_USBPD_Analyzer/Application/User/usbpd_dpm_user.c

implements USBPD_DPM_UserInit() in line 153-187

and

/STM32G071B-DISCO_USBPD_Analyzer/Application/User/usbpd_pwr_if.c

implements USBPD_PWR_IF_Init in lines 216-241.

I think many of the projects are just frameworks, allowing them to be customized for the specific application, with the appropriate level of function and error checking/recover, and provide project engineers with job security.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Statement of the year: "...and provide project engineers with job security" :D

But replace "...allowing them to be customized..." with "...needing them to be reinvented by customers for getting implemented by ST after the customers have done ST´s job..." ;)

Thank you for the reply!

I had imported this project in a way that it did not have anything in /user.

I reimported and it's all good.

Thank you so much!

I have a follow-up question.

I noticed that the said STM32 CubeMX generated project has a function called "USBPD_PWR_IF_SetProfile" - it's empty.

The analyzer demonstration project does not have an equivalent function.

Any ideas where to look?

Glad it works for you.

> I have a follow-up question.

Sorry, I'm not an expert in USBPD.

Hello

Source code generated by CubeMX is based on generic templates used for dual role, source and sink applications.

In your case (sink application), the function 'USBPD_PWR_IF_SetProfile' (called in USBPD_DPM/PE_SetupNewPower) is used only by source (or DRP) applications. It is why this function is empty in your case and not found at in the discovery application.

Applications generated by cubeMX are mainly empty and you have to fill it with your own applications. You can use reference in the official FW package release to update it accordingly. UM2552 should be used also as reference for your development.

For your information, most important function have been highlighted thanks to helper debug trace like:

DPM_USER_DEBUG_TRACE(PortNum, "HELP: xxxx");

You should see these debug traces into Cubemonitor-UCPD tool (further information in the thread how to use debug trace (_TRACE) ?)'

Do not hesitate also to go though our Wiki page: https://wiki.st.com/stm32mcu/wiki/USB_Power_Delivery_overview

For sure, we are still trying to update our code/document to ease end customers to implement easily their own applications.

Feel free in you have another questions!

Regards,

Yohann