Skip to main content
AlexKlimaj
Associate II
January 5, 2019
Solved

STM32G0 USB PD Middleware?

  • January 5, 2019
  • 3 replies
  • 2770 views

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?

This topic has been closed for replies.
Best answer by Yohann M.

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

3 replies

Technical Moderator
January 8, 2019

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
JDahl.15
Visitor II
February 16, 2019

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.

Yohann M.
ST Employee
April 4, 2019

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

AlexKlimaj
Associate II
April 16, 2019

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.

Yohann M.
Yohann M.Best answer
ST Employee
June 5, 2019

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