How to program Arduino using ATMEL Studio 7

Good Tutorial – Read this if you want to learn how to program Arduino Due using ATMEL Studio 7.

This tutorial shows how to program Arduino using ATMEL Studio 7. For illustration purpose we will write simple C program for blinking LED connected to Arduino UNO board. We will explain the tools you need, how to configure the tools, how to write C program in ATMEL studio and finally compile and upload to the Arduino UNO.

Programming Arduino using ATMEL Studio 7 has numerous advantages such as lower byte, higher performance, more control etc. In this tutorial we assume that you have installed Arduino IDE already.

Steps to program Arduino using ATMEL Studio 7

Following are the steps you need to follow for programming Arduino using ATMEL Studio 7.

  1. Download and install ATMEL Studio 7
  2. Configure ATMEL Studio to use the AVRdude program
  3. Write, compile and upload program to Arduino Microcontrolller

Step 1: Download and install ATMEL Studio 7

First we need to download and install ATMEL Studio 7. Go to the ATMEL website and download ATMEL studio 7. The download link is below and you can download and install either the web installer or the offline installer.

http://www.atmel.com/microsite/atmel-studio

The following shows how to download and install ATMEL Studio 7.

Download and install ATMEL Studio 7 for programming Arduino

 

Step 2: Configure ATMEL Studio to use the AVRdude program

The second step to program Arduino using ATMEL Studio 7 is to add AVRdude as an external tool. To do this, open ATMEL studio and go to Tool > External Tools. There you will see a form for specifying external tool name and the executable file path. This form should be filled with the following settings.

Title: Arduino UNO Programmer

Command : C:\Program Files\Arduino\hardware\tools\avr\bin\avrdude.exe

Arguments: -C “C:\Program Files\Arduino\hardware\tools\avr\etc\avrdude.conf” -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:$(TargetDir)$(TargetName).hex:i

You can leave the Initial Directory field empty.

Check mark the Use Output Window.

Once you have filled up the form click the OK button. After that you will see Arduino UNO Programmer in the Tools list as external tool.

The following shows how to do this.

Step 3: Write, compile and upload program to Arduino Microcontrolller

The final step in how to program Arduino using ATMEL Studio 7 is to write, compile and upload the program into the Microcontroller via USB. As we said we will use C program to write the code. Start a new GCC C Executable Project, provide some name and finally select the Atmega328P as your device. After you created the project you will see a skeleton C program code in main.c file. Now we will write a simple C program that turns ON/OFF a LED connected to pin 13 on the Arduino UNO board.

Below is the C program code. Copy and paste it into the main.c file.

The next step is to compile the C program, in other words to build the solution by clicking on the Build Solution under Build in the toolbar. You should get message “Build succeeded” in the output window.

At this point you should have connected Arduino UNO to your PC via USB cable. We also assume that you the LED connected to the pin 13.

Now we will use the External Tool Arduino UNO Programmer that we created in the first step above. Go to Tools menu in the toolbar and select/click Arduino UNO Programmer. The hex code will be burned into the Arduino UNO and you should see a message “avrdude.exe done.  Thank you.” in the output window.

The LED should be blinking and you are done. See the following how to do this 3rd step.

How to program Arduino using ATMEL Studio 7

Video Demonstration of How to program Arduino using ATMEL Studio 7

The following video shows the LED blinking connected to Arduino.

Hopefully now you have learned how to program Arduino using ATMEL Studio 7.

Other Arduino tutorials:

Leave a Reply

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