cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 USB PD Middleware?

AlexKlimaj
Associate II

Hello,

I have built a board using the STM32G0 with the intention of utilizing the USB PD middleware.

I pulled the middleware from STM32CubeG0 into my project, but I can't get it to build without errors.

The USB PD demo project in the STM32CubeG0 does not look like it uses the stock middleware. Is there one that does?

1 ACCEPTED SOLUTION

Accepted Solutions
Yohann M.
ST Employee

Hello Alex,

On github, I can see that your solution seems working. Main pb I saw was a conflict between DMA channels used between UCPD and TRACE.

I suggest to close this thread.

Yohann

View solution in original post

8 REPLIES 8
Imen.D
ST Employee

Hello @AlexKlimaj​ ,

Could you please provide more details in order to analyze your issue.

What is the error message that you have?

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
JDahl.15
Associate

I too am wondering about how to leverage this middleware. I have spent a good deal of time looking through the code (DemoUCPD), here is my understanding.

  • For a custom board, a new BSP must be written that contains functions such as `BSP_PWR_VBUSInit` which are referenced in many places in the `Devices/STM32G0XX` code.
  • For a custom application, many of the files found in `DemoUCPD` such as `usbpd_dpm_user.c` must be rewritten to and tailored to the specific application, but provide the function calls the core library expects .
  • All of the Policy Engine code is hidden in `Core/lib`, there may be other code hidden in there as well. Why is this only provided as object code? Might it be useful to see the source?

My main struggle I am having is in understanding the intended usage of this middleware in a custom application. Many of the functions seem very application specific for the EVAL board, and I am having a hard time figuring out what I need to do to make this work for me. Does ST provide any kind of implementation guide or reference for using this middleware outside of the EVAL Demo application? I would really appreciate if someone could detail how to use this middleware, and the appropriate process for implementing the necessary changes such as the BSP and user files.

An user manual is under review and will be provided soon.

It will provide further information how to use different parts of the application.

We will keep in touch as soon as this document will be available.

In waiting for it, if you have any specific questions, let us know!

Yohann

EDIT: I fixed the hardfault by changing

 extern void USBPD_PORT1_IRQHandler(void);
 USBPD_PORT1_IRQHandler();

to

extern void USBPD_PORT0_IRQHandler(void);
USBPD_PORT0_IRQHandler();

I was thinking that I needed to change it originally to Port1 since I am using the second USBPD controller on the STM32G0.

https://github.com/AlexKlimaj/LiPow-Firmware

Okay, I've got the USB PD Middleware pulled into my project and building. I had to comment out three calls to tracer since I don't have that in the project nor do I think I need it. Unless there is a way to use STM32CubeMonUCPD through UART? I have a FreeRTOS CLI running on the UART already.

I have it initializing the UCPD peripheral and starting the FreeRTOS task successfully, but I am getting a hardfault on the UCPD interrupt handler on its first call. This is the line that causes the hardfault.

Removed. See above post.

Hello Alex,

To use STM32CubeMonUCPD , you have to integrate GUI_INTERFACE module in your environment. This module is use to communicate with PC application.

FreeRTOS_CLI was used for X-CUBE-USBPD package and it is no more supported on our latest FW delivery done on G0. All the information are displayed now directly on the cubeMon-UCPD.

I suggest to disable FreeRTOS-CLI from your environment and use only GUI interface.

Regards

Yohann

Yohann M.
ST Employee

Hello Alex,

On github, I can see that your solution seems working. Main pb I saw was a conflict between DMA channels used between UCPD and TRACE.

I suggest to close this thread.

Yohann

​For your information, User Manual UM2552 is now available on ST Website : UM2552: Managing USB power delivery systems with STM32 microcontrollers