cancel
Showing results for 
Search instead for 
Did you mean: 

Where I can find the example of usbpd_dpm_user.h ?

Eremizin
Associate II

Hello!

I am tryig to create my own USBPD project on P-NUCLEO-USB002, and using UM2552 manual.

I add to project some files (see screenshot) 0693W000001qusqQAA.jpgand have compile error.

On the page 20 there is string: "For details see the file usbpd_dpm_user.h, which contains the structure definition for USBPD_HandleTypeDef." And the thing is that there is no such file in X-CUBE-USBPD STM32_USBPD_Library files. Only in Projects\STM32F072RB-Nucleo\Applications\USB_PD\EVAL_FUSB307_DRP\Src I can find it, but I dont think, that it is correct to use it in my project.

3 REPLIES 3
Yohann M.
ST Employee
Eremizin
Associate II

Hello, @Yohann M.​ .

Thank you for answer!

Ok, G0/L5/L4 this models have UCPD on the board.

But if want to use x-code-usbpd with F0?

There is (https://github.com/STMicroelectronics/STM32CubeF0/tree/master/Projects) no examples for usb power delivery, looks like.

I just little understand, how I have to create this files?

Because STM32CubeMX generate it when I am using G0 series controller, but it is have different name.

But when I trying to use library after read the user manual um2552 there is no enouth info to create project.

I understand that it is complex and difficult project, and I understand that I have to read alot of info, but what I have to read?)

Even in USB-PD Core Stack User Maual this files are not included and looks like this files I have to write by myself, but how to do it correct?

Hello,

DPM user code is a common code between all the platforms. You may use G0/L5/G4 code as example and use it for your F0 applications.

In the X-CUBE-USBPD, you will have the same files as well:

(.\Firmware\Projects\STM32F072RB-Nucleo\Applications\USB_PD\EVAL_FUSB307_DRP\Inc\usbpd_dpm_user.h)
 
/**
  * @brief  USBPD DPM handle Structure definition
  * @{
  */
typedef struct
{
  uint32_t                      DPM_ListOfRcvSRCPDO[USBPD_MAX_NB_PDO];   /*!< The list of received Source Power Data Objects from Port partner
                                                                              (when Port partner is a Source or a DRP port).                       */
  uint32_t                      DPM_NumberOfRcvSRCPDO;                   /*!< The number of received Source Power Data Objects from port Partner
                                                                              (when Port partner is a Source or a DRP port).
                                                                              This parameter must be set to a value lower than USBPD_MAX_NB_PDO    */
  uint32_t                      DPM_ListOfRcvSNKPDO[USBPD_MAX_NB_PDO];   /*!< The list of received Sink Power Data Objects from Port partner
                                                                              (when Port partner is a Sink or a DRP port).                         */
  uint32_t                      DPM_NumberOfRcvSNKPDO;                   /*!< The number of received Sink Power Data Objects from port Partner
                                                                              (when Port partner is a Sink or a DRP port).
                                                                              This parameter must be set to a value lower than USBPD_MAX_NB_PDO    */
  uint32_t                      DPM_RDOPosition;                         /*!< RDO Position of requested DO in Source list of capabilities          */
  uint32_t                      DPM_RequestedVoltage;                    /*!< Value of requested voltage                                           */
  uint32_t                      DPM_RequestedCurrent;                    /*!< Value of requested current                                           */
  int16_t                       DPM_MeasuredCurrent;                     /*!< Value of measured current                                            */
  uint32_t                      DPM_RDOPositionPrevious;                 /*!< RDO Position of previous requested DO in Source list of capabilities */
  uint32_t                      DPM_RequestDOMsg;                        /*!< Request Power Data Object message to be sent                         */
  uint32_t                      DPM_RequestDOMsgPrevious;                /*!< Previous Request Power Data Object message to be sent                */
  uint32_t                      DPM_RcvRequestDOMsg;                     /*!< Received request Power Data Object message from the port Partner     */
  volatile uint32_t             DPM_ErrorCode;                           /*!< USB PD Error code                                                    */
  volatile uint8_t              DPM_IsConnected;                         /*!< USB PD connection state                                              */
  uint16_t                      DPM_CablePDCapable:1;                    /*!< Flag to keep information that Cable may be PD capable                */
  uint16_t                      DPM_CableResetOnGoing:1;                 /*!< Flag to manage a cable reset on going                                */
  uint16_t                      DPM_Reserved:15;                         /*!< Reserved bytes                                                       */
  USBPD_SDB_TypeDef             DPM_RcvStatus;                           /*!< Status received by port partner                                      */
#if defined(USBPDCORE_SNK_CAPA_EXT)
  USBPD_SKEDB_TypeDef           DPM_RcvSNKExtendedCapa;                  /*!< SNK Extended Capability received by port partner                     */
#endif /* USBPDCORE_SNK_CAPA_EXT */
  USBPD_GMIDB_TypeDef           DPM_GetManufacturerInfo;                 /*!< Get Manufacturer Info                                                */
  volatile uint16_t             DPM_TimerAlert;                          /*!< Timer used to monitor current and trig an ALERT                      */
  USBPD_ADO_TypeDef             DPM_SendAlert;                           /*!< Save the Alert sent to port partner                                  */
  USBPD_ADO_TypeDef             DPM_RcvAlert;                            /*!< Save the Alert received by port partner                              */
#if defined(_GUI_INTERFACE)
  volatile uint16_t             DPM_TimerMeasReport;                     /*!< Timer used to send measurement report                                */
#endif /* _GUI_INTERFACE */
  USBPD_DiscoveryIdentity_TypeDef VDM_DiscoCableIdentify;                /*!< VDM Cable Discovery Identify                                         */
} USBPD_HandleTypeDef;

This structure is an user structure to be tuned for own USB-PD usage.

Could you please clarify your compilation issues?

At 1st, I can see that the stack library you use is not correct one. For P-NUCLEO-USB002, you have to select 'USBPDCORE_PD3_FULL_CM0_Keil.lib'.

For your information, old applications used for P-NUCLEO-USB002 (MB1303) are available in the package V2.1.0 in github:

=> example of DRP project: https://github.com/STMicroelectronics/x-cube-usb-pd/tree/x-cube-usb-pd-v2.1.0/Projects/STM32F072RB-Nucleo/Applications/USB_PD/MB1303_DRP_RTOS

Regards,

Yohann