cancel
Showing results for 
Search instead for 
Did you mean: 

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

Justindellbit
Associate

 

"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?"

5 REPLIES 5
Parawizard
Associate III

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.

Justindellbit
Associate

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

 

 

Parawizard
Associate III

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. 

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

Screenshot_20250324_122859.jpg

IMG_20250324_123027.jpg