element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Andy Clark's Blog USB Keyboard / HID
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Workshopshed
  • Date Created: 24 May 2020 4:48 PM Date Created
  • Views 4323 views
  • Likes 11 likes
  • Comments 8 comments
  • arduino mkr zero
  • hid
  • usb
  • samd21
Related
Recommended

USB Keyboard / HID

Workshopshed
Workshopshed
24 May 2020

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.

image

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.

image

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.

imageimage

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.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 5 years ago in reply to Fred27 +5
    This is a true story, back when I was just getting into computers, one of the top bosses came around looking for anyone who could program a PDP-11. I told them that I could and they asked if I was willing…
  • Workshopshed
    Workshopshed over 5 years ago in reply to DAB +2
    "2's compliment"
  • DAB
    DAB over 5 years ago +1
    Easy fix, though hard to find. DAB
  • Workshopshed
    Workshopshed over 5 years ago in reply to baldengineer

    I think the root cause is now well known. A change to the way the drivers / enumeration was designed. I will check that the solution specified works, but that can wait till after my demo is done.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago in reply to DAB

    DAB,

     

    Sometimes it is just your presence that fixes things. I have noticed that at work and home that when I simply walk into the room, all the problems in that room people are having resolve themselves, quite often without any intervention from me! Is it just coincidence, or is it something special about me.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 5 years ago

    Interesting, I'm surprised there was an issue. HID devices with the SAMD21 boards is a common application.

     

    If I had my MKR unpacked, I'd join you in troubleshooting.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 5 years ago in reply to DAB

    "2's compliment"

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 5 years ago in reply to Fred27

    This is a true story, back when I was just getting into computers, one of the top bosses came around looking for anyone who could program a PDP-11.

    I told them that I could and they asked if I was willing to do a trip to Huntsville, Alabama to help them solve a computer problem.

    This was my first airplane trip and first business trip.

    So I flew in the next day.

    In the morning I went with our local engineer to the lab and started looking at the problem. They were trying to read a magnetic tape, but all of the values were weird. I took one look at the data and replied, it looks like it is in 2's compliment. The programmer immediately smacked his forehead, ran to his desk, pulled out the format book for the tape, and sure enough, it was in 2's compliment.

    So I solved their problem in about five minutes of work, got a nice dinner and flew out the next morning.

     

    Sometimes, you just need a fresh pair of eyes to see the obvious.

     

    DAB

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube