How to setup Atmel Studio for Arduino development

Published on in Series Arduino Development with Atmel Studio


After selecting Arduino Nano 3.0 for Eggy, we installed Arduino IDE and written few programs. Its very user friendly, targeted toward non-developers. But that will not suite our need. AVR Studio will can fill the gap for professional development tool. There are many pros and cons when using AVR Studio over Arduino IDE.

Our needs are simple, we want the fast, feature rich IDE (that’s Atmel Studio – also called as AVR Studio). We don’t need the Arduino Libraries, we will port them. If you need the Arduino Libraries then see the links in the reference section to get it working.

We found using AVR Studio is very easy, also has lots of resources on the net(but they are scattered over the net). In this article we will consolidate and list down as easy to follow steps.

Step 1: Install AVR Studio.

  • Download the AVR studio
  • Installing AVR studio is similar to any other windows application, follow the installer wizard and answer the question

Step 2: Create new project in AVR Studio.

  • From the menu select File > New > Project
  • In the upcoming dialog window select C/C++ > GCC C Executable Project, then filling the details like Name, Location, Solution Name and click OK
  • Now select the micro controller from the list. Here we selected ATmega328\ (Select the processor based on the board you are using – we are using Arduino Nano 3.0)

Step 3: Configure the Project

  • Click from menu Project > Properties
  • Select Toolchain > AVR/GNU C Compiler > Symbols
  • In the Defined Symbols add F_CPU=16000000UL. This says what is your CPU clock speed,

Note: Arduino Nano runs at 16MHz, so 16000000UL. 1MHz = 1000000UL

Step 4: Write a test program

Here is the program to blink the LED (in Pin 13).

/* GccApplication1.c
 * Created: 23-06-2013 06:22:47 AM
 * Author: aSensar  */
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
    DDRB = (1 << DDB5);
    while(1)
    {
        // LED on
        PORTB = (1 << DDB5);
        _delay_ms(100);
        // LED off
        PORTB = 0;
        _delay_ms(100);
    }
}

For detailed explanation off port operation see article I/O Port Operations in AVR

Step 5: Compiling project

Press F7\ Key

( or )

From menu select Build > Build Solution to compile the project

Step 6: Programming the Arduino

Since this is a lengthy step I have created a separate article on Programming Arduino from AVR Studio.

Note: New Atmel Studio versions have inbuilt support for importing Arduno Code and Arduino Library


This article is part of Arduino Development with Atmel Studio series.

  1. How to integrate AVRDude with Atmel Studio
  2. Programming Arduino using AVRDude
  3. How to setup Atmel Studio for Arduino development [This Article]

TAGS: arduino

Share on: Email Facebook Twitter


View/Write Comments