|
|||||||
![]() |
Forum Index > Projects > Other projects | ||
USBtinyISP stops working with ATmegaXX8 |
|||
| | | Printable Version |
|
jrw429 | ||||||||
|
Got all my parts this afternoon and spent some time trying to get things working. Everything was going great, and then the programmer stopped talking to the avr. Lots of time on here and adafruit and google and and the 378 page Atmel ATMegaX data sheet, and I can't figure out what to try next. PHP Formatted Code % avrdude -c usbtiny -p atmega168 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. avrdude done. Thank you.
PHP Formatted Code % avrdude -c usbtiny -p atmega168 -F avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1c0102 avrdude: Expected signature for ATMEGA168 is 1E 94 06 avrdude: current erase-rewrite cycle count is -117900033 (if being tracked) avrdude: safemode: Fuses OK avrdude done. Thank you.
PHP Formatted Code % for i in $(jot 10) ; do avrdude -c usbtiny -p atmega168 -F 2>&1 ; sleep 1 ; done | grep 'Device signature' | sort | uniq -c 4 avrdude: Device signature = 0x000000 1 avrdude: Device signature = 0x1c0102 2 avrdude: Device signature = 0x1e2802 1 avrdude: Device signature = 0x1e9406 1 avrdude: Device signature = 0x380002 1 avrdude: Device signature = 0x3c0100
PHP Formatted Code % make clean install rm -f main.hex main.elf main.o avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -c main.c -o main.o avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -o main.elf main.o rm -f main.hex avr-objcopy -j .text -j .data -O ihex main.elf main.hex avrdude -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. avrdude done. Thank you. make: *** [flash] Error 1 % make -n install avrdude -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude -c usbtiny -p atmega168 -U hfuse:w:0xc9:m -U lfuse:w:0x9f:m |
![]() Apprentice ![]() Status: offline
Registered: 02/17/10 |
||||||||
|
|||||||||
|
jrw429 | ||||||||
|
OK, found exactly where I screwed things up. (love infinite scroll buffer on mac!) this worked. PHP Formatted Code % make install avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -c main.c -o main.o avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -o main.elf main.o rm -f main.hex avr-objcopy -j .text -j .data -O ihex main.elf main.hex avrdude -q -q -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude -q -q -c usbtiny -p atmega168 -U hfuse:w:0xc9:m -U lfuse:w:0x1f:m
PHP Formatted Code % make install avrdude -q -q -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude -q -q -c usbtiny -p atmega168 -U hfuse:w:0xc9:m -U lfuse:w:0xBf:m
PHP Formatted Code % make install avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -c main.c -o main.o avr-gcc -save-temps -Wall -Os -DF_CPU=16000000 -mmcu=atmega168 -o main.elf main.o rm -f main.hex avr-objcopy -j .text -j .data -O ihex main.elf main.hex avrdude -q -q -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude: Expected signature for ATMEGA168 is 1E 94 06 Double check chip, or use -F to override this check. make: *** [flash] Error 1
PHP Formatted Code % make install avrdude -q -q -c usbtiny -p atmega168 -U flash:w:main.hex:i avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. make: *** [flash] Error 1
|
![]() Apprentice ![]() Status: offline
Registered: 02/17/10 |
||||||||
|
|||||||||
|
Windell | ||||||||
|
I think you haven't said what efuse setting you left it with. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
jrw429 | ||||||||
|
Hmm, the Makefile created by avr-project has no mention of efuse. So apparently I haven't changed it. PHP Formatted Code % avrdude -q -q -c usbtiny -p atmega168 -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h 0x7f 0xdd 0x1
|
![]() Apprentice Status: offline
Registered: 02/17/10 |
||||||||
|
|||||||||
|
Windell | ||||||||
|
> I pulled the battery and jumpered the USBtinyISP to provide power. One last question - if I select the "Divide clock by 8 internally; [CKDIV8=0]" option, and I have a 16 MHz crystal, should I specify 2 MHz as the chip speed in my Makefile? OK, tried it and I still don't get 1Hz flash. Well, something to work on. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
jrw429 | ||||||||
|
OK, so it seems the flashing LED had nothing to do with the code I wrote. The period of the flash was how long the chip would work until it reset. Seems the batteries just aren't cutting it. Running from USB power via the programmer is fine. And yes, for a 16 MHz crystal with divide by 8 enabled, F_CPU should be 2000000UL. |
![]() Apprentice Status: offline
Registered: 02/17/10 |
||||||||
|
|||||||||
|
jrw429 | ||||||||
|
Specifying the clock speed is used in <util/delay.h> and friends. Does a busy-wait loop, and needs to know this to figure out how many iterations. |
![]() Apprentice Status: offline
Registered: 02/17/10 |
||||||||
|
|||||||||
|
Anonymous: Nick V. | ||||||||
|
Hi - |
|
||||||||
|
|||||||||
|
Windell | ||||||||
|
The "rc=-1" error is a blanket error that covers a whole lot of possible problems. You'll sometimes get this with very obvious things like power not applied, or the connector backwards on the ISP cable connection. Sometimes I've found that you need to unplug the board/programmer and plug it back in and things work okay-- this happens if the computer detects too much power use on the USB port. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
Anonymous: Nick Vradelis | ||||||||
|
|
|
||||||||
|
|||||||||
|
|
| All times are PDT. The time is now 09:41 AM. |
|
|
Octolively
Interactive LED kits
Meggy Jr RGB
LED matrix game
development kit.
Business-card sized
AVR target boards
Peggy 2
LED Pegboard kits