AnsweredAssumed Answered

STM32 HID host class library, mouse mode

Question asked by pavel a on Jan 8, 2018
Latest reply on Jan 17, 2018 by Clive One

I've generated a new project for STM32446 with CubeMX (v. 4.23.0, repository v 1.18)

with USB in host mode and only HID class. On a custom board.

It works right "out of the box" and detects attachment of standard PC keyboard and mice.

Then added code for polling the attached device for reports, borrowed from example app

... STM32Cube_FW_F4_V1.18.0/Projects/STM32F412G-Discovery\Applications/USB_Host/HID_Standalone


This works fine with keyboards, but not with mice. Could not get any report from several mice - Microsoft, Logitech, Mueller and few others.

Has anyone seen standard mouse working with pure Cube generated project?


Actually I need both FS and HS USB cores of STM32446 and configured both in the Cube in FS mode, host only.

Each core is wired to a USB receptacle.

The Cube properly generated two USB host instances, two app callbacks and so on.

Unfortunately I don't know much about USB or HID, just need the stuff working ASAP.

So, spent the weekend browsing the USB HID library code and made the mouse path working, with couple of ugly hacks. If someone can confirm that the library "as is" does not work with mice, I'll post these hacks, otherwise will look for problems on my side.


More to this.... when both mouse and keyboard are connected, they enumerate correctly - but after few seconds of polling, reports from both of them go wild and garbage is received. Haven't investigated enough. It looks like a mere software issue: either some data in the libraries is "static" rather than allocated per instance, or common stuff gets corrupted. But it may be a hardware issue?


Has anyone seen _both_ USB keyboard and mouse (or HID and other device) working together?



-- pa