Hey Everyone,
I have a small amount of experience with Microcontrollers (PIC Microcontrollers a few years ago and I also have a Spark Core now). I have no direct experience with Arduino. But I saw the project on here about connecting a Non-ADB NeXT Keyboard (https://learn.adafruit.com/usb-next-key ... o?view=all) to a computer via Arduino Micro acting as a USB HID. The project seemed easy enough and I have several of those keyboards laying around. I ordered the parts, put it together, flashed the arduino and everything works pretty good. You can see the vine video here (https://vine.co/v/M1P920d6lBd).
That being said, I'm having one issue. It takes several resets for it to boot up properly after plugging it into the computer.
When I plug in the USB into the computer, the blue light on the arduino micro turns on but the yellow light on the other side does not pulse at all.
Then when I hit the reset button, the yellow light pulses but about 3 in 4 times it doesn't boot properly and does not recognize commands from the keyboard.
Sometimes when it boots either the TX or RX lights get stuck on and then the keyboard keys do not work on the Mac. But sometimes neither of the TX or RX lights get stuck on and it still doesn't work.
Usually after resetting for the 4th time it boots up and works normally and then the TX and RX lights light up appropriately when keyboard events are sent or received.
I am using the code straight off the github project from that tutorial (https://github.com/adafruit/USB-NeXT-Keyboard). Can anyone see any issues in the code that would cause this? Anything I can do to debug it?
Thanks!
-Jeff
Arduino Micro takes several resets to boot properly
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 5
- Joined: Sun Apr 20, 2014 7:54 pm
-
- Posts: 5
- Joined: Sun Apr 20, 2014 7:54 pm
Re: Arduino Micro takes several resets to boot properly
So I changed the timing variable from 50 microseconds to 51. That seems to make the resets more reliable. The keyboard now works on every reset. However, when I plug the board into USB, it still requires me to push the reset button to make it boot. Is there a flag or something in the bootloader I need to set so that it boots when it receives power?
- adafruit2
- Posts: 22149
- Joined: Fri Mar 11, 2005 7:36 pm
Re: Arduino Micro takes several resets to boot properly
it should start the bootloader but then disconnect after a few seconds and start up the program as a usb keyboard.
-
- Posts: 5
- Joined: Sun Apr 20, 2014 7:54 pm
Re: Arduino Micro takes several resets to boot properly
Thanks for the reply.
I performed a test where I uploaded only a few lines of code (enough to light up LED 13). In that case, it booted up properly when powered on. The blue light lit up, then LED13 pulsed and then LED 13 lit up solid. However, when compile and upload the keyboard code from the Git project, that no longer happens.
Is there anything obvious in the code that would cause it to not boot properly? If not, I'll do a "split-half" search on the code to try and find which line causes it to no longer boot.
-Jeff
I performed a test where I uploaded only a few lines of code (enough to light up LED 13). In that case, it booted up properly when powered on. The blue light lit up, then LED13 pulsed and then LED 13 lit up solid. However, when compile and upload the keyboard code from the Git project, that no longer happens.
Is there anything obvious in the code that would cause it to not boot properly? If not, I'll do a "split-half" search on the code to try and find which line causes it to no longer boot.
-Jeff
-
- Posts: 4
- Joined: Thu Apr 24, 2014 11:23 pm
Re: Arduino Micro takes several resets to boot properly
Hi, I'm having exactly the same problem. For me, it needs one press of the reset button every time. I am looking forward to finding out how to fix this -- once this is put into a case, there's no way it will be a practical solution if the user has to open the case and press the reset button to be able to type.
Thanks!
Thanks!
-
- Posts: 5
- Joined: Sun Apr 20, 2014 7:54 pm
Re: Arduino Micro takes several resets to boot properly
I posted the issue on element14 and got a good response. I'm still testing it to make sure it works (which is why I haven't posted it here). Adding a delay (1000); or delay(2000); at the beginning of the void setup function seems to fix it.
The person that helped me on element14 guessed that the USB enumeration was hanging it up occasionally. Its still not 100% reliable for me, but its like 95%.
Let me know if it helps yours.
Here is the link to the element14 post. http://www.element14.com/community/thre ... t-properly
The person that helped me on element14 guessed that the USB enumeration was hanging it up occasionally. Its still not 100% reliable for me, but its like 95%.
Let me know if it helps yours.
Here is the link to the element14 post. http://www.element14.com/community/thre ... t-properly
-
- Posts: 4
- Joined: Thu Apr 24, 2014 11:23 pm
Re: Arduino Micro takes several resets to boot properly
I added delay(2000) and it seems to work as you said.
I wonder why that wasn't part of the original program...is it something that Lady Ada didn't experience? Or something related to an updated hardware spec or maybe Windows 8? Strange...
Thanks a lot for the reply!
I wonder why that wasn't part of the original program...is it something that Lady Ada didn't experience? Or something related to an updated hardware spec or maybe Windows 8? Strange...
Thanks a lot for the reply!
-
- Posts: 5
- Joined: Sun Apr 20, 2014 7:54 pm
Re: Arduino Micro takes several resets to boot properly
Yeah. Whats the best way to inform them?
Also, was it hard to get your Arduino to work with Windows8? I use a Mac and it works fine, but when I plugged it into Windows 8 in my Virtual Machine, it said it couldn't find the drivers and the keyboard didn't appear to be typing anything.
Also, was it hard to get your Arduino to work with Windows8? I use a Mac and it works fine, but when I plugged it into Windows 8 in my Virtual Machine, it said it couldn't find the drivers and the keyboard didn't appear to be typing anything.
-
- Posts: 4
- Joined: Thu Apr 24, 2014 11:23 pm
Re: Arduino Micro takes several resets to boot properly
I don't know how to get in touch without just emailing them. Doesn't seem to be a comments link on that article.
My Arduino worked ok with my computer, but I am not using it in a VM, so maybe that is why. I did have to do a little tweaking with the Micro vs the Uno, but no big deal. What kind do you have?
My Arduino worked ok with my computer, but I am not using it in a VM, so maybe that is why. I did have to do a little tweaking with the Micro vs the Uno, but no big deal. What kind do you have?
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Arduino Micro takes several resets to boot properly
We haven't run into that problem with our own versions of using an ATmega32u4 to spoof a keyboard.
What OS and version are you using?
What OS and version are you using?
-
- Posts: 4
- Joined: Thu Apr 24, 2014 11:23 pm
Re: Arduino Micro takes several resets to boot properly
I am using a Microsoft Surface Pro with Windows 8. The problem has only occurred with this particular sketch. The change suggested above seemed to work for me.
Please be positive and constructive with your questions and comments.