Skip to content

USBasp tutorial: Load program into ATmega microcontrollers

USBasp

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.

 

USBasp

Ofcourse, the first requirement in this post is the USBasp. If you have not already got one, you can get it here.

Supported Microcontrollers:

The USBasp supports a large number of microcontrollers from ATMEL. Here is the complete list.

Mega Series

ATmega8ATmega8AATmega48ATmega48AATmega48P
ATmega48PAATmega88ATmega88AATmega88PATmega88PA
ATmega168ATmega168AATmega168PATmega168PAATmega328
ATmega328PATmega103ATmega128ATmega128PATmega1280
ATmega1281ATmega16ATmega16AATmega161ATmega162
ATmega163ATmega164ATmega164AATmega164PATmega164PA
ATmega169ATmega169AATmega169PATmega169PAATmega2560
ATmega2561ATmega32ATmega32AATmega324ATmega324A
ATmega324PATmega324PAATmega329ATmega329AATmega329P
ATmega329PAATmega3290ATmega3290AATmega3290PATmega64
ATmega64AATmega640ATmega644ATmega644AATmega644P
ATmega644PAATmega649ATmega649AATmega649PATmega6490
ATmega6490AATmega6490PATmega8515ATmega8535

Tiny Series

ATtiny12ATtiny13ATtiny13AATtiny15ATtiny25
ATtiny26ATtiny45ATtiny85ATtiny2313ATtiny2313A

Classic Series

AT90S1200AT90S2313AT90S2333AT90S2343AT90S4414
AT90S4433AT90S4434AT90S8515
AT90S8535

CAN Series

AT90CAN128

PWM Series

AT90PWM2AT90PWM3

USBasp pinouts:

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 pinouts

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 numberUSBasp pinMCU Pin
1MOSIMOSI
5ResetReset
7SCKSCK
9MISOMISO
10GNDGND
2VccVcc

 

Once these connections are made, we are good to move ahead.

Driver update:

The USBasp requires drivers to be updated on windows platform. The drivers are available for download here. Preferably download the latest firmware.

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:

  1. Extreme Burner
  2. AVR Dude
  3. Khazama

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.

 

Leave a Reply

Your email address will not be published. Required fields are marked *