cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID Boot profile so that STM32 acts as a ''keyboard'' for a Nexys 4 DDR

code
Associate
Posted on September 13, 2015 at 01:33

Hi,

we are re-creating a computing classic: The Commodore 65.

http://www.mega65.org.

. The heart is a Nexys 4 DDR board.

The Nexys 4 DDR has an USB Host, that only can work with USB HID devices (e.g. keyboard, mouse), that are implementing the ''legacy/boot protocol''. AFAIK this HID boot mode originally was invented to simplify BIOS development, i.e. using USB keyboards at PCs to control BIOS settings.

I need to use a STM32 to act as a ''keyboard'' (i.e. USB HID device) for the Nexys 4 DDR board, as we want to use a custom STM32 based PCB to be our ''keyboard controller'' (connecting an original Commodore 65 keyboard to the GPIOs of the STM32 and translating it to USB scancodes).

Unfortunatelly, the STM32 USB stack does not seem to support the ''HID boot protocol'' mode (even though the file ''

usbd_hid_core.c

'' claims to do so in the comment in line &sharp14).

Wikipedia :

''Keyboards that implement the USB Boot Keyboard profile specified in the USB Device Class Definition for Human Interface Devices (HID) v1.11 and are explicitly configured to use the boot protocol will interrupt the CPU every time the keyboard is polled even if there is no change in state unless the USB controller overrides this behavior, and are limited to 6-key rollover (6KRO). This profile is intended to allow the BIOS to handle a USB keyboard in the absence of a USB-aware operating system.''

And the original

http://www.usb.org/developers/hidpage/HID1_11.pdf

sais on page 74

''The Boot Keyboard shall send data reports when the interrupt in pipe is polled, even when there are no new key events. The Set_Idle request shall override this behavior as described in the HID Class specification.''

I am not 100% sure if this (the bold marked sentence above) is the reason, why it does not work, but this is where I am currently standing.

Any help highly appreciated.

(Maybe there are alternative LIBs for the STM32 that I can use to implement a ''keyboard'' that runs in the HID boot mode? I googled a lot but dit not find anything.)

Best regards

  Mirko

#stm32-usb
2 REPLIES 2
code
Associate
Posted on September 16, 2015 at 11:41

For the AVR Teensy, there is a C source code, that is supporting the HID Boot profile. The description sais: ''This code also supports the keyboard 'boot protocol' for compatability with the BIOS before an operating system has loaded.''

Here is the LINK:

https://www.pjrc.com/teensy/usb_keyboard.html

Does anybody have an idea, if this USB code can be ported to the STM32 somehow?

Or - does anybody have an idea where to start, when I want to ''teach'' the STM USB drivers to respect the USB HID Boot profile?

Posted on September 16, 2015 at 18:18

I suspect the ST code probably does about 80-90% of what you want. You're going to have to review the code and it's current interactions and descriptors, and compare/contrast that with implementations you know work with the protocol you require.

Maybe there are commercial stack vendors that have a solutions that more closely fits your requirements.

Not sure there's a deep roster here that's going to dig through all this stuff, and fix/code this for you. Tsuneo comes here occasionally, and he has about the deepest USB understanding of anyone around.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..