Tutorial 1 - Getting started with EVK1105

INTRODUCTION

This series of tutorial will explain how to program AT32UC3A series of microcontroller.  



Tools required for this tutorial.


1)      EVK1105/EVK1101 or any other AVR32UC3A series development board
2)      AVR Dragon or any other JTAG Debugger

3)      Atmel Strudio 6.



AVR DRAGON JTAG PIN OUTS


 

EVK1105 JTAG PIN OUTS

 

CONNECTING EVK1105 WITH AVR DRAGON


You need JTAG cable to connect EVK1105 with Avr dragon.
You can  buy Jtag cables from ebay.

http://www.ebay.com/itm/5-PCS-FC-10PIN-Flat-Ribbon-Cable-for-ISP-JTAG-space-2-54mm-length-300mm-2-5PIN-/260735643519?pt=LH_DefaultDomain_0&hash=item3cb50e2f7f


Installing atmel studio 6


Download  atmel studio from http://www.atmel.com/microsite/atmel_studio6/default.aspx 
and install it.



CONNECTING EVK1105 & AVR DRAGON TO PC

 Connect USB user of EVK1105 to the pc, to power it up and USB port of AVR Dragon to the PC. AVR Dragon doesn't provide power to EVK1105.



YOUR FIRST PROGRAM - TURNING ON LED

Atmel Studio comes with powerful framework called Atmel Software Framework(ASF).
We will be using ASF for this example, i.e to turn on LED 0 of EVK1105.
On EVK1105 LED0 is connected to GPIO(Genral purpose I/O) pin PB27.

 Here are the steps to start new project

1) Start Atmel Studio.
2) Go to menu New>Project
3) In C/C++ option on left side, choose Atmel Boards.
4) Select EVK1105 - AT32UC3A0512 and trhen click ok.

In this example we will be using GPIO Asf Module.

You can select/deselect ASF modules from menu Project>ASF Wizard

Make sure GPIO module is selected


In our first example we will be turning on the LED0 of our EVK1105 board.

LED0 is connected to vcc and GPIO pin PB27. So when GPIO Pin PB27 is high(i.e 1), the led will be off and when PB27 is low(i.e 0), the led will be on. 

 1: #include <asf.h>
 2: 
 3: int main (void)
 4: {
 5:  //LED0 is connected between vcc and GPIO Pin PB27.
 6:  gpio_configure_pin(AVR32_PIN_PB27,GPIO_DIR_OUTPUT | GPIO_INIT_HIGH);
 7: 
 8:  gpio_set_pin_low(AVR32_PIN_PB27);
 9:  
10:  while(1);
11: }
Type in the above code and compile. To load the program to MCU. go to menu Debug > Continue. IDE will ask to select Avr Dragon, select it. In few seconds code will be uploaded to mcu.
 

gpio_configure_pin() sets the GPIO pin either as output or input. By default all the gpio pin are set as input.
GPIO_DIR_OUTPUT | GPIO_INIT_HIGH parameter sets GPIO as output and sets initial state as high.

No comments:

Post a Comment