Search This Blog

Powered By Blogger

Sunday, April 18, 2010

Softwares needed

Hmm...this is the part where we will know which softwares are to be used for uC coding,simulation and programming.Well...the architecture of uC and your PC is different and so you can't use your computer compiler softwares to program your uC.Well...there are several compilers for programming avr like avr-gcc,bascom avr etc.they support the coding architecture of PC(For instance,avr-gcc is a c code compiler for avr uCs) but compiled output is different.But you can configure your programming editor(Hope you know the editor you use to write the code and the compiler you use to compile your code is different) with this uC compilers.Well,uCs can also be programmed with assembly language(a low level language) in which you can directly access memory addresses etc. but it's not as user friendly as a mid level language like c or high level language like basic(bascom avr).In this tutorial we will use avr-gcc as our compiler(for assembly,there is a good tutorial here).
Here is the list of softwares.First I am giving you the list for Windows OS,then Linux(Ubuntu,other distributions should also be compatible).

Softwares for windows:

1.AVR Studio:
This is a very good software and a complete IDE for avr uCs by Atmel with built in assembler(assembly compiler).You can also use it to compile C(if you have WinAVR installed) codes.It has a simulator in which you can run your codes to see if they are bug free.You can even program your uC right through this IDE if you have a AVR Studio compatible programmer(List of programmers can be found in it's menu) .This great software is absolutely free and requires only a free registration.The link is here.
Visit the link and download "AVR Studio 4.18"(requires a free registration) then download the service pack(SP2 or SP3).Install AVR Studio 4.18 first then the service pack(because service pack is not the complete software,just an update).Check "install USB driver"(When shown).

2.WinAVR: A collection of compiler and all the files you need(some you don't).A software for programming uC(avrdude) is integrated with it(This is highly necessary if you are using USBasp as programmer).Can be downloaded from here.(That's a open source one,so you can modify it if you want).An integrated editor(Programmer's Notepad) can be used as a code editor for avr-gcc.
N.B. :- It may show some errors if you are using windows vista or 7 (64 bit version). To fix it,you need to patch winavr.The patch can be found here.Download it and follow the instructions(May be you need to replace a file given there as patch).Recent releases of WinAVR should be free from this problems.If not...then write to me.
DURING SETUP,CHANGE THE INSTALLATION DIRECTORY NAME FROM "WinAVR - something" to simply "WinAVR".

Proteus VSM:A simply awesome software for simulating circuit you want to make(means you can just draw the circuit in it's workspace and run the circuit in you PC virtually).This software supports a lot of avr uCs and you can just add the compiled file there.You can even design PCBs for your circuits here.Unfortunately...this is not a free software and too much costly(>$2000 or $3000).There are many cracked versions available online.Search them(I can't give it's link here...the admin guys may shut my blog up!).

Well...there are other IDE's available...such as Eclipse.To know how to use it with winavr,click here.

Ponyprog:You can use this one if you are planning to build a parallel/serial programmer stated in the previous chapter.This is a very handy tool and can be downloaded from here.

AVR-Burn-O-Mat:AVRdude is a command line software(aahh...I hate command typing).This is a GUI(Graphical User Interface) for avrdude(means you give command to avrdude via this software by simply clicking things,REMEMBER,this is not an alternative to avrdude,just a GUI for it).Link is here.

Well...I am writing a GUI for avrdude.You will get it soon!It's is not as versatile as Burn-O-Mat but a simple one to use.

Softwares for Linux:

Hmm...the OS with ever growing popularity.Here is the list of softwares for it.

avr-libc,avrdude,uisp : there is no collection like WinAVR available for Linux.In ubuntu,you will get them in your Synaptic Package Manager(Preference menu).Download them and this manager software will automatically mark necessary extra apps needed before download.After downloading,they will be installed automatically.

Kontrollerlab:A very good IDE for Linux.You can even add any avrdude compatible programmer in it.That means it can even be used to program your uC.Link is here.
Download the compatible package from the link.This is the one I am using in my Ubuntu OS.

Eclipse can be used as a IDE for Linux too.

Installing Driver for programmer(Only if you are using USBasp):Hmm...something else I still need to say...how to install the driver for USBasp.Well...download the latest zip archive from fischl.de then extract it.When you insert the USB cable of your USBasp hardware,a "Found New Hardware Box appears"(If you have already written the firmware into Atmega8 of USBasp and your connections are alright).There you show the "bin/win-driver" folder of your extracted USBasp folder.Then the setup will automatically locate driver for USBasp.
Now,time to test the hardware.Go to command prompt and type "avrdude -c usbasp -p m16" or replace the "m16" with "m8" or "m32" if you are using them as target uC.(No need to worry,I'll explain that!).Most probably,you will see "avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc".Well, this is because of the version difference between the driver given with avrdude and the one you installed.If you're lucky and you have set everything up,you should see an ok message.Otherwise,if you haven't connected the target uC or if there is any connection error in the connection between the uC and USBasp (Or in the power connection of target uC) and the driver version is perfect then you should see "target doesn't answer" message.If you haven't connected the target uC,then you can jump saying "yeppi,my USB device works!" or if you have,then you can say to yourself,"No problem...just to fix the target uC connections...my USBasp is alright!".
Now,if you have got an error message like "could not find USBasp",then unplug the hardware and reconnect it.If this does't work,copy the libusb0.dll & libusb.sys file to "WinAVR/bin" directory.A message will appear saying that these files already exist...but just press yes.Now test it,you should see a positive result.If not,then check your USBasp for connection errors.

No comments:

Post a Comment