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.

 

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

ATmega8 ATmega8A ATmega48 ATmega48A ATmega48P
ATmega48PA ATmega88 ATmega88A ATmega88P ATmega88PA
ATmega168 ATmega168A ATmega168P ATmega168PA ATmega328
ATmega328P ATmega103 ATmega128 ATmega128P ATmega1280
ATmega1281 ATmega16 ATmega16A ATmega161 ATmega162
ATmega163 ATmega164 ATmega164A ATmega164P ATmega164PA
ATmega169 ATmega169A ATmega169P ATmega169PA ATmega2560
ATmega2561 ATmega32 ATmega32A ATmega324 ATmega324A
ATmega324P ATmega324PA ATmega329 ATmega329A ATmega329P
ATmega329PA ATmega3290 ATmega3290A ATmega3290P ATmega64
ATmega64A ATmega640 ATmega644 ATmega644A ATmega644P
ATmega644PA ATmega649 ATmega649A ATmega649P ATmega6490
ATmega6490A ATmega6490P ATmega8515 ATmega8535

Tiny Series

ATtiny12 ATtiny13 ATtiny13A ATtiny15 ATtiny25
ATtiny26 ATtiny45 ATtiny85 ATtiny2313 ATtiny2313A

Classic Series

AT90S1200 AT90S2313 AT90S2333 AT90S2343 AT90S4414
AT90S4433 AT90S4434 AT90S8515
AT90S8535

CAN Series

AT90CAN128

PWM Series

AT90PWM2 AT90PWM3

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 number USBasp pin MCU Pin
1 MOSI MOSI
5 Reset Reset
7 SCK SCK
9 MISO MISO
10 GND GND
2 Vcc Vcc

 

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 *