With this converter you can change keymap and use functions
TMK firmware offers on your USB keyboard.
This project depneds heavily on
USB Host Shield 2.0 library.
TroubleshootYou have trouble or question? Ask in this thread.
- Use
this firmware for debug
- And use
hid_listen command to see its debug outputs.
- Let me know your keyboard model name, URL of the product page would be helpful to check its specifications and manuals.
- 'USB descriptor' would be helpful for debug if possible. Refer this for how to get
USB descriptor.
HardwareYou need USB host controller chip MAX3421e and AVR chip ATMega32U4.
1. TMK USB to USB converterThis small board is almost equivalent to USB Host Shield plus Leonardo. No soldering job is needed.
You can buy an assmebled converter here to support my project.
PCB design files are available.
https://github.com/tmk/USB2USB_ConverterCase design file is available here. Thank you, Gouty@github! 2018-10/27
New!https://github.com/tmk/USB2USB_Converter/tree/master/3D%20Printed%20Case2. USB Host Shield 2.0 + Arduino LeonardoJust plug USB Host Shield onto Arduino Leonardo, they are not small as keyboard converter but work well with default firmware.
a. USB Host Shield:https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/http://shop.tkjelectronics.dk/product_info.php?products_id=43https://www.sparkfun.com/products/9947https://store.arduino.cc/usa/arduino-usb-host-shieldClones may have compatiblity issues with the library and TMK. Not recommended.https://github.com/felis/USB_Host_Shield_2.0/issues/76#issuecomment-159269359b. Arduino Leonardo:http://arduino.cc/en/Main/arduinoBoardLeonardo3. Mini USB Host Shield 2.0 + Pro MicroNot supported by me but this should work too. Firmware may require small fix. See these references.
https://www.pjrc.com/teensy/td_libs_USBHostShield.htmlhttps://geekhack.org/index.php?topic=80421.0a. Mini USB Host Shield 2.0https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-minihttp://shop.tkjelectronics.dk/product_info.php?products_id=45b. Pro Micro or Teensyhttps://www.sparkfun.com/products/12587https://www.pjrc.com/store/teensy.htmlFirmwareThis converter is part of TMK keyboard firmware project. Source code for the converter firmware is available here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usbBuildYou can compile firmware from source code. See TMK documentation for the detail.
More
$ git clone git://github.com/tmk/tmk_keyboard.git
$ cd tmk_keyboard
$ git submodule init
$ git submodule update
$ cd converter/usb_usb
$ make clean
$ make
To reduce firmware size you can disable functions you don't use by commenting out following lines. Note that 'make clean' is needed after Makefile is editted.
NKRO is meaningless practically on this converter and it should be disabled always.
# Build Options
# comment out to disable the options.
#
MOUSEKEY_ENABLE ?= yes # Mouse keys
EXTRAKEY_ENABLE ?= yes # Media control and System control
CONSOLE_ENABLE ?= yes # Console for debug
#COMMAND_ENABLE ?= yes # Commands for debug and configuration
#NKRO_ENABLE ?= yes # USB Nkey Rollover
https://github.com/tmk/tmk_keyboard/blob/master/converter/usb_usb/Makefile#L93-L97No idea? No problem, you can use easy TMK keymap editor instead, see below.
ProgramFor TMK converterFirst, press tiny button on TMK converter to turn it into program mode.
To program converter with your own firmware you can use 'dfu-programmer' tool.
More
dfu-programmer atmega32u4 erase --force
dfu-programmer atmega32u4 flash <your_firmware.hex>
dfu-programmer atmega32u4 reset
If you have installed build tools you can just 'make' like this.
make dfu
Or you can use 'Atmel FLIP' as well. Refer to this wiki page for other program tools.
https://github.com/tmk/tmk_keyboard/wiki#flash-firmwareFor USB Host Shield 2.0 + Arduino LeonardoMore
Push reset button on Leonardo before run this command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.
$ DEV=COM17 make program
or
$ avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:usb_usb.hex -PCOM17
TMK Keymap EditorUSB to USB converter supports TMK keymap editor now!You can edit keymapping and get your custom firmware easily with this.

Start here: Default
plain layoutOr
SpaceFn layout example on
Keymap Editor.
Limitation- Only supports 'HID Boot protocol'(6KRO) mode. Many of NKRO keyboards still can work in 6KRO mode. (Confirmed NKRO keyboards: see 'Compatible Keyboards' list.)
- Media/System control keys on keyboard are not recognized by the converter. Note that you can still send them with TMK firmware by remapping keys.
- 'Fn' key on keyboard is not recognized. In most case keyboards don't spit out scancode for 'Fn' key. You cannot remap the 'Fn' key itself.
- Firmware size. USB to USB converter uses alot of flash space to support USB keyboard. Some combination of TMK features can not fit into MCU flash size(28KB). To reduce firmware size you have to disable some of features you don't use, see 'Firmware' section above.
- No mouse or other pointing devices support. To support all pointing devices is difficult but it is possible to support one specific device if you are willing to write code for that. https://geekhack.org/index.php?topic=69169.msg2193024#msg2193024
Incompatible KeyboardsThe converter doesn't work with:
Converter firmware has been fixed and evolved gradually these years, some of them may work with the latest firmware.
Use this firmware to get detailed debug outputs on hid_listen if your keyboard doesn't work. And post its outputs here. keyboard's USB descriptor would be helpful for debug.Compatible KeyboardsIf your keyobard works well with BIOS/EFI you can expect the converter handle it reasonably. But it is still not 100% assured, the covnerter can fail to handle the keyobard with some reasons unfortunately while the converter firmiware has been gradually updated to improve compatiblility.
Report from you would be really appreciated. Please post your result in this thread.Update2020/12 Fix
STALL error2020/11 Fix
TAP_KEY2020/11 Add
Mechanical Locking Key support2020/11 Fix
TOGGLE error and
HUBPRE bit.
2019/05
Fix startup stuck problem2019/05
Fix Rollover error handling2018/11 Update firmware(Use fixed LUFA stack and update USB_Host_Shield_2.0)
2018/11 Add Filco Majestouch2 87 and ikbc KD87 to compatility list
2018/07 Update firmware to
fix startup issue. see
this commit.
2018/10 Add design file for enclosure
2018/02 Update "Reported keyboards" section
2017/05 Fix startup code for FC660C
2016/09 New keymap editor(unimap) is available
2016/01 Add Keymap editor
2015/12 Add Firmware size to limitations, and recommendation for genuine host shield
2015/11 Add keymap for JIS and ISO
2015/07 Bug fix for keyboard sending ErrorRollOver report
2015/07 Add Locking key indicator support
2015/06 Updated Limitation and TODO
2015/02 TMK USB to USB converter Rev.A
2014/12 Added Hub support(confirmed with HHKB pro2)