Saturday, June 6, 2009

Installing and Using WinAVR for Parallel Port Programmer

Installing and Using WinAVR for

Parallel Port Programmer

After successfully designing the Parallel port programmer in our previous tutorial, now we will be learning how to install and work on the software for programming the MCU.

WinAVR– WinAVR is package in which we use two sub-programs

Programmers Notepad & Mfile.

Name - Programmers Notepad & Mfile

Version- 2.0.8.718-basic

Creator- Simon Steele

Purpose- 1. To write code.

2. To compile code.

3. To generate Hex File.

4. To burn Hex File.

Installing WinAVR:

1. Download WinAVR setup from this link:-

http://sourceforge.net/project/showfiles.php?group_id=68108

2. Install WinAVR into C:\ WinAVR-20090313

3. Now go to Start-->Run-->(cmd.exe), i.e. go to command prompt.

4. Go to the following directory C:\WinAVR-20090313\bin.

5. Type this command “install_giveio” and press ENTER.

6. You should get the “Success” message as shown in the snapshot below.

5. Check the status by the command “status_giveio”.

6. Installation of WinAVR is complete now.


Screenshot of Command Prompt Window (CLick To Enlarge)


Screenshot of Programmers Notepad (CLick To Enlarge)

Steps for Compiling and Burning Process-

1. Open Programmers Notepad [WinAVR] from “StartàAll programs à WinAVR-20090313”, write the code. Save the program into a specified folder whose name is same as the File name.

2. Open MFile [WinAVR] from “StartàAll programs à WinAVR-20090313” apply following steps-

I. Select Microcontroller type which is Atmega16 or Atmega32 whichever you are using.


(CLick To Enlarge)

II. Select output format as “ihex”.

III. Select Debug format as “avr-ext-COFF (AVR Studio 4.07+, VMLAB3.10+).


(CLick To Enlarge)

IV. Select programmer option as “bsd”.

V. Select output port as lpt1 because we are using Parallel port (0X378 is the address of Parallel port).

VI. Save As the file as Mfile format in the same folder where the program file is saved. Name of the Mfile should me kept Makefile only; don’t change it to any other name.

VII. Reopen the saved Mfile in Notepad.exe and correct F_CPU to 1 MHz and write the target name same as Program file name. Save the Mfile.


(CLick To Enlarge)

3. Open programmer Notepad select Tools à[WinAVR] Make All option to compile and create hex code Hex code.

4. After successful compilation the hex file is saved automatically into the same folder in which the program file and the Makefile are already saved.

5. Connect parallel port of burner to the CPU of your PC and select Tools à[WinAVR] Program option to burn Hex code.

6. Below is the snapshot of the output window which displays all the actions being taken and their status.


(CLick To Enlarge)

COMMON ERRORS ENCOUNTERED

First Error

avrdude: AVR device not responding

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

avrdude done. Thank you.

make.exe: *** [program] Error 1

Second Error:

avrdude: Device Signature=0xffffff.

avrdude: Yikes! Invalid device Signature.

Double check connections and try again, or use -F to override

this check.

avrdude done. Thank you.

make.exe: *** [program] Error 1

TROUBLESHOOTING

1. First check whether your parallel port is working or not using lpt.exe.

2. See bios settings. Better set for bidirectional mode, but spp and ecp modes will also work. See the address of the parallel port (0x378).

3. You connected reset pin to external Vcc or GND ( disconnect it)

4. External power supply may be off.

5. Parallel port cable may be not fitted properly.

6. See whether u interchanged MISO and MOSI.

7. See for short-ckt between pins.

8. See for any loose connection in wires using Continuity tester of multimeter.

9. Ground of power supply and parallel port should be short circuited.

Enjoy working with AVR now…

Regards:

Aditya Sharma

http://robozeal.blogspot.com

22 comments:

Karthik said...

hi i've build the circuit exactly... i've checked the connections.... everything seems to be alright.... but when i do the prob test after connecting the programmer to the printer port it says test failed.... any suggestions???
i also ignored the msg nd proceed with writing the program but it says device missing... error code -24.... any suggestions....

heloitsadi said...

First of all mention the software you are using. The circuit works with WinAVR.

Karthik said...

i'm using ponyprog.... i did try winavr but it wasnt of any help either.... ne suggestions?

heloitsadi said...

Please post the queries you are facing in WinAVR, it will surely work.

Nikhil Kautilya said...

Thanks buddy!!
Pretty trivial mistake i was making but u brought my attention to that!!
thanks again!!

Anonymous said...

Hi..good work.

I made the programmer exactly as per your design. When select, Make all option, which file has to opened in prog. notepad? is it makefile or the program file?

It is working in neither case.
Error:
make.exe:*** No rule to make target 'q.elf', needed by 'elf'. Stop.

q is the name of program file and also the name of the project.

Please help!!! -DJ, Jaipur

heloitsadi said...

It is the makefile which needs to be edited.

Unknown said...

Hey, I have done exactly wat was mentioned, i made prog then make file had also edited the two things that were mentioned the frequency n target name. i had also out bot makefile n program file in same folder of same name as that of program. but when i do make all, it shows error:
****"No rule to make programs.elf" needed by elf. i knw theres a problem in my make file but i did exactly wat u said . Should i send u my make file???

Dan said...

Save your file with .c extension, that should fix the problem.

Etienne said...

Hello,

I made the USBasp from http://www.fischl.de/usbasp/ and now I have to burn the firmware on the controller. I am using the parallel port of my computer and WINAVR. I cannot write the firmware with WINAVR because of the Makefile parameters and the other files "called" by the main.c file. An other way is to burn directly the .hex file with WINAVR but I don't know how to do this.
Maybe you can help me with this.
Regards.

heloitsadi said...

Hi Etienee,

If you have already made the USB programmer just download AVRDude, insatall it and you can directly burn the hex file. You can Download AVRDude GUI from this link... http://sourceforge.net/projects/avrdudegui/

In the Setup tab, select the programmer as usbasp. Get back to me if you face any issues.

Cheers.

My name is khan said...

hi Aditya Sharma !
I am doing the dtmf project..
pls tell my weather the capacitors with crystal oscillator are important or not ..because my circuit
not giving binary code

heloitsadi said...

Yes the capacitors are required.

AaiRIz said...

how to generate hex code in "win avr "
i can not generate hex code..
so plz help me..

Vinay Mitbawkar said...

I got the error one tried al the troubleshooting steps no mistake what are other possibilities of the error

heloitsadi said...

Hex file is generated when you successfully compile the code, the process is explained in this article. Please refer to Point 4 under the heading
Steps for Compiling and Burning Process

@Vinay
What error you are getting?

abhilove said...

do u know how to burn hex file into microcontroller using command promt.......with some specified command

kamiya jain said...

Boss i want to know how to use eprom in atmega32???
i want to send and receive data from eeprom usnig c code....??

heloitsadi said...

Hi Kapil,

I haven't used it practically, I think in Atmega you have inbuilt EEPROM, check out the datasheet you will find a demo C program also in that.

heloitsadi said...

@Abhi,
you will find a datasheet for it,

It depends on what tool you are using, if u r using AVRDUDE,you can find a document on net which will tell u about all the commands. If you can't find leave your mail ID, I will mail you.

Cheers...

Pavan.N said...

Hey hi
i have followed all the procedure
but when i compile i am getting an error
> "make.exe" all
make.exe: *** No rule to make target `all'. Stop.

> Process Exit Code: 2
> Time Taken: 00:00

i hoping u could help me with this

Anonymous said...

We dont even get the hex file in the folder. We are using atmega8. Plz help.