Skip to main content
Visitor II
March 21, 2025
Question

"STM32F429 USB HID configuration issue - code gets stuck in dev_state check"

  • March 21, 2025
  • 3 replies
  • 1065 views

 

"I configured my STM32F429 with USB HID class communication in CubeMX. After generating the code, I'm having trouble detecting the USB connection on my PC. I've tried debugging and the MX_USB_Device_Init function works correctly, but in the condition that checks if the dev_state has reached 3 for proper configuration, the code gets stuck. How could i solve it?"

    This topic has been closed for replies.

    3 replies

    Explorer II
    March 23, 2025

    The enumeration needs to have completed for USBD_STATE_CONFIGURED. Do you have a usb protocol analyzer? If not you could at least use wireshark to see a bit of what is going on. Maybe not much is going on if your clocks aren't configured or something.

    Visitor II
    March 23, 2025

    Visitor II
    March 23, 2025

    I used USBDeview and didn't detect anything except the debug USB. I'll still try with Wireshark to check.

     

    For the clock, it's properly configured and set to 48 MHz.

    IMG_20250323_111544.jpg

    IMG_20250323_111432.jpg

    IMG_20250323_111508.jpg

     

     

    Explorer II
    March 24, 2025

    Is it a custom board or a discovery STM32F429? Which PHY does it have onboard? OTG_FS or OTG_HS?

    USDBeview won't show anything but Wireshark might. If it's not doing any USB data at all and not just failing enumeration then you might not see anything. Maybe you are connected to the wrong thing? The OTG_FS controller is probably not the one hooked up if it has a OTG_HS controller.

    Edit: Looks like the usb connector is hooked up to the OTG_FS controller on the discovery board. If that's what you are using. 

    Visitor II
    March 24, 2025

    My board is a discovery one and it have OTG-HS controler tkx

    Screenshot_20250324_122859.jpg

    IMG_20250324_123027.jpg