2025-04-04 5:58 AM
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.o, usbpd_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
2025-04-07 4:26 AM
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
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.