I've been experimenting with the Arduino MKR Zero board and wanted it to act as a USB keyboard. This board is based on the SAMD21 processor core which has a native USB wired to one of the sercom peripherals. But when I tried it out the keyboard was not sending data to the PC.

I swapped to the simplest example I could find but still no luck. I also tried the https://github.com/NicoHood/HID library to see if that worked any better than the Arduino one but no luck.

 

Looking in device manager, the keyboard was not showing up and the MKZero was reporting an error.

On the advice of one of the forums, I downloaded USBDeview. That showed a bit more detail as to what was going on.  The Arduino was reporting as a HID device but it was hooked up to a serial driver. That did not seem right.

I did a bit more searching and found that someone else had also had problems with this device. https://github.com/arduino/ArduinoCore-samd/issues/423

Looks like the problem is complicated because the board is a composite device supporting multiple USB devices e.g. a CDC (virtual com port), a HID and also a real serial port.

 

As the original commenter had reported that this issue started with a specific version of the boards package, I rolled back to the one before that version and that seems to have resolved the issue. Now sending keystrokes to the host does what it should.

The follow up on the forum is interesting in that Arduino have reversed the order of USB enumeration in the firmware. So to get the keyboard to work on the MKR Zero with Windows 10 you need to do the upgrade then remove the old drivers. Windows 10 can use it's own drivers apparently. I'll give that a try after finishing this little project.