I am new to AVR microcontroller and I have problem with my first project: blinking an LED.
Problem: I can’t get it to blink.
I recently bought ATmega328 with Sparkfun AVR Pocket Programmer and I’m not sure if it is my circuit or programmer or microcontroller that is wrong.
I stronly feel that the programmer is not working properly but I thought that asking here before sending an email to Sparkfun is a good idea.
OS: Microsoft Windows XP Proffesional Version 2002 Service Pack 3
Programmer: [Pocket AVR Programmer (usbtiny from Sparkfun)
(installer for it is in the same page as in hyperlink above)
Program used: AVRDude
Microcontroller: ATMEGA328P-PU
File used: [blink_1MHz.hex (from Sparkfun Tutorial)
(above zip also contains C code)
Most of the time after connecting the USB, the computer detects unkown hardware although I installed it.
When this happens, only the blue light in the programmer lights up.
I typed the following in command prompt after changing directory to where blink_1MHz.hex is saved:
avrdude -c usbtiny -B 1 -p atmega328p -U flash:w:blink_1MHz.hex
The result is:
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Once in a while (after disconnecting and re-connecting the usb about 20-30 times), the Stat1-red-light in the programmer lights up.
When this happens, I type the above command again and get the same results.
However, sometimes, the Stat2-red-light blinks once and the result is:
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
Once in about another 20-30 times of repeating the above when Stat1-red-light is lit, I get the following:
avrdude: error: usbtiny_transmit: usb_control_msg: sending control message faile
d, win error: A device attached to the system is not functioning.
avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed
, win error: A device attached to the system is not functioning.
(expected 4, got -5)
avrdude: AVR device initialized and ready to accept instructions
Reading | | 0% 0.00s
avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed
, win error: A device attached to the system is not functioning.
(expected 4, got -5)
avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed
, win error: A device attached to the system is not functioning.
(expected 4, got -5)
Reading | ################# | 33% 0.10s
avrdude: error: usbtiny_receive: usb_control_msg: sending control message failed
, win error: A device attached to the system is not functioning.
(expected 4, got -5)
Reading | ################################################## | 100% 0.14s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude: error: usbtiny_transmit: usb_control_msg: sending control message faile
d, win error: A device attached to the system is not functioning.
avrdude done. Thank you.
Image 1:
http://i158.photobucket.com/albums/t113 … image1.jpg
Image 2:
http://i158.photobucket.com/albums/t113 … image2.jpg
Image 3:
http://i158.photobucket.com/albums/t113 … image3.jpg
Image 4:
http://i158.photobucket.com/albums/t113 … image4.jpg
Image 5:
http://i158.photobucket.com/albums/t113 … image5.jpg
Image 6:
http://i158.photobucket.com/albums/t113 … image6.jpg
Image 7:
http://i158.photobucket.com/albums/t113 … image7.jpg
I have checked the circuit several times including making sure that the wires were firmly connected.
Other facts:
I do not have a usb hub as [this page suggests to use (and I do not want to buy one since it might still not work).
One of the comments in [this page from Sparkfun says that the MISO,SCK,RST,MOSI is printed in reverse but I have tried connecting both ways.
Is it the programmer thats broken?
Is it the microcontroller thats broken?
Is my circuit wrong?
Should I contact Sparkfun?
Did this happen to those using the same Pocket Programmer?
I would appreciate any comments, suggestions, opinions, similar problems, etc.
Thank you!!](http://www.sparkfun.com/commerce/product_info.php?products_id=9231)](http://forum.sparkfun.com/viewtopic.php?t=16048)](http://www.sparkfun.com/tutorial/BeginningEmbedded/2-MicroProgramming/blink_1MHz.zip)](http://www.sparkfun.com/commerce/product_info.php?products_id=9231)