Skip to main content
Visitor II
November 28, 2024
Solved

STM32H523 classic USB CDC library

  • November 28, 2024
  • 2 replies
  • 1417 views

Hi,

I am creating a project using the STM32H523 microcontroller. One of the planned functionalities is USB CDC communication with a computer (as a virtual COM port device). Since I do not plan to use RTOS, I would like to use the classic USB library.

Initially development was done on the Nucleo board with STM32H503. Using this guide I managed to implement everything.

https://community.st.com/t5/stm32-mcus/how-to-use-stmicroelectronics-classic-usb-device-middleware-with/ta-p/599274

Problems appeared when switching to the target platform (STM32H523). The hardware was connected as on Nucleo (D+ to pin PA12, D- to PA11). CubeMX was configured analogously, the rest of the code was transferred. Unfortunately, after connecting to the computer there is no reaction, the USB device is not detected.

Does anyone have an idea what could be wrong? Is it also necessary to connect the VDET pin, and if so, where is the pin configuration in the code?

I tried to debug the problem on the HW side. There is no communication on the D+ and D- lines after connecting to the computer (the lines have GND level). I tried to manually add a 1.5k resistor between the D+ line and 3.3V. After that, the oscilloscope showed that some communication occurred, but the computer after a while displays the message "USB device not recognized". I tried different clock sources, different configurations in CubeMX, but the effect is still the same.

I will be grateful for any information and suggestions :)

Regards

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

    Ok, 

    I found out, that there was an issue with the HAL_PWREx_EnableVddUSB(); line (it was missing in the usb.c file). Now everything works. 

    Thank you for your help ans support :)

    2 replies

    Graduate
    December 6, 2024

    Check the content of PWR->USBSCR register. USB33SV bit should be set to 1.

    SlawomirZ98AuthorAnswer
    Visitor II
    January 4, 2025

    Ok, 

    I found out, that there was an issue with the HAL_PWREx_EnableVddUSB(); line (it was missing in the usb.c file). Now everything works. 

    Thank you for your help ans support :)