Timing Issues w/ USB Communication through CDC
Interrupts Atmega32u4’s built in CDC driver for USB communication can have timing issues when messing with the watchdog timer, sleep modes, and timer interrupts. I am unsure of how to fix this issue if you continue to use code that interferes with the CDC. I recommend trying a different method than using the interrupt timers.
Wrong Bootloader It’s possible to brick your Pro Micro 5V/16MHz if you used the wrong board selection with the wrong frequency. If you upload the wrong frequency, the IC will not be able to understand any new code that is being uploaded. It expects to have code that is compiled for another bootloader, instead of using the 16MHz frequency with the oscillator.
When either of these cases happens, the device manager is not able to recognize the device and is usually seen as an “unknown device” when the microcontroller runs the sketch. There are ways to recover the an Atmega32U4 (i.e. LilyPad Arduino USB – Atmega32U4 board, FioV3 – Atmega32U4, Pro Micro 5V/16Mhz, Pro Micro – 3.3V/8Mhz, etc) if this happens. Check below for more information:
A.) Upload when LilyPad USB with Atmega32U4/Pro Micro/FioV3 is still in Bootloader Mode
You can try the double reset method by tapping the RST pin to GND twice (since there is no reset button on the board) as explained in the Troubleshooting sections labeled as Reset to Bootloader and How to Revive a “Bricked” Pro Micro => https://learn.sparkfun.com/tutorials/pro-micro-fio-v3-hookup-guide/troubleshooting-and-faq.
1.) Open the Arduino IDE.
2.) Choose a simple code to upload on the Arduino. I used the blink test code from the hookup guide [ https://learn.sparkfun.com/tutorials/pro-micro-fio-v3-hookup-guide#example-1-blinkies ] to upload.
3.) Check your Tools>Port menu for the list of COM ports when the Arduino is connected. You will probably not see it in the list.
4.) Click somewhere else to stop viewing the list of COM ports.
5.) Ground the RST button 2x as stated in the Troubleshooting and FAQ [ https://cdn.sparkfun.com/assets/6/d/3/4/a/523c8e23757b7fbe5f8b4584.png ].
6.) Re-open the Tools>Port menu to view the list of COM ports again to see what the Pro Micro enumerates to when its in its bootloader. There is an 8 second window to view the COM port when the board is in bootloader mode.
Note: Feel free to use the device manager at this step. Opening up the device manager on your operating system will help to see when the Arduino pops up and disappears.
7.) Select the COM port that the Pro Micro is on before it disappears again.
8.) Hit the Upload button to compile and upload.
9.) Wait a few seconds for the Arduino IDE to compile code. The progress bar should be just over the halfway mark.
Note: On Windows, this takes about 20 seconds to compile and upload. The device will show up as “SparkFun Pro Micro (COM##)”. Trying this on a Mac seemed a little faster to compile and upload.
10.) Hit the reset button twice again to place the Pro Micro in bootloader mode while the Arduino IDE is uploading.
11.) If successful, you will have no error messages the Arduino IDE will tell you that it is “Done uploading.”
After selecting the correct board definition and timing the double reset method correctly, I was able to upload successfully. It took me a couple of tries before I could get this right because of the timing. You should not need to go through this recovery procedure for subsequent uploads unless you brick the Atmega32U4 again.
–
B.) Outdated or Corrupt drivers
If board is showing up as Arduino Micro (COM##) or Pro Micro (COM##), try the double reset method and updating the drivers while still in bootloader mode:
1.) Use the double reset method while having the device manager open.
2.) When the board entered the bootloader mode, I right-clicked on the Arduino board in the device manager as shown in this screen shot: [ http://puu.sh/iaYYC/d45153914c.png ]
3.) I updated the driver for the board.
4.) Once the update was completed, I compiled and uploaded the code. When the uploading status bar was half-way through, I did double reset again and the problem was fixed.
–
C.) Reinstalling the Bootloader
As a last result, you can always try to reinstall the bootloader. The tutorial is designed for the Arduino Uno, but it should work for Atmega32U4’s bootloaded with Arduino. The idea is the same but the specifics are different. Start by reading the tutorial => https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader. The first thing you are going to need is an AVR programmer. You can use a standard AVR programmer or any Arduino with the ISP code on it (the standard code will not work with the Leonardo). You will then need to connect it to the target device (i.e. LilyPad Arduino USB, Pro Micro, Fio V3, Makey Makey, or Leonardo) to reflash the bootloader. Don’t worry about the fuse bits or even the avrdude commands (they’re great, if you are installing third party stuff, but this will work just fine).
1.): Get a programmer
This you can do by following the directions in the tutorial.
2): Connect the programmer/Arduino as ISP to the Target Device
You will need to connect to the same pins to your target device (i.e. LilyPad Arduino – USB, Pro Micro, Fio V3, Makey Makey, or Leonardo). On the Leonardo you can connect it just like the Uno. The LilyPad Arduino – USB has small ICSP pins. I managed to solder wires directly to the pins for access. The Pro Micro does not have an ISP header and the pin numbers are different. Check the tutorial for location of the pins on the programmer. Here are the pins for the Pro Micro Board:
ICSP Pins <=> Pro Micro Pin GND <=> GND RST <=> RST VCC <=> VCC MISO <=> D14 SCK <=> D15 MOSI <=> D16
Note: There is a silkscreen error and D17 is labeled D14 on the Pro Micro.
3.) Program Using Arduino v1.6+ go under Tools and select the correct programmer (if your programmer uses a COM port select that too), and the correct board (LilyPad Arduino – USB, Pro Micro, FioV3, Makey Makey, or Leonardo). Then select Burn Bootloader. For the Pro Micro, this will use the bootloader in the addon file, so make sure you have the correct addon file installed. You can find the latest board definitions from the SparkFun GitHub Repository [ https://github.com/sparkfun/Arduino_Boards ].