Go Down

Topic: Using  the Arduino as an AVRISP problems (Read 438 times) previous topic - next topic

supermauerbros

Apr 15, 2008, 05:15 pm Last Edit: Apr 16, 2008, 04:21 am by supermauerbros Reason: 1
So continuing my quest to get a working ATMEGA168 using only my Arduino Extreme v2 and ATMEGA8, I stumbled across this project:

http://code.google.com/p/mega-isp/

And I downloaded this, http://mega-isp.googlecode.com/files/avrisp_ard.00.zip
Which is a project to make your Arduino into a serial based AVRISP. Note, if you want to try this you must change the following lines in the provided code:

Delete the case 0x60 and 0x61 (from case to the line that says break;)

Put in the following:
Code: [Select]
case 0x60:
getch();
getch();
empty_reply();
break;
case 0x61:
getch();
empty_reply();
break;

Try a Sketch > Verify/Compile and it should build with no errors.

Anyways, using the ATMEGA168 pinout and this guide, http://www.uchobby.com/index.php/2007/11/04/arduino-avr-in-system-programmer-isp I was able to connect up my working ATMEGA8 to an ATMEGA168 sitting on a breadboard. I used the same resistor values that are suggested for use with the parallel programmer, mostly because I don't know any better. (SCK - 470 Ohm, MISO - 220 Ohm, MOSI - 470 Ohm)

At first all AVRDUDE would see was the programmer itself, using a command like "
Code: [Select]
avrdude" -c avrisp -b 19200 -p m168 -P com
8 -V


When I bought my blank 168's I bought an extra in case of problems, so I decided to try that one. Success! Sorta...

This was my first attempted command (from http://www.ladyada.net/forums/viewtopic.php?t=3558)
Code: [Select]
"avrdude" -c avrisp -b 19200 -p m168 -P com
8 -V -e -U lock:w:0x3F:m -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m -U efuse:w:0xF8:m -
v


This was the result:
Code: [Select]
        Programmer Type : STK500
        Description     : Atmel AVR ISP
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard         : Unknown
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.11s

avrdude: Device signature = 0x1e9406
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as 1
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of lock written
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 1 bytes of hfuse written
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 1 bytes of lfuse written
avrdude: reading input file "0xF8"
avrdude: writing efuse (1 bytes):

Writing |                                                    | 0% 0.00s ***faile
d;
Writing | ################################################## | 100% 0.33s

avrdude: 1 bytes of efuse written

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as 0
avrdude: safemode: efuse changed! Was f8, and is now 0
Would you like this fuse to be changed back? [y/n] y
^C


That lovely ^C you see there is me cancelling the window because it was caught in a loop, with the Arduino's TX/RX  lights going crazy.

If I try to communicate with the chip now, I get the same "avrdude: Device signature = 0xffffff" error I did with the other chip. In the words of Cameron Fry, "What I do?"


Questions: 1. If I bought a real AVRISP MKII, could it fix these problems?
               2. I tried AVRstudio but it refuses to connect to my Arduino avrsip, are there other options besides avrdude?
               3. What are my other options at this point? I've tried parallel programmers but they haven't worked at all.
               4. I'm desperate, I only have 2 more days before I need this chip and if the MKII could fix my problems I need to know so I can order one ASAP.

Insanely long post, thanks for your time and support.

-Jake

Go Up