This article is a part of Arduino / ATmega328p Embedded C Firmware Programming Tutorial. Consider exploring the course home page for articles on similar topics.
Also visit the Release Page for Register Level Embedded C Hardware Abstraction Library and Code for AVR.
This tutorial will walk you through the process of configuring Atmel Studio for flashing AVR based Arduino Boards from Atmel Studio Using USBasp. You will also come to know how to install USBasp Drivers.
To flash Arduino Board or any AVR Boards using the ISP interface, USBasp is the cheap and best option. It supports a wide range of AVR Microcontrollers and easy to use.
Using AVR USBasp for programming Arduino Board will give you more Flash memory space than using the Serial USB programming. By default, Arduino Boards uses a Bootloader to program itself without the use of any external programmer hardware but for this to happen Arduino Boards uses 2Kbyte of Flash Memory for Bootloader. If you use USBasp you can utilize this extra 2Kb for your Firmware, and your program will start execution without any delay that Bootloader introduces otherwise.
Before proceeding you must install Arduino IDE as we will use avrdude from Arduino Installation. If you want to know how to install please follow the link.
Steps to configure
Time needed: 15 minutes.
How to Install USBasp Drivers and Configure Atmel Studio to Flash using USBasp
- Install USBasp Drivers
The best and easy way to install USBasp Drivers is by using the Zadig USB Driver Installer.
- Download Zadig from the below link
- Connect the USBasp to your computer
- Open Device Manager
You Should see the ‘!’ mark next to USBasp.
- Open the Zadig Application that you have downloaded
You will see ‘1 device found’ at left corner.
- Select Driver and Install
Select ‘libusb-win32’ and click ‘Install Driver’.
- Driver Installation
It usually takes few moments to install the driver.
- After Successfull Installation
A success message is displayed if everything is ok.
- Open Device Manager
Open Device Manager to Verify Installation. The ‘!’ Mark should not be there.
- Open Atmel Studio
Open Atmel Studio and go to Menu -> Tools -> External Tools.
- Click ‘Add’
A new entry will be created.
- Fill the Text Boxes
Title : USBasp
Command : C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe
Arguments : -C"C:\Program Files (x86)\arduino\hardware\tools\avr\etc\avrdude.conf" -v -p atmega328p -c usbasp -U flash:w:"$(ProjectDir)Debug\$(TargetName).hex":i
Select ‘Use Output Window’
Change the -p parameter based on your AVR chip.
Arduino UNO / NANO Microcontroller > -p atmega328p
Arduino MEGA Microcontroller > -p atmega2560
- Connect the AVR or Arduino Board with USBasp
Make sure to check the correct pin orientation.
- Test the Tool
Go to Menu -> Tools -> USBasp You should see a screen like this: