Electrical – MCP2210 – Plug n’ Play HID Keyboard


I'm working on something at the moment that uses an ESP32. I would like to have simple strings that I can specify within the ESP32 code to automatically "type" on the screen. For example, if I did keyboardWrite("Hello World") and I had a blank notepad open on the PC/Mac, it would automatically write Hello World.

I realise the ESP32 does not have a USB interface, so I decided on using an MCP2210(SPI->USB bridge) to take information (simple strings) from the ESP32 via SPI and then transfer them to the PC. Microchip claims that it is a plug n' play device however they supply a .dll to develop applications for it.

My question is – is there any way to carry this out without having to develop/install any custom software or drivers or any .dll and it would simply be a plug n' play device for PC/Mac. For example, is there any way to embed the functionality of sending keyboard strokes from the MCP2210 itself, rather than through an application on the PC/Mac.

In short, how can I interface an ESP32 to USB to emulate a USB keyboard without any extra software.

Best Answer

USB devices never send anything on their own. To operate, they need a driver on host side to initiate transfers.

In most cases with odd bridges the USB devices are designated to "miscellaneous class" 0xEF, and need a device driver to start communications/device configurations. Usually MCHP supplies these drivers that need to be installed. Then these bridges use proprietary interface to get actual data in and out. That's why you need a library of various API calls on host side, and write an application that uses these calls to communicate with USB bridges as MCP22xx.

The MCP2210 bridge uses HID class as its basic interface, and thus it uses standard OS drivers, with no need of MCHP proprietary drivers. That's apparently is their definition of "plug-n-play". However, conformance to HID class doesn't mean automatically that it is a keyboard, it can be mouse, or joystick, or barcode reader, so you still need their tools and libraries to configure the bridge and send/receive SPI data.