Showing results for 
Search instead for 
Did you mean: 

NUCLEO STM32U575ZI-Q USB Device CDC Problem

Associate II


I am trying to use the STMicroelectronics classic USB device middleware to implement a CDC class in the STM32U575 microcontroller. I am currently working on NUCLEO-u575ZI-Q. At first, I followed the tutorial on "How to use STMicroelectronics classic USB device middleware with new STM32 families" by @B.Montanari  ( but I encountered the same errors pointed out in the tutorial comments by other users with STM32U5. Then, I created a new project and used the "STM32U5 classic core Middleware Firmware Package" repository ( without any success. 

In the end, I created another project using the USB Device CDC Standalone Library for STM32U5 ( and the classic USB Device Middlewares ( In this case, I was able to successfully compile my project without any error but I can't see the VCOM generation on my PC. When entering Debug mode I see that the MX_USB_Device_Init() does not return any error but still, I can't see the VCOM.

In the .ioc file, the USB_OTG_FS is set in "Device_Only" mode, the VBUS is activated and the USB OTG FS global interrupt is enabled. In the RCC, the HSE is set as BYPASS Clock Source, and the LSE is set as Crystal/Ceramic Resonator. In the Clock Configuration settings, I checked that CLK48 Clock Mux returns 48 MHz to USB. In the images below you can see the aforementioned .ioc settings, while the .rar is the last project described.
I would like to know if:
- Is there an available project using the CDC transmit successfully working on the stm32u5 microcontroller? (I couldn't find any)
- Is there an alternative option to implement the CDC class without using threadX and USBX for stm32u5?
- Can it be that the problem is related to Windows 11 drivers?


Best regards












ST Employee

Hello @IlariaCrupi 

Some modifications should be done to the example.

  PeriphClkInitStruct.IclkClockSelection = RCC_CLK48CLKSOURCE_HSI48;

I confirm an issue on myside, and it is linked to the implementation. This issue is reported to dedicated team.

Internal ticket number: 174743 (This is an internal tracking number and is not accessible or usable by customers).

Otherwise, could you check the usart pins being used? PG9 and PA10?



I hope this helps!

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.


Thank you for your quick answer. However, I have already done the modification you suggested, and it still doesn't work. 

As regards your question, on the NUCLEO board I am using the USB-C connector (CN15) and not the STLINK-V3 to implement the USB CDC transmission. 

In the meantime, working on the same project I previously shared with you, I noticed that in the MX_USB_Device_Init() the dev_speed variable of the &hUsbDeviceFS handle is set as USBD_SPEED_HIGH instead of USBD_SPEED_FULL. 

Furthermore, by using an oscilloscope I saw that both the DP and DN lines of the USB connector are silent (both at GND level). In the attached image (Setup USB.jpg) you can see my setup. 

Do you have any clue about that? 

Thanks again. 



You can use my project: 

Just toggle the macros to:

ATT: In C-compiler AND in Assembler macro settings (via project -> properties).

It works on U5A5 and U575 (they differ on USB HS vs. FS PHY in MUC).

VCP UART (CDC) works fine for me (on both MCUs).

But it is not "classical" - it is based on AZURE RTOS and USB stack.

ST Employee

Hello @IlariaCrupi 


If I understand correctly now the issue, your code now goes to Error Handler when trying to run line "((USBD_CDC_ItfTypeDef *)pdev->pUserData[pdev->classId])->Init();" which is in USB_CDC_Init() function of usbd_cdc.c file. 

You need to initialize your configuration correctly (dev_speed  ...). I suggest you check through usbd_cdc.h

  1. data IN and OUT,
  2. command packet size,
  3. the device string descriptors,
  4. size of temporary buffer ...
    I hope this will help you, Otherwise, I suggest if your first questions were answered please close this thread and open new ones if still having issue.

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.


I found out that the error at the line "((USBD_CDC_ItfTypeDef *)pdev->pUserData[pdev->classId])->Init();" was due to the fact that the TIM Base generation in interrupt mode was called twice (both in the CDC_Itf_Init() and in the TIM_Config() functions in usbd_cdc_if.c file). However, my code still stops working and goes to HAL_UART_ErrorCallback(). 

As regards the configurations, I changed the defines and the descriptor settings as explained in the above-mentioned tutorial "How to use STMicroelectronics classic USB device middleware with new STM32 families" but I don't know if there's something else that needs to be configured for the VCOM CDC class to work properly with STM32U5 and I couldn't find anything online. Do you know if there's any specific configuration for STM32U5? 

Attached you can find the last version of the project.