Trying to add a bit more wisdom to all the existing information that is around the web based on my tribulations with a SwarmRobot 32u4 based board (core of the Leonardo) and a SeeedStudio Xadow.
As everyone notes, on uploading your code, BOTH the computer AND the Leonardo drop/break the USB connection and then attempt to re-establish. The practical issues that this can cause, is where I had issues and found little information. So here are my 2 cents worth:
If both ends successfully re-connect:-
- the port may have a different name/number. Recent Arduino programming GUI versions usually auto-detect the change. If not, you may have one of the other issues below. Older Arduino programming GUI versions did not auto-detect and you had to manually change the port.
- Sometimes auto-upload works, other times you have to press the Leonardo reset button. It seems to run in streaks, working reliably for auto, then for manual reset. Don’t know how to reliably fix this. Sometimes solutions here work, often not.
- Sometimes Arduino autodetects the port correctly, but does not select it, so you need to check and select it.
If either end does not re-connect, try:-
- unplug USB cable, wait a few seconds then replug it in, then recheck port shows correctly in the Arduino GUI
- sometimes moving USB cable to a DIFFERENT USB port helps
- close and reopen the Arduino programming GUI, especially if you see red messages like “lib rxtx cannot access the com port”.
- reboot your computer and power off/on the Leonardo and if you see the above message. Under Windows 7, the following message usually means a computer reboot for me “processing.app.debug.RunnerException: Couldn’t find a Leonardo on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board’s reset button after initiating the upload.
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:153)” - do all BOTH of the above
- If the com port is greyed out, try selecting the com port during that brief moment of disconnection and before reconnection after board is reset. Using your operating system sound events for this is very handy!
- in addition to HID control of mouse or keyboard that you have programmed, I suspect that on some Leonardo style boards active HID control sometimes causes issues. I use a few seconds delay in setup function to avoid this at least while developing my code, in addition to the generally suggested method to easily disabled HID mouse/keyboard control.
- Sometimes you end up with multiple copies of Avrdude running and using a lot of CPU. For me this occurs occasionally under OpenSuse.
- All my attempts to get OpenSuse working with Xadow failed for weeks, until I left the Xadow plugged in at computer power on/boot, then ran the Arduino GUI with root privilege, then after that the GUI ran OK with userlevel privileges. I really do not understand why this is so!