USBasp tutorial: Load program into ATmega microcontrollers
The USBasp programmer was designed by Thomas Fischl. Its an open source project and all the circuit diagrams and source codes are available on his website
USBasp is a USB in-circuit programmer for Atmel AVR controllers. It simply consists of an ATMega88 or an ATMega8 and a couple of passive components. The programmer uses a firmware-only USB driver, no special USB controller is needed.
Ofcourse, the first requirement in this post is the USBasp. If you have not already got one, you can get it here.
The USBasp supports a large number of microcontrollers from ATMEL. Here is the complete list.
The most commonly available USBasp has a 10 pin connector as can be seen in the above image. The pinout is as shown below.
USBasp and MCU connections:
If you are using a board that does not have a similar connector port for the programmer, or your MCU is on a breadboard, you will need to connect the pins individually. The table below shows the pins of the USBasp and the MCU that should be connected together.
|USBasp pin number||USBasp pin||MCU Pin|
Once these connections are made, we are good to move ahead.
Once downloaded, extract the contents of the file into a folder.
Now, when you plug in the programmer into the USB port of a windows system, you might need to update the drivers. This can be done in the device manager window.
Go to Start>Device Manager
Look for the device that is newly added. It will be under the “Ports” tab. Right click on it and click “Update drivers” and browse for the folder where you just extracted the drivers.
Loading the code into the MCU:
We are now all set to load the code into the MCU. To do this we will need the hex file of the code. We will also need a software for the same. There are many software out there which are really good and can help you with the task:
- Extreme Burner
- AVR Dude
All you have to do is load the hex file and burn.
USBasp and Arduino:
The USBasp can be used to load the Arduino boot loader into a microcontroller. To do that, connect the programmer to the MCU as mentioned earlier. In the Arduino IDE, select
Tools – Burn Bootloader – w/ USBasp.