Skip to main content
Visitor II
April 4, 2025
Solved

STM32G071 disco USBPD_Analyzer

  • April 4, 2025
  • 1 reply
  • 388 views

Hi,

I am trying to modify the USBPD_Analyer Demonstration to use a fixed PDO definition in the usbpd_pdo_defs.h

Eventually I would like to modify it to create a source slave as it is not available in the CubeMonitor-UCPD but to begin with I am just adding the fixed sources already in the code.

I have commented out 

#define _USBPD_PWR_IF_C      in usbpd_pwr_if.c 

to use the definition of

PORT0_PDO_ListSNK[USBPD_MAX_NB_PDO]  in the usbpd_pdo_defs.h

and I have also added 

#include "usbpd_pwr_if.h" to the usbpd_pdo_defs.h

as the compiler was warning of implicit declarations of PWR_A_50MA, PWR_V_100MV etc.

Now when I compile the project I get

multiple definition of PORT0_PDO_ListSNK 

multiple definition of USBPD_NbPDO 

in usbpd_dpm_core.ousbpd_dpm_user.o, bsp_gui.o  and gui_api.o

I can see that PORT0_PDO_ListSNK is used in these file but don't understand why it thinks there are multiple definitions. 

I would be grateful if you could explain what I am doing wrong or let me know how to define a PDO definition for a source slave.

Thanks 

 

 

    This topic has been closed for replies.
    Best answer by FBL

    Hi @aber 

    An internal ticket is already submitted to developers to adjust include order to ensure that macro __USBPD_PWR_IF_C is defined before usbpd_pdo_defs.h is included. Check this thread as well Re: Issue with MACROs after generating code using ... - STMicroelectronics Community

    1 reply

    FBLAnswer
    Technical Moderator
    April 7, 2025

    Hi @aber 

    An internal ticket is already submitted to developers to adjust include order to ensure that macro __USBPD_PWR_IF_C is defined before usbpd_pdo_defs.h is included. Check this thread as well Re: Issue with MACROs after generating code using ... - STMicroelectronics Community