cancel
Showing results for 
Search instead for 
Did you mean: 

Basic UCPD Sink on STM32G071CBU6

IHend.1
Associate II

Hi,

I am following your guides for the simple USB-PD Sink from here:

https://www.st.com/resource/en/application_note/dm00663511-how-to-build-a-simple-usb-pd-sink-application-with-stm32cubemx-stmicroelectronics.pdf

and here:

https://www.youtube.com/watch?v=Z_Sn6CBbz-k&feature=youtu.be

However, once running, the trace shows only this when I plug in a USB-C source:

0693W000003Pp7jQAC.jpg

From the example video, it should be showing many traces of USB-C PD messaging etc.

Looking at the code, there's several functions in usbpd_pwr_user.c alongside this BSP_PWR_VBUSInit function that are empty (aside from a trace call to tell you so), but the example never shows these being populated.

Am I missing something, is there any examples of what should be put in these functions to get the basic functionality working as shown in the demo?

Thanks,

Iain.

6 REPLIES 6
Guenael Cadier
ST Employee

Hi @IHend.1​ 

Have you done code addition in usbpd_pwr_user.c file, as suggested in video and pdf chapter 5.6.4 ?

If you are using a Nucleo G071 + TCPP01 shield (X-Nucleo-USBPDM1 package), video and document highlighting how to build a SINK application that you mentioned, have been done using CubeMx 5.4.0. Maybe you are using a newer version of CubeMx ?

regards

Guenael Cadier
ST Employee

Another suggestion is to have a look at FW package provided together with X-NUCLEO-USBPDM1 board (that you should be able to find at following address : https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-usbpdm1.html). In this package, you will find an example of a SNK PPS application running on NUCLEO G071 + USBPDM1 shield.

This package is based on newer version of USBPD middleware, and so, file organisation might be slightly different from your CubeMx generated project, but you should be able to find an example of BSP layer in charge of managing the USBPD PWR functions in a specific module that you could find in Drivers\BSP\P-NUCLEO-USBPDM1 directory, in this package.

This could help.

RRavi.1
Associate

In usbpd_dpm_conf.h (in User folder) in DPM_setting global variable just change the following fields to USBPD_TRUE :

 .PE_VDMSupport    .PE_RespondsToDiscovSOP   .PE_AttemptsDiscovSOP.

Hi Guenael, thanks for the response.

Yes, I have added the Vbus reading addition, as well as all the other additions provided.

I am not using a Nucleo board, rather a custom PCB for a power sink module on a new product being developed.

Ah, perhaps you are right about the Cube version - I am using CubeIDE, which I think used CubeMX version 6.

In any case, I have found that the issue is around the GUI - when I disable the GUI, the trace messages all seem to work fine, but with the GUI enabled, it shows only that one trace message I showed in my image. As well as this, the GUI does not seem to work and I cannot see the board in the list of attached boards.

Thanks for the suggestion - I've taken a look at this, and can compile this and flash it to my MCU. In this example, the GUI seems to work (different to when I enable it in my other application). However, I cannot establish PDO contracts etc with this example (only cable detect messages are shown) - I think because the ADC channel is different to that in my final application. However, when I change the Cube ioc file to reflect this and re-generate code, the entire project no longer compiles and lots of errors occur :( Probably due to Cube version mismatches as you say above. But I will look at this for reference, thanks.

Thanks Ravi - yep I have done this, no change to functionality but I believe that it was the GUI causing my lack of trace messages - when disabled I can see PD negotiation happening. Thanks again.