Showing results for 
Search instead for 
Did you mean: 

USBX Device CDC ACM problem

Associate III

Hi all,

I am writing to you because I am trying to understand how to make the USB CDC ACM work on the Nucleo U5A5ZJ board. First of all I analyzed some ST webinars and tested the UX_Device_CDC_ACM program which works correctly. I tried to reproduce it starting from Cube MX by checking what had been done in the example project and after generating the code I checked where the code had been added. In the end, despite all the changes, the program does not work because the USB port is not detected by the PC, while with the example program it is detected. I would like to understand some points:

1) I placed the code in the app_usbx_device.c and .h files and in the ux_device_cdc_acm.c and .h files. When compiling there are no errors, but when I connect the nucleo board to the PC the serial port is not recognised, whereas with the ST example program it is recognised. Where could the problem be?

2) In the UX_Device_CDC_ACM project in CubeMX the USART1 to communicate via STLink and also UCPD1 in the "connectivity" section and USBPD in the "Middleware" section are added. What are UCPD1 and USBPD for?

3) To create a simple project in which I send commands / words from the Host PC with the USB type C which are read by the program on the nucleo board which responds if it recognizes them... Do I need to activate UCPD1 and USBPD as well or is it enough to add ThreadX, USBX and USB_OTG_HS in CubeMX?

4) I have analyzed many webinars on ST's YouTube channel, but I don't really understand how I can set up USB with Azure RTOS. Is there a simple, step-by-step guide that explains how to set up and operate USB devices and hosts with Azure RTOS ThreadX?

Thank you very much for the support!

ST Employee


Just few comments, please make sure to take the firmware cube as a reference, in that example the start of the device is based on notification event reported by the USBPD middleware (USB PD manage the typeC power part in addition to cable detection) for more details please refer to ST wiki pages Introduction to USB Power Delivery with STM32 - stm32mcu

Please make sure that your code implements this line of code in order to start the USB device

/* Start device USB */



thank you very much for the advices.

I checked the code and yes there is this line of code in the app_ux_device_thread_entry function.

I checked with IAR debugger and I put some breakpoints. The program arrives in the app_ux_device_thread_entry function. At the beginning it is called the function USBX_APP_Device_Init() that calls the MX_USB_OTG_HS_PCD_Init() function. Then the code stops in the line with

if (HAL_PCD_Init(&hpcd_USB_OTG_HS)!= HAL_OK)

I checked step by step the code and in the HAL_PCD_Init function in the line

if(USB_DevInit(hpcd->instance, hpcd->Init)!= HAL_OK) the results is different than HAL_OK and it is generated an Error.

Do you know what could be the cause?

Then, regarding the USBPD middleware, do I have always to use it with USB type C?

Let me know!

Thank you very much for the support.



Please check the clock configuration of the USB subsystem ,mainly the HS PHY PLL clock. Ensure to use the HSE as input clock

USBPD middleware should be used with TypeC connector to ensure a correct configuration of the port



I checked the Clock configuration panel of my project and of the UX_Device_CDC_ACM project and there are not difference. I do not know where it could be the problem. Do you have other advices?

Let me know!

Thank you very much for the support!