Introduction: Fixing Bootloader on Arduino Leonardo - ProMicro With USBasp

I have been using instructables for lots of projects, now is my turn to contribute.

Here is a problem that I've seen a lot "My Arduino is Loosing its Code After a Power Cicle", well let's fix that. I had a USPasp laying arround from one time that I flashed my Turnigy 9x with OpenTX, and my recently bought arduino Leonardo was loosing the program when plugged in the power bank. In my research I found this solution installing arduino bootloader, this tutorial may work for you if you don't have a USBasp. In general this hole thing is very simple to solve so don't worry! Let's see the steps.

Step 1: Setting Up USBasp in Your Computer

I used windows 10 to do this, at first a had a problem to install de USBasp driver in my computer so I found this Install USBasp driver on windows 8 and 10 by Rohit Khosla, it worked for me, thanks by the way. I don't know if I should repeat his steps in here, leave a comment about that. For now I will just leave the link.

Step 2: Find the Pins of Your Arduino and Hookup the Wires

In here found the pins for my arduino, the pins that you're looking for are MISO, MOSI, SCK, the other ones are probably explicit in the board, are VCC, GND and RST. Remember to look for the pins corresponding to your board. If the ATMEGA microcontroller is used for the first time (fresh), the jumper wire on AVR-USBASP must be shorted as shown in the photo above. Else the communication may fail. It is due to the new fresh microcontroller are factory programmed for slow internal oscilator, thus we have to tell the USBASP programmer to program with slow speed. It is done by short the jumper wire above. It takes a longer time during the programming as it is programmed with slow speed. After the ATMEGA microcontroller is programmed for the first time, the mini jumper may disconnect (open) and the programming will be faster. watch that the grove in the cable and in the board, they would fit together, just an observation that may help you to get the right pins.

Step 3: Burning the Bootloader, This May Take Few Minutes

  1. After connect the AVR-USBASP from your computer to the arduino board, open the arduino IDE and click on Tools menu and under the Programmer sub-menu select USBasp.
  2. Then, click on the Burn Bootloader to start burning the bootloader under Tools menu.
  3. During the burning progress, the arduino software will display like photo above. If the jumper wire on the programmer is shorted, the programming process may take up to 5 minutes as it is in slow speed. So be patient!
  4. Arduino IDE will display “Done burning bootloader” after it is done! That’s all!