2025-11-04 4:05 AM
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)
- 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.
Now I need help. The ioc file is included.
Regards
Roman
Solved! Go to Solution.
2025-11-06 4:09 AM - edited 2025-11-06 7:02 AM
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
2025-11-05 2:16 AM
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.
2025-11-05 3:15 AM
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:
2025-11-06 1:46 AM
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.
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.
2025-11-06 4:09 AM - edited 2025-11-06 7:02 AM
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