Is that possible to control the polling rate of a mouse in USB host mode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-19 4:29 AM
HI,
I'm using an STM32F4 device and CubeIDE SW to interface with a mouse as a host with an HID. I use the USBH_HID_EventCallback function to trigger mouse readings.
Can I change the mouse's polling rate so that it will be triggering faster?
The current polling rate (per USBH_HID_GetPollInterval function) is 10ms. In the mouse's data sheet, it states it can reach 1kHz polling rate.
Thanks
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-05-03 3:13 AM
Thanks again guys for your huge help!
So at the usbh_hid.c file, there is a section of HID_Handle initiation. On line 197, the systems gets the default polling rate for the device and verifies it is not shorter than the minimum value, as seen below:
HID_Handle->poll = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[0].bInterval;
if (HID_Handle->poll < HID_MIN_POLL)
{
HID_Handle->poll = HID_MIN_POLL;
}
After these lines, I just add an overwriting value for the polling rate and it works.
Example: HID_Handle->poll = 1U; (for a 1ms polling rate).
Thanks again :)

- « Previous
-
- 1
- 2
- Next »