Skip to main content
THama.1
Associate
Jun 22, 2020 6:18 PM UTC
Solved

Cannot get USB Host HID on STM32F4xx to detect a USB device

Hello,

I am trying to retrieve data from a USB mouse with a STM32F429IGT. (The reason that I typed F4xx in my question is because I tried on other F4 series MCUs)

To make sure that my wiring is correct, i connected D+ D- to PA11 and PA12 that are soldered to a microUSB. Plugging it to the computer, I detect it (on the computer), no problem. I also verified that the voltage and current are sufficient when microUSB is not plugged.

Also, the HSE is set as well, and I have a crystal oscillator that is set in RCC as Crystal/Ceramic Resonator. I can tell that it is working because I already used USB with this STM32 as a VCOM in device mode.

Disconnecting microUSB and the mouse afterwards, I activate USB_OTG_FS as host HID through CubeIDE and try the given example of mouse. However, when I plug the mouse back, nothing happens. It seems that phost->State never changes from the HOST_IDLE state. Further investigation reveals that the function USBH_LL_Connect, that, from my understanding, detects that something is on the data lines and helps in changing the state is not called when I connect my mouse.

I should point out that I am not using VBUS or activate it in anyway.

Could you help me or point out a direction of research? The tutorials on Internet make it very simple, and I don't get why I have so much trouble... Do I have to activate some kind of interrupt? Is VBUS mandatory (it seemed to me that no)?

Thanks.

This topic has been closed for replies.
THama.1
THama.1Best answer
Associate
Jun 23, 2020 8:50 PM UTC

I found my error. I left the functions for VCOM communication. I presume my code got stuck in the receive or send function...

I feel a bit foolish for my question :smiling_face_with_halo:

1 reply

THama.1
THama.1AuthorBest answer
Associate
Jun 23, 2020 8:50 PM UTC

I found my error. I left the functions for VCOM communication. I presume my code got stuck in the receive or send function...

I feel a bit foolish for my question :smiling_face_with_halo: