Updating USBasp firmware with Arduino

Alright so you have a USBasp AVR programmer but you just can’t program with it, well you may need to update the firmware.  For some reason, most of the chinese vendors of the USBasp will ship them with old, bad firmware.  We can fix this with few materials.

We need:

  • Arduino
  • Some hookup wires

If you have these, you can go ahead.  If you are wondering, “Why should I use the USBasp if I can use the Arduino to program the AVR on the USBasp?  Why not just use the Arduino instead of the USBasp?”  Well you can, but it really sucks having to swap between sketches on the Arduino just to program another device.  Having a dedicated programmer is extremely nice.

Alright lets get started:



Grab your USBasp programmer.  You’ll notice a couple holes with a box around them title “JP2”, we need to connect those so that we enable the programmers “Self-programming Mode” just like the pictures.



Once you have your USBasp programmer in self-programming mode,  we are going to shift focus over to the Arduino.  Go ahead and plug in your favorite Arduino, I used an Uno for this.  Once that is plugged in, open up the Arduino IDE.  The program we need ships with every version of the IDE, go to File->Examples->ArduinoISP.  This will open up the program that will effectively turn the Arduino into an AVR programmer.  Select your Arduino in the boards selection and the proper COM port as well; then program the Arduino with the ISP sketch.



Your Arduino is now an AVR programmer!  Now we’ll turn our attention back to the USBasp.  Download avrdude and unzip the contents to a folder where you won’t move it, I have put it in my Documents folder under my user directory.  Note that if you complete the setup with Atmel Studio, you can’t move avrdude or it’ll break the setup.  Once that is unzipped, download the latest USBasp firmware.  You are going to have to unzip this twice since what you download is a .tar.gz file which then unzips a .tar file and then once you’ve unzipped that, you’ll have the actual files.  This is illustrated below:

  • usbasp.2011-05-28.tar.gz
    • usbasp.2011-05-28.tar
      • usbasp.2011-05-28
        • bin
          • firmware (USBasp device firmware in here)
            • usbasp.atmega8.2011-05.28.hex
          • win-driver
            • libusb_1.2.4.0
              • (Drivers located here)
        • circuit (USBasp circuit design / schematics)
        • firmware (firmware source code in here)
        • Changelog.txt
        • Readme.txt


After you have unzipped everything and have the files, we want to copy the usbasp.atmega8.2011-05.28.hex to the same directory where avrdude is.  Once you have that, move on to the next step.



Now that we have the software and firmware all ready, we now need to connect the USBasp up to the Arduino.  Make sure that the JP2 jumper on the USBasp is connected.  Once that is verified, hook up the two parts like in the image below.


After you’ve hooked up the two pieces, go ahead and plug in the Arduino to your PC, don’t plug in the USBasp.  Nothing would really happen since they both connect to USB which is 5V but just don’t do it, on the off chance one of your USB ports goes down, shoving 5V down the VCC line wouldn’t be good until you knew why it went down.  Doesn’t happen that often but just covering all the bases.



Now that we have all the hardware connected up, all the firmware is ready to go, and the software is in place, we need to now program the USBasp.  This is where it can get tricky.  Open up a command line tool.  If you are on Windows, press Windows+R to open up the run window.  Type in “cmd” to bring up the command prompt.  The default directory you end up in should be your User directory.  We need to navigate to the directory where you have put the avrdude executable.  You can use three simple commands to navigate to wherever you have put avrdude.exe.

  • Use “dir” to list the files and folders in your current directory
  • Use “cd” followed by the name of the folder you’d like to change your current directory to.
  • Use “cd ..” to go up a directory, similar to going back like in a browser.

Once you are in the directory where your avrdude is located, we are going to use a command to execute the programming of the USBasp.  The template is:
avrdude -P comport -c avrisp -p m8 -v -U flash:w:usbasp.atmega8.2011-05-28.hex  where comport is which com port your Arduino is on, this’ll most likely be the same on that it says in the Arduino IDE, but you can find out in the device manager as well.  Once you have that command all typed up and proper, press enter and watch the magic.  If it comes back with an error, google it.  There are a number of errors that can happen and I can’t possibly explain all of them.


Now that your USBasp has been programmed with the latest firmware, the hard part is over!  You still have yet to install the USBasp device driver for windows though.  Go ahead and unplug the Arduino, seperate it from the USBasp, pull off the jumper connecting the two pins at JP2 on the USBasp, and plug in the USBasp to your PC.  Your Windows will try to install the device with drivers it can find but it won’t be able to.
Go to the Device Manager and look under “Other Devices”, you should see USBasp with an exclamation point.  That means that Windows has seen it but can’t install it properly.  Double click it and click “Update Driver”.  A window will pop up and ask you to either locate the driver or automatically find it.  Click on the bottom one so that we can locate the driver for Windows, when you do that, a window will come up and you’ll need to map to the “win-driver” directory that is pointed to in the usbasp firmware directory above.  After you accept that, Windows will try to install the driver.  If you are greeted with a “Device isn’t signed” error or something of the sort, you will need to disable the Device Signature Enforcement feature of your Windows installation.  Once that is all good to go, you are done!

Now that you are done, you can program any AVR you want!  Happy programming!

Posted in Pre-Graduation, Uncategorized.