ALVIDI
First Step From Download to the Programming Revision from 27.07.2012
ALVIDI
Directory 1.
Instructions
3
2.
Download
4
3.
Installation
5
4.
Atmel Studio 6
6
4.1.
New Proect
!
4.2.
Addin" t#e $i%rary
&
4.3.
'ompilation o( t#e Proect
11
)ardware
12
5.1.
Start t#e *oot $oader
12
5.2.
Installation o( t#e +S*,Dri-er
13
Pro"rammin"
14
6.1.
/pandin" t#e Pro"ram
14
6.2.
Installation o( t#e Pro"rammers
15
6.3.
'ontroller Pro"rammin"
16
Sources
1!
5.
6.
!.
-2-
ALVIDI
1. Instructions You will find similar information also on the web page of Atmel. In this document we introduce you with the help of our product, AVR32 board, our eperiences with AVR32. !his document allows you a "uic# access to the AVR32 controller$s family. It leads you from downloading of the free software and tools of Atmel up to the programming of the controller. %ne #nows that the first step is &ery hard. 'e ha&e done this step and present it in this document. !o ma#e ac"uaintance with AVR32 you need the following( ) *oftware - Atmel *tudio +. build /031 Installer - ull - I4 3.0.5 or higher ) 6ardware - AVR32-7oard A-893AVR7I! mit A!32893A52 9ontroller or - another one AVR32 product ) :!A;-4rogrammer - AVR :!A;I9< =>II oder - AVR ?ragon ) 8*7-4rogrammer - 8*7-7oot loader on each 9ontroller 893-series installed1 !here are two options :!A; @ 8*7-4rogrammer to program AVR32 controller. As cheaper solution for eternal 4rogrammer we recommend AVR ?ragon. Ad&antage these :!A; 4rogrammer is the ?ebug function. As a second option there is the free 8*7-7oot oader to choose. 6ow the name already tells, it needs only the 8*7 connection with the computer. <&ery controller of the 893 series is preprogrammed with the 8*7-7oot oader, it means that all three abo&e mentioned hardwares can be programmed with an 8*7 cable.
-3-
ALVIDI
2. Download You will find the complete software on the web page of Atmel. ) Atmel Studio 6.0 (build 1843) Installer - Full http(www.atmel.comtoolsA!=<*!8?I%.asp this file contains the de&elopment en&ironment for AVR32 - controller. 7efore you can download this software, you should fill e&ery B1 field. After that appears a window with download lin#. ) Atmel Software Framework 3.3.0 http(www.atmel.comtoolsAVR*%!'AR<RA=<'%R>.asp this file contains numerous eamples, dri&ers, source codes, ready proCects, 6!= documentation, software ser&ices... ) FI! 3.4." for #indows ($a%a &untime 'n%ironement inluded) http(www.atmel.comdynproductstoolsDcard.aspEtoolDidF3//+ I4 Feible In-system !rogrammer1 supports In system programming of lash de&ices through R*232, 8*7 or 9AG. !his file contains also the dri&er of 8*7-7oot oader.
-4-
ALVIDI
3. Installation . As first you ha&e to install as6installer-6.0.1843.ee
ollow the instructions in the window and install Atmel *tudio +. !he installation will ta#e some minutes. et your irewall allow the complete installation. 2. 8nHip asf-standalone-ar*i%e-3.3.0.+i, , e.g to 9( 3. !he last step is the installation of Fli, Installer - 3.4.".106.ee
-5-
ALVIDI
4. Atmel Studio 6 *tart AVR32 *tudio Start P rograms Atmel Atmel Studio 6.0
!he window J*tart 4ageJ welcome you. 6ere you can get more information about the software, hardware and programmer.
-6-
ALVIDI
4.1. New Proect *tart a new proCect File New P roject... In the middle window choose KGCC C Ex- ecutable Project L. Gamed your proCect in the field Name, e .g. !roet1 and sa&e it in field ocatio! e.g. /A2&3'am,les . inally clic# the button K%>L. In the net step You ha&e to choose your controller. In our case it is A!32893A52. 'ith the net button K%>L will be closed the second window. As soon you closed the last window you will get an empty 9-ile K4roCectD.cL with start mas#.
-7-
ALVIDI Gow we will write a small program in the new created source file. In this program we change periodically the le&el of the pin 2 on the port M. In our AVR32 7oard is this pin with connected. #include
#include "gpio.h" #include "sysclk.h" #include "delay.h" int main(void) {
sysclk_init() delay_init(sysclk_get_cpu_h!()) hile() $ gpio_tgl_gpio_pin(%&'32_*_+2) delay_ms(,--) }
!a#e o&er the source code illustrated on top in Project"#.c
4.3. Addin" t#e $i%rary After writing our program, we ha&e to include a few libraryNs to our proCect. !his libraryNs you will find Project ASF $i%ard 9hoose in the left field library$s as following ( ● ;4I% O ;eneral-4urpose Input%utput ● ;eneric board support ● *ystem 9loc# 9ontrol ● ?elay functions 'ith the button KAdd to selection PPL transfer the abo&e choice in the right window. 9onfirming with the button KinishL include the lybrary$s to our proCect.
--
ALVIDI
9reate a new folder uc&a'rbit in the window Solution ',lorer under !roet1 src(as)(commo!(boards . 'ith the right mouse #ey on the folder New boards Add Folder
'ith the right mouse #e'ith the right mouse #ey on the foldery on the folder uc&a'rbit Add *tem... include fol Existi!g lowing files( http(al&idi.dedataDsheetsADI7D893.Hip ADI7D893 893AVR7I!(
uc3a&rbit.h ledDfunc.c ledDfunc.h -!-
ALVIDI
In the library board.* under src(as)(commo!(boards change the following lines( #deine 01'_4%'5 #deine 50::;_4%'5
66 --
//7< 0ser8reserved 9oard (i any). //7< 5ummy 9oard to support 9oard8independent
as( #deine 01'_4%'5 #deine 50::;_4%'5 #deine 03%&'= #deine 4%'5
66 //7< 0ser8reserved 9oard (i any). -- //7< 5ummy 9oard to support 9oard8independent - //7< %&5 %803%&'= 9oard ith %=3203%-,2 03%&'=
and #i 4%'5 ?? &@- #include "evk--/evk--.h"
with #i 4%'5 ?? 03%&'= #include "uc3avr9it/uc3avr9it.h" #eli 4%'5 ?? &@- #include "evk--/evk--.h"
Gow we ha&e to ma#e the last change. 'e should delet the library startu,u3.S under src(as)(a'r&+(utils(startu
-10-
ALVIDI
4.3. 'ompilation o( t#e Proect At first you ha&e to sa&e the complete 4roCect File S a'e A. 9ompile the proCect( - uild ebuild Solutio! or - #ey se"uence /trl5Alt5F75 or - right mouse button on Solution !roet1 ebuild Solutio! You will see the result of the compilaton in the window J%utputJ how it is shown in lower picture.
If during the compilation mista#es were found in the program, they would appear in the window J
-11-
ALVIDI
5. )ardware 5.1. Start t#e *oot $oader 9onnect your hardware &ia 8*7 with computer, e.g. AVR32-7oard. As soon the 8*7 connected to the board the green Power E/ will gi&e light.
6old the J7%%!J-#ey low-pressed and press for a short time the JR<*
2. press for a short time
. hold low-pressed
-12-
ALVIDI
5.2. Installation o( t#e +S*,Dri-er 'hen the 8*7 connection is a&ailable and boot loader has been started you get the picture below.
9hoose *!stall )rom a list or locatio! Ad'a!ced1 and clic# the button KGet PL.
After a successful installation appears the left upper picture. In the right picture /e'ice 2a!ager the connected de&ice will be &isible under ib9S:-#in3 ;e%ies A<39/3A -13-
ALVIDI
6. Pro"rammin" 6.1. /pandin" t#e Pro"ram !o program with 8*7-boot loader we must epand properties of our 4roCectD with a line. 9lic# with the right mouse #ey in the window Solutio! Exlorer on !roet1 and choose the option !ro,erties .
In the field inker Fla=s under Project"# 3oolc4ai! A5&+GN7 i!8er 2iscel- la!eous write the line -$l,-e,"tramoli!e
-14-
ALVIDI
6.2. Installation o( t#e Pro"rammer You will find in pdf-ile AVR32 893 8*7 ?8 7ootloader of Atmel, how to program with boot loader. *ee( http(www.atmel.comImagesdoc32++.pdf !his document show us that for programming you are re"uired a 'indows program L9ommand 4romptQ. !his program you will find under Start Accessories Comma!d Promt 'ith the command line e.g. md.ee >/ bat*is, -de%ie A<39/3A0"1 -*ardware usb -o,eration onfail abort memor? FAS@ erase F the memory area without boot area will be erased and with this command line md.ee >/ bat*is, -de%ie A<39/3A0"1 -*ardware usb -o,eration onfail abort memor? FAS@ erase F loadbuffer /A2&3'am,les!roet1!roet1;ebu=!roet1.*e ,ro=ram %erif? start reset 0 the memory area without boot area will be erased, with the file 4roCectD.he flashed, &erified and after internal reset started the program . !hat means, in order to program a controller &ia 8*7-boot loader, we ha&e to include the command line abo&e in the window Comma!d Promt e&ery time. 'e could simplify that with a self eecuti&e file. or that case we need a LGotepadQ. !his program you will find also under Start Accessories Comma!d Promt In the net steps we eplain, how to create such file. . *tep( open LGotepadQ and paste the following line( md.ee >/ bat*is, -de%ie A<39/3A0"1 -*ardware usb -o,eration onfail abort memor? FAS@ erase F loadbuffer /A2&3'am,les!roet1!roet1;ebu=!roet1.*e ,ro=ram %erif? start reset 0 2. *tep( sa&e that file e.g. under 9(AVR32D<amples4roCectD not as tt-file but as batfile. 'e named it !&B&AC.bat
-15-
ALVIDI
6.3. 'ontroller Pro"rammin" In order to program AVR32 board, we ha&e as first start boot loader. *ee chapter 9.#. Start t4e oot oader. In 2 steps from the last chapter we created one bat-files. !&B&AC.bat will be run each time, if we need it up to date. or an other proCect you ha&e to change the lin# in step 3 /A2&3'am,les!roet1!roet1;ebu=!roet1.*e 1. !he window closed after eecution the command line. If you li#e to let the windows after eecution permanent open, you ha&e to change md.ee >/ with md.ee >D !he programming result will be shown in detail in the window 9ommand 4rompt see picture below1.
Gow we ha&e to ma#e sure that the program functions properly. If no on the board a&ailable, connect on port M pin 2 in a row resistor 22 and a li#e in the lower circuit. If the flashes, you ha&e made e&erything right. You will find other eamples for AVR32 controller series 893 in the AVR32 893 *oftware ramewor#. In the folder /asf.3.1a%r3dri%ers you will find also the dri&ers and source code eamples of A?9, 4'=, R!9, 8*AR!...
-16-
ALVIDI
!. Sources ) A2&301" Atmel Studio " 2ideo :eis,iele http(www.atmel.commicrositea&rDstudioD5 ) A2&3 9/3 9S: ;F9 :ootloader http(www.atmel.comImagesdoc32++.pdf
-17-