cancel
Showing results for 
Search instead for 
Did you mean: 

Using USB-PD SRC and USB-CDC Device together

Aristy
Associate II

Hi @FBL 

I am working on a similar project like This one (USB CDC ACM device with Power Delivery in Source mode using USBX in standalone mode, FreeRTOS and USBPD with a TCPP02). The STM32 used is the H573I.

I have found some code to add in the function USBPD_DPM_Notification() in usbpd_dpm_user.c (solution you gave).

But in my code, the functions called are undefined because the file usbpd_usb_if.c is not generated. What I am missing?

3 REPLIES 3
FBL
ST Employee

Hi @Aristy 

Would you attach your IOC file?

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.


Aristy
Associate II

Hi @FBL,

Yes, the file is attached.

Note that since I use FreeRTOS, I can't define the USBX stack in middleware via STM32CubeMX. To counter this issue, I have created another project to define the USBX stack without any RTOS (in standalone mode) and generate the code, then, copy / path the code in my project which has FreeRTOS activated.

My problem is, the USB communication woks very well when the Power Delivery is not defined and the Power Delivery is works when the USB communication is not defined. However, when I try both solution at the same time, only Power Delivery works and I don't have any communication.

To debug this, I have connected the USB line between the STM32 and a laptop (on linux) and use the command "dmesg" to get the kernel log :

[12883.502038] ucsi_acpi USBC000:00: unknown error 0
[12883.502043] ucsi_acpi USBC000:00: UCSI_GET_PDOS failed (-5)

Note that I do this in order to send data to a smartphone while charging it.

Thank you for your help.

 

Aristy
Associate II

Hi @FBL,

I have some update about that question, 

I have found out why there is no usbpd_usb_if.c/.h files generated because we need to activate "Enable USB Support" inside the USBPD configuration tab:

Aristy_0-1760963491463.png

When deactivating FreeRTOS and enabling AzureOS and USB Support, I can find the files. But of course, when you activate AzureOs, USBX isn't in Stand-alone mode anymore. In the generated files (usbpd_usb_if.c) we can find some related code :

tx_queue_send(&ux_app_MsgQueue_UCPD, &USB_Host_State_Msg, TX_WAIT_FOREVER) != TX_SUCCESS

Which use a queue "ux_app_MsgQueue_UCPD" defined in the USBX stack newly re-generated. And is only usable with AzureOs.

When debugging, the notification goes well inside the functions : "USBPD_USBIF_HostStart()" and "USBPD_USBIF_HostStop()". Where the code with the queue are.

I am tying to find an alternative to the queue that's works with usbx in standalone mode but I didn't find any source code/example or other question on the topic...

Any help is greatly appreciated since I don't have any new ideas to resolve this problem.

Regards,