Instructables

Ghetto Programming: Getting started with AVR microprocessors on the cheap.

Featured

Step 9: Program the Chip

Linux:
1) Get in the LED_Demo directory.
2) Cross your fingers.
3) Type "make"

Windows:
1) Open up LED_Demo.c with Programmer's Notepad.
2) Cross your fingers.
3) Select "Tools...Make Program"

Both:

Watch the log as the text goes scrolling by. There are two things you're looking out for here.

One is if the program compiled sucessfully. If there are no errors, it did. If it didn't, why? Did you mess around with my code?

Two is if the chip programmed sucessfully. For this, it writes the code in, then verifies the chip's memory. It should say "Contents Verified." If it says something about the parallel port or "giveio.sys", did you enable the parallel port back a couple steps ago?



Success? Yay! There's nothing like the sweet smell of blinking LED's in the morning.

 
Remove these adsRemove these ads by Signing Up
jld13 years ago
I've downloaded the WinAVR just to try to play with C/C++. I don't have any uC right now but I plan to. I wrote a simple program using Programer's Notepad in C. I can't seem to compile the program? Please advise.

thanks
Joseph
Funnymonk4 years ago
Hello I think I've followed all of your instructions to the letter but there is no Make prgram button in tools for me. How do I fix this?
godofal5 years ago
okay, i dont get it. i used your program, downloaded winAVR, loaded everything, put in the attiny13 chip, connected everything right, re-wrote the program for attiny13 (changing output ports) but it gives the error > Failed to create process: the system cannot find the given file. the last part is translated since im running the program in dutch... what is going on? and what can i do about it?
jammil295 years ago
thankyou for your instructable.
anmo5 years ago
I have a no rule to make target program .stop What am I doing wrong ?
luisnperez6 years ago
Frustration! doesn't work , message:
*** No rule to make target `LED_Demo.o'. Stop
The programminf needs more detail, specially you mentioned to modify the txt file, but what line?
In windows there is no "Tools...Make Program"

papalevies6 years ago
So I have tried it in the past in Windows XP but it didn't work (maybe something to do with the parallel port being ring 0 in XP), but I recently switched to Ubuntu, so I gave it another shot. I shortened the cable (about 40cm now), made a small circuit to give it exactly 5V (using a L7805CV) and didn't use any resistors on the cable. This time everything went smoothly, avr-dude ended without any errors but the led just wouldn't turn on! To my amazement, as soon I removed the cable from the programmer in disappointment, the led started blinking! I don't know if it was supposed to be this way but the bottom line is it works! Now that I can program the 2313, my next project will be the USB programmer. Thank you!
mrynit7 years ago
i was getting this error

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1

To fix it i took off my 220 ohm resistor from pin 11.
dadda7 years ago
I tried to program atmega32 chip using a bsd programmer and winavr20070525 and got this error :
avrdude -p atmega32 -p lpt2 -c bsd -U flash:w:f:prateek.hex
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

I checked the connections many times but they are right , where could the problem be ???
dr_seltsam7 years ago
The smell in the morning... Someone in the movie "Apocalypse Now" sayed a similar sentence ;-) By the way - a good explanation to the AVR Stuff! Thank you very much!
papalevies7 years ago
I tried everything, the install_giveio.bat, even the link above and it returns the following error (after using the link above it only returned it when using Tools>Program, not on Make All, but still didn't work):

> "make.exe" program

Creating load file for EEPROM: main.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex main.elf main.eep || exit 0
c:\WinAVR-20070525\bin\avr-objcopy.exe: there are no sections to be copied!
avrdude -p attiny2313 -P com1 -c dasa -U flash:w:main.hex

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

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

The connections are triplechecked and I even tried different ones. Any clue what is wrong?
Your commandline says you're using a DASA cable, but the instructable here is for a DAPA cable. Edit the makefile to reflect that, and you should be good.
Nope, tryied that, same error.
I just noticed, in Make All it doesn't return an error code but it does return

Creating load file for EEPROM: main.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex main.elf main.eep || exit 0
c:\winavr-20070525\bin\avr-objcopy.exe: there are no sections to be copied!

is this an error? I am starting to believe it might be my parallel port. Is there a way to check it with a multimeter or something?
jcgam697 years ago
I got the error: avrdude: can't open device "giveio" avrdude: failed to open parallel port "lpt" To fix that problem run c:\winavr\bin\install_giveio.bat
Myself7 years ago
Okay, I can manually run avrdude and it finds my chip, so I know the cable's good and giveio is working. I can't get make to play nice, though. Programmer's Notepad and running "make all" manually at the prompt both result in:

make: *** No rule to make target `LED_Demo.o', needed by `LED_Demo.elf'. Stop.

I reinstalled winavr on c: and put your .c and makefile in c:\winavr\LED_demo\ and I still get this. What am I doing wrong?
Myself Myself7 years ago
Addendum: Using the different Makefile given in http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=45491 I got everything working. Not sure why, I don't speak Gnu yet, but if you're stuck with the same error, poke at this for a while.