SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By Yes0
#89753
I'm trying to upload the program from here to my ATmega168 but I'm having trouble. Every time I try to upload it to the board 'make all' goes fine, but 'make program' gives me the error
Code: Select all
avrdude -p atmega168 -P /dev/ttyS0 -c ponyser    -U flash:w:blink_1MHz.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: *** [program] Error 1
I'm running Linux and I'm fairly certain that my serial port is /dev/ttyS0. I've checked all my wires and everything is hooked up firmly, and there's 4.96 V running through all the various power/ground wires. The wires are definitely hooked up to the programmer and ATmega correctly. Does anyone know what the problem might be?

Thanks!
Last edited by Yes0 on Fri Jan 08, 2010 11:42 pm, edited 1 time in total.
By stevech
#89767
ask on avrfreaks.net, forum
By tetsujin
#89853
Yes0 wrote:I'm trying to upload the program from here to my ATmega168 but I'm having trouble. Every time I try to upload it to the board 'make all' goes fine, but 'make program' gives me the error
Code: Select all
avrdude -p atmega168 -P /dev/ttyS0 -c ponyser    -U flash:w:blink_1MHz.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: *** [program] Error 1
I'm running Linux and I'm fairly certain that my serial port is /dev/ttyS0. I've checked all my wires and everything is hooked up firmly, and there's 4.96 V running through all the various power/ground wires. The wires are definitely hooked up to the programmer and ATmega correctly. Does anyone know what the problem might be?

Thanks!
Two possibilities come to mind.

First, if you set the chip fuses that configure it for use with a crystal for its clock source, then the chip won't work (even for serial programming) without the crystal present.

Second, if you disabled the reset line to get an extra I/O pin, then the programmer can't use that pin to reset the chip and put it into programming mode. I don't really know the solution to this one...
By Yes0
#89916
I've never got it to run before, so I haven't messed with the pin settings or fuses or anything.

e: I just tried the other ATmega168 (I'd ordered two in case something like this happened...) and it worked. I don't know if the other one wasn't in properly or I did something to fry it, but whatever.

Thanks!
By Yes0
#89922
I just tried using an external, 16 MHz crystal as explained here and I'm running into some problems with setting the fuses. I ran the command

avrdude -p m168 -P /dev/ttyS0 -c ponyser -U lfuse:w:0xE2:m

and it used the internal clock at 8 MHz like it's supposed to, but when I tried setting it to E6 to use my external oscillator it stopped responding. Did I screw up the fuses, or could it be that my crystal isn't in right?

Like should both pins of the crystal really be connected to ground? That doesn't seem right.
By newbie123
#89984
I recently had the same problem. I found a good website that explains a number of ways to fix the problem, SORRY, I can't remember where I saw it.

Google avr fuse repair. You should find it.

Hope it helps.
User avatar
By leon_heller
#89994
An external crystal won't work if you've screwed up the fuse settings, you need an external oscillator. You'll find plenty of info on AVR Freaks about the problem.

Leon
By stevech
#90042
I think you can feed the oscillator's signal from a properly running microprocessor to the one with mis-programmed fuses.
By Reggie
#90474
actually, your mileage will vary as to whether an external crystal or resonator will work with the wrong fuse settings, it should be good enough to resurrect the fuses. If not you'll have to use a HV programming method.

for the initial guy, if you've never set the fuses on it then its going to be in slow mode for programming, you haven't set a baudrate in your command line instruction, use -B 4800 for an unprogrammed chip.
By Yes0
#90630
The problem is according to the tutorial, and everything I find online, the value I set the fuse to is correct for an Atmega168 running on a 16 MHz external crystal. I have no idea why it's not working, unless that's not the right fuse or my crystal circuit isn't correct.
By elerepair
#127490
I just played around with my M8 fuses, and eventually it refused to communicate.. .
Used old trick, with applying square wave to xtal1 pin I succeeded to communicate with my mega.
Square wave was taken from my Scope's calibration output.

As most of posts suggest 1MHz or something like that, my scope's calibration pins provide 1kHz 5v square. so I just gave it a shot. Programmed fine the first try, with my quickly built SiProg programmer and either avrdude or ponyprog..
Set the right fuses and it's good to go.

Good luck!
BR.