Skip to main content
Visitor II
September 3, 2020
Question

Is it possible to use USB HID keyboard and mouse at the same time on a STM32F469?

  • September 3, 2020
  • 14 replies
  • 8859 views

Hello, I need to understand if it's possible to use both USB HID keyboard and mouse in a project powered by a STM32F469. I have thought about plug a mini HUB and connect both keyboard and mouse. Is there something I can start from? I have searched a lot but I can't find find something similar. Thanks

    This topic has been closed for replies.

    14 replies

    DigimorfAuthor
    Visitor II
    October 2, 2020

    This is true but I can't use external modules.

    I have worked all day on this "difference" in parsing data and I have discovered that the composite device has the mouse interface that sends data in a different way than a normal single interface mouse. So I had to dig deeper and it seems to me that this driver from STMicroelectronics doesn't parse the HID report descriptor given by the device, but assumes it to be a standard (I mean single interface) mouse. Things now are getting harder, of course. If I am not wrong, and any help is appreciated, If I want this driver to be able to parse data correctly I need to implement a more advanced parser, so that it can collect data correctly from the device.

    October 4, 2020

    Hi,

    Mouse is a device, keyboard is another device. To use more than one device on the same USB port, it is necessary to use a HUB. And the STM32CubeIDE library cannot even work with a keyboard with built-in touchpad, so imagine working with HUB.

    Maybe you can use ChibiOS: USB Host stack and driver for STM32

    "- HUB driver, tightly integrated with the high level driver, to connect multiple devices to the USB port." 

    ChibiOS has its own IDE which is also based on Eclipse, and maybe it can be adapted on STM32CubeIDE, as it is also based on Eclipse.

    ChibiOS Homepage

    "ChibiOS is a complete development environment for embedded applications including RTOS, an HAL, peripheral drivers, support files and tools. ChibiOS also integrates external Open Source components in order to offer a complete solution for embedded devices." 

    If you are lucky with this and are able to use HUB I would like to suggest that a Video be made on YouTube explaining step by step how to do it, I would be very grateful, especially if you can use RTOS. But if you can only use USB Host with RTOS and can make a video explaining how to do it, I would also be very grateful.

    I tried to use ChibiOS, but I think I'm already too advanced in my project to start over from the beginning, I use a keyboard on one port and a USB stick on another. But I would like to use the keyboard with the built-in touchpad.

    I commented a little on this in these posts:

    https://community.st.com/s/question/0D50X0000Bviwg0/usb-host-hid-is-there-any-sample-code-for-reading-data-from-two-interfaces-of-the-same-device

    https://community.st.com/s/question/0D50X0000BowGBSSQ2/stm32cubeide-usb-host-fs-15mbits-hid-mini-keyboard-touchpad-wireless-is-stopping-responding-when-it-enters-standby-or-touchpad-mode

    Good luck!

    DigimorfAuthor
    Visitor II
    October 4, 2020

    Thank you for your suggestion, actually in the beginning I thought about using an HUB to support both keyboard and mouse, but since I am going to release a Kit, www.acadeit.net that has a particular look, I don't like really the idea of having many cables around. In any case a wireless composite Keyboard Mouse is a good solution, even esthetically. Currently I got it working perfectly, so as soon as possible I will share the driver.

    Super User
    October 4, 2020

    @rtek1000​ Composite device is not same as hub so the hub driver won't help the OP with a composite device.

    Though hub support is good to have.

    The ST "mouse driver" is just a basic example, it works only with limited number of mice.

    Of course with enough time one can research, bring in some HID parser and develop support for composite devices based on the ST code. But some of us don't have this luxury and are limited by time.

    -- pa

    DigimorfAuthor
    Visitor II
    October 4, 2020

    That is true but the USB port in the ArcadeIT would be used mainly for the keyboard and eventually a mouse. There is the support of a SD card upto 32GB, so no need of a pendrive. A parallel 6 buttons gamepad is provided, so the HUB is not really needed as long as a composite Keyboard Mouse device is working. For the mouse protocol, for now I did a trick, but when I will have time I will try to upgrade the parser.

    Graduate II
    August 31, 2022

    Would this not be just a matter to implement both the mouse and keyboard device descriptors and receive/transmit the packets on the those specific Keyboard and mouse endpoints ?