Skip to main content
Visitor II
November 4, 2025
Solved

USBPD using CubeMX on H573DK

  • November 4, 2025
  • 2 replies
  • 217 views

Hi,

I am trying to get USBPD running. I need a simple example code without RTOS. So I used CubeMX. As far as I see it should be easy. All I need to do is:

- Turn on the UCPD1 under Connectivity. Here I set "Source". 

- Turn on the UCPD1 Interrupt

- Turn on USART1 

- Set the DMA settings of UCPD1 and USART1 (here I have used the settings of the working CubeH5 project)
DMA.png

- Turn on USBPD under middlewares

- Enable TRACER under utilities

- Enable TRACER in USBPD under middlewares

- Enable GUI_INTERFACE under utilities

 

This config should work, but it is not working. There is no event handling.
Mon.png

Now I need help. The ioc file is included.

 

Regards

Roman

 

 

 

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

    Hi,

    thanks for the replay. The tracer and the GUI interface is working well. But you helped me. Based on your answer I am now comparing all files between CubeH5 and CubeMX. The files usbpd_pwr_user.c/h are identical except the date. 

    So far I found some differences in:

    - usbpd_pdo_defs.h

    - usbpd_pwr_if.c

    - usbpd_dpm_user.c/.h

     

    I found the problem its the TCPP03-M20 on the discovery board. There is a driver needed.

    After copy of these files its doing better:
    stm32h573i_discovery_bus.c
    stm32h573i_discovery_bus.h
    stm32h573i_discovery_conf.h
    stm32h573i_discovery_errno.h
    stm32h573i_discovery_usbpd_pwr.c
    stm32h573i_discovery_usbpd_pwr.h
    tcpp0203.c
    tcpp0203.h
    tcpp0203_reg.c
    tcpp0203_reg.h

    Not fully working but thats okay. I now switch to a simpler hardware.

     

    Regards

    Roman 

     

     

     

     

    2 replies

    RomThiAuthor
    Visitor II
    November 5, 2025

    What I already found out is, that the CubeH5 code with RTOS shows more messages at start when there is no USBPD connection:

     

    0 DEBUG 2 0 -- BSP_USBPD_PWR_Init --
    1 DEBUG 38 0 -- BSP_USBPD_PWR_SetRole : SRC --
    2 DEBUG 39 0 -- BSP_USBPD_PWR_SetPowerMode --
    3 DEBUG 39 0 -- Low Power --
    4 DEBUG 39 0 GUI Memory is corrupted
    5 CAD 40 0 USBPD_CAD_STATE_DETACHED

     

    So the first four are missing in the CubeMX code.

     

    RomThiAuthor
    Visitor II
    November 5, 2025

    I added the define TCPP0203_SUPPORT manually. Now I see:

    0 DEBUG 0 0 ADVICE: Update BSP_USBPD_PWR_SetRole
    1 DEBUG 0 0 ADVICE: Update BSP_USBPD_PWR_SetPowerMode
    2 DEBUG 0 0 GUI Memory is corrupted
    3 CAD 0 0 USBPD_CAD_STATE_DETACHED

     

    I found also out, that the UCPD1_IRQHandler is hit only one time. But the interrupt is on:
    Reg.png 

    Technical Moderator
    November 6, 2025

    Hi @RomThi 

    You need to implement BSP_USBPD_PWR_xx() weak functions in usbpd_pwr_user.c/h or import BSP board related drivers to use properly the tracer and GUI interface.

    In the current ST USB PD stack implementation, the evaluation of source capabilities and the decision to send a new request message are delegated to the application layer. The stack does not autonomously evaluate capabilities; current design allows flexibility to accommodate different application requirements.

    RomThiAuthorAnswer
    Visitor II
    November 6, 2025

    Hi,

    thanks for the replay. The tracer and the GUI interface is working well. But you helped me. Based on your answer I am now comparing all files between CubeH5 and CubeMX. The files usbpd_pwr_user.c/h are identical except the date. 

    So far I found some differences in:

    - usbpd_pdo_defs.h

    - usbpd_pwr_if.c

    - usbpd_dpm_user.c/.h

     

    I found the problem its the TCPP03-M20 on the discovery board. There is a driver needed.

    After copy of these files its doing better:
    stm32h573i_discovery_bus.c
    stm32h573i_discovery_bus.h
    stm32h573i_discovery_conf.h
    stm32h573i_discovery_errno.h
    stm32h573i_discovery_usbpd_pwr.c
    stm32h573i_discovery_usbpd_pwr.h
    tcpp0203.c
    tcpp0203.h
    tcpp0203_reg.c
    tcpp0203_reg.h

    Not fully working but thats okay. I now switch to a simpler hardware.

     

    Regards

    Roman