ATmega8 with arduino as ISP programming issues... - Page 1
Forum section: electronics / general

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 17, 2012, 06:35:16 am
content: I have searched around for answers but I haven't been able to get my problem solvedAfter building myself a linear PSU, I wanted a voltage panel. I did not like any pre-made ones so I decided to make one myself using 4x 7-segs and a microcontroller using the chips' ADC.I bought an ATmega8 chip and did some basic programming with it using my freetronics Eleven (UNO) to program it as an ISP. (I did not burn a bootloader as I don't need it). Using the Arduino IDE (1.0.1) I was able to program the blink program onto the ATmega8 chip using my Eleven as the ISP. I modified the program and re-uploaded to the chip a couple of times with no problems. Throughout testing of the chip, I did not have an external oscillator connected and it still worked.Now a week later, after writing my program.. I can not seem to get it to upload! I have checked my wiring over and over, pinouts, and voltages... No luck!But when I select the "Arduino NG or older w/ Atmega8" (which I used when i first got the chip) I keep getting the error- "Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.".I have followedhttp://arduino.cc/forum/index.php?topic=112452.0and I get an error of: avrdude:- "stk500_getsync(): not in sync: resp=0x66"I'm lost because I know I had it working..Any ideas of what I could do to fix this?

author: Psi
author_rank: Super Contributor
timestamp: July 17, 2012, 06:49:04 am
content: If you have another ATMEGA8 lying around, just try swap them around. It's so easy to do you might as well try it first.It proves the chip and fuse bits aren't the issue.You don't seem to have any resistors on those LEDs?If their being driven directly from an I/O port, and haven't exploded, it will be because they're pulling the I/O voltage down by a few volts.This maybe preventing the programming signals from being detected.(Note if the programmer board has its own resistors then you can ignore this comment)Double check the- Power and Ground connections- RESET, SCK, MISO, MOSI and remember M=master S=slave I=input O=output- Remove that pullup resistor you have between RESET and VCC (It doesn't need it and if it's pulling too hard it maybe causing issues)When checking connections connect the DMM probe between the actual pin of the IC and the header of your programmer. This checks all connection points along the way.Also check all pins for a short to their adjacent pins.Put your program aside and try a brand new program. Just something simple that blinks a led.If it still doesn't work then pull all the wires and chips out of the breadboard. Rotate the breadboard 180 degrees and rebuild your circuit.Often you get bad connections with breadboards.Sometimes with small circuits it's quicker to just rebuild than to try and track down the problem.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 17, 2012, 09:05:40 am
content: I've only got the one chip(Other than an ATmega8515 that I couldn't program?)Nope I didn't have resistors connected. This is how I did it the first time.I've now used a resistor for the status LED's (driven from the programmer) and I've removed the pullup resistor as well. I tried to upload again and got:- avrdude: Expected signature for ATMEGA8 is 1E 93 07Double check chip, or use -F to override this check.Re-uploading gives me :-avrdude: Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.The chip is an ATmega8 (picture attached)I deleted my Arduino IDE, re-downloaded the latest and tried, no luckI'm thinking that I may have to connect an external oscillator.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 17, 2012, 09:09:24 am
content: I've checked all the connections for continuity. No issues there. I checked the pins on each ATmega. And there are no shorts.And I've tried putting the chip on a different breadboard, still the same issues.I've got a feeling that I'm experiencing what's written in this thread:http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=99652

author: Psi
author_rank: Super Contributor
timestamp: July 17, 2012, 09:14:54 am
content: Sometimes fuse bits do get corrupted, but normally it happens while your working not between putting the project aside and picking it up again later.If it was me, i'd try and reprogram it with a simple printer port connection. That would rule out the programer board.An external oscillator is worth a try

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 17, 2012, 09:19:30 am
content: Damn, I had ordered some but still waiting for them to arrive. Would it be possible to link off of the oscillator on the Arduino board connected to the Atmega328p?

author: Psi
author_rank: Super Contributor
timestamp: July 17, 2012, 09:28:13 am
content: There is a website somewhere that shows someone resetting the fuse bits on a ATMega using some switches to simulate the high voltage programming mode.ie, entering the programming mode and sending commands by hand with switches on all the i/o pin!I cant find the url though, also not sure if it was an atmega8.

author: amyk
author_rank: Super Contributor
timestamp: July 17, 2012, 10:17:35 am
content: Quote from: Psi on July 17, 2012, 09:28:13 amThis?http://ilikebugs.blogspot.com/2006/09/avr-necromancer.htmlA bit tedious, but it works if you follow the instructions in the datasheet. I've done it a few times.

author: Psi
author_rank: Super Contributor
timestamp: July 17, 2012, 12:38:20 pm
content: yeah, i think that's the one.I remember it having more detail though

author: Erwin Ried
author_rank: Regular Contributor
timestamp: July 17, 2012, 08:25:20 pm
content: Usually the programmers set the lock bits to avoid reprogramsI have lots of attinys dead because of that, you can build an HV programmer and it works but I am waiting now a attiny resetter to automate the process.Check this:http://www.microcontrollerprog.com

author: Unknown
author_rank: Unknown
timestamp: July 17, 2012, 10:50:03 pm
content: Why would you need a HV programmer to clear the lock bits? Erasing the chip should clear them.If you screwed up the clock fuses (eg. external clock), you may need to provide a clock source. You can usually feed it a square wave, unless it was set to LF crystal, then you need a 32 kHz crystal. If you set the RSTDISBL fuse, then you do need a HV programmer to clear it.Like Psi, I would also suspect bad wiring or poor breadboard contacts.

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 01:46:55 am
content: The other thing you can get is shorts between breadboard sections when you put a long wire into the board.The wire can sometimes bend over inside and start moving sideways until it hits another conductor.It tends to happen on the cheap breadboards.You do have the programmer MOSI connected to slave MISO and vice versa right?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 10:56:01 am
content: QuoteI've made my own jumper leads using pin headers and heat shrink to cover the joint. So should be no issues there, hopefully.I bought another ATmega8, hooked everything up (programmer and the circuit), programmed the chip and away it went with no problems. Displays lit and did exactly what I wanted. I modified my code a little and went to re-upload it (Didn't touch any wires) and now from the Arduino IDE, i'm getting:avrdude: verification error, first mismatch at byte 0x02e90xe9 != 0xe0avrdude: verification error; content mismatchMy code is designed to light one segment, darken it, and light the next one. Sweeping all the segments to have a constant display. Now it is slowly scanning across (about 1 second to do a sweep) ?

author: amyk
author_rank: Super Contributor
timestamp: July 18, 2012, 10:59:55 am
content: Noisy environment during programming can cause that. Ensure the wires to the programmer are as short as possible and located away from any sources strong EM fields.It's not behaving as you want because the code has been corrupted. Do a full chip erase, and try again.Also keep in mind ESD precautions.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 11:01:20 am
content: Quote from: amyk on July 18, 2012, 10:59:55 amSounds likely. I am using decoupling caps. Is the erase possible using the Arduino as the ISP?Thanks

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 11:06:33 am
content: Quote from: amyk on July 18, 2012, 10:59:55 amAlso, put some caps on your breadboard. Put a small cap (~10uF) across the power rail and ground and put a 100nF across the MCU's power pins, VCC and GND.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 11:18:09 am
content: Quote from: TerminalJack505 on July 18, 2012, 11:06:33 amYup, I'm using decoupling capacitors on my breadboard. I'm using 10uF across the rails, and 10nF greencaps directly next to the chip.I've tried to uploadCode:void setup(){}void loop(){}and i'm still getting a mismatch error.Is the device now locked from any more programming?

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 11:22:14 am
content: Quote from: GabYoung92 on July 18, 2012, 10:56:01 amThis means the micro is responding OK and being programmed with your code, but when it read the code back out of the micro the two didn't match.So there's a corruption happening somewhere.This is almost always a bad connection, noise on the power/ground connection or overly long cables.Sometimes i see micros that will run even with a power or ground wire disconnected as the power feeds in through one of the I/O ports from somewhere else.In this situation you get all sorts of errors like that.Maybe put an LED+resistor across the ATMega8 vcc/gnd pins to check there is voltage/current there. It should not dim when you try and program the chip.Also be sure you have connected all VCC and all GND pins. As well as AVCC.You shouldn't leave any power/ground pins unconnected.When you get stuff likeQuoteThat means the MCU isn't responding at all.It could be broken, unconnected or have its fuse bits set to ignore reprogramming

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 11:39:41 am
content: I have checked my voltages on the pins. Any pin that needs 5V, I've measured around the range of 5.1volts.GND pin 8 connected to GNDGND pin 22 connected GNDVCC pin 7 connected to +5VAVCC pin 20 connected to +5vAREF pin 21 floating.I've attached extra code to set digital pin 0 (pin2) to high. I'm still only reading 0.1V on that pin. I'll pull all the wires out and start again?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 11:50:20 am
content: Have you tried running avrdude manually from the command line? You might try running it to see if you can get into terminal mode.I'm guessing you'd type something like this:avrdude -p m8 -c arduino -tI don't know if you need the -P option or not. You might mess around with the different command line option that affect timing to see if they help. I suspect your MCU is running at 1 MHz but your programmer is trying to upload data at a faster rate.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 12:20:16 pm
content: Code:avrdude -p m8 -c arduino -P COM7 -tavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.01savrdude: Device signature = 0x1e950favrdude: Expected signature for ATMEGA8 is 1E 93 07Double check chip, or use -F to override this check.avrdude done. Thank you.I posted a link earlier of a tutorial I followed. I added to the board.txt file this: and I was using this to utilize the internal oscillatorCode:atmega8u.name=ATmega8-noxtal @8MHzatmega8u.upload.protocol=arduinoatmega8u.upload.maximum_size=7168atmega8u.upload.speed=19200atmega8u.bootloader.low_fuses=0xe4atmega8u.bootloader.high_fuses=0xc2atmega8u.bootloader.path=atmega8_noxtalatmega8u.bootloader.file=ATmegaBOOT.hexatmega8u.bootloader.unlock_bits=0x3Fatmega8u.bootloader.lock_bits=0x0Fatmega8u.build.mcu=atmega8atmega8u.build.f_cpu=8000000Latmega8u.build.core=arduinoatmega8u.build.variant=standard

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 12:20:56 pm
content: From reading that config file am i right in assuming you're trying to run the onboard RC osc at its max 8mhz?Because i always had programming issues doing that myself. 1Mhz was fine but anything above 4mhz on the RC i found unstable for ISP programming.The issue went away using a crystal instead.Quote from: TerminalJack505 on July 18, 2012, 11:50:20 amYeah, slowing down the data rate is definitely something to try.-i 20 adds some ISP delay but I dunno if that works for arduino programmers?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 12:28:43 pm
content: That signature must be of the chip on the Arduino board. At least it matches that of an ATmega328. Maybe that's not the way you launch avrdude when you're using the Arduino board as the programmer. It isn't something I've ever tried to do myself.

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 12:31:25 pm
content: Yes, that command seems to be trying to reprogram your programmer, not your ATmega8AVRDUDE was looking for an ATmega8 and found a 0x1e950f (ATmega328) so aborted the process.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 12:34:08 pm
content: I have to wonder if your Arduino has lost it's 'programmer' firmware. Have you tried re-uploading it?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 12:46:07 pm
content: Quote from: TerminalJack505 on July 18, 2012, 12:34:08 pmShouldn't have... I've reaupload the ArduinoISP sketch again and reconnected up the ATmega8 viahttp://arduino.cc/en/Tutorial/ArduinoISP(bottom left image)Code:avrdude -p m8 -c arduino -P COM7 -tavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.01savrdude: Device signature = 0x1e950favrdude: Expected signature for ATMEGA8 is 1E 93 07Double check chip, or use -F to override this check.avrdude done. Thank you.Yup it's reading the signature of the arduino 328p chip, not the ATmega8... should I be using any other commands for AVRdude?Bit of a bummer really... New chip, got to upload once, now same issues. Should have burnt the bootloader?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 12:53:17 pm
content: It's interesting that your config file is using a slower upload speed than the webpage you linked to.Your config has this:atmega8u.upload.speed=19200...and one of the pages has this:atmega8noxtal.upload.speed=38400Have you tried both just in case?The only other thing I can think of is there's an issue with the reset line. Maybe the Arudino programmer isn't pulling it low.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 12:59:15 pm
content: Quote from: TerminalJack505 on July 18, 2012, 12:53:17 pmYes, I had changed the speed.Using 38400, The error led just lights and I get:avrdude: stk500_getsync(): not in sync: resp=0x66Using 19200, There is programming via the status led, and I get:avrdude: verification error, first mismatch at byte 0x00c00x64 != 0x60avrdude: verification error; content mismatchUsing 9600, I get a solid error status and:avrdude: stk500_getsync(): not in sync: resp=0xff

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:05:32 pm
content: I notice that you said you didn't burn a boot loader. I haven't looked too close but the fuse bits in that config look like they are setup for a boot loader.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:12:16 pm
content: Quote from: TerminalJack505 on July 18, 2012, 01:05:32 pmNo, I haven't burnt one. I was going to avoid burning one as I was going to upload the program to the chip and put it into a board stuck in my power supply so I didn't see the point of using it. Also I don't have any 16Mhz X-TAL, so i was trying to use the internal clock as timing is not critical.Also, Thanks for your help. I hope I'm not making you pull your hair out

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:13:15 pm
content: QuoteIs this the pin that connects to the ATmega8's RESET# pin? Is this change something you did in the Arduino ISP code?

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 01:16:16 pm
content: How come the high fuse bits are set C2QuoteC2 = 1100 0010This sets CKOPT to 0 (programmed)ATMega8 datasheet says CLOPT should be un-programmed when using internal RC clockUn-programmed is the default so this may explain why it worked the first time.The low fuse value E4 seems ok, but it does set CKSEL to 0100 which for internal RC is 8mhz which i had issues with.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:17:34 pm
content: Quote from: TerminalJack505 on July 18, 2012, 01:13:15 pmThe arduino has the arduinoISP sketch on it. I was trying to upload my code to the ATmega8 chip using the arduino as the ISP. I added code into my program to switch HIGH an unused digital pin (pin 0, physical pin 2) on the ATmega8 chip to do some debugging. Pin 1 of the chip is the Reset pin, pin 2 is digital pin 0. There is no shorts between these two pins.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:19:10 pm
content: Quote from: Psi on July 18, 2012, 01:16:16 pmI see where you are coming from. So I'm guessing I need to obtain an external oscillator and reprogram the high fuses or erase the device?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:21:03 pm
content: QuoteAh. I see.Quote from: GabYoung92 on July 18, 2012, 01:12:16 pmNo problem. I'm probably not going to be of much help since I've never tried using a Arduino for ISP before.I'm guessing you don't happen to have an AVR ISPMKII, JTAG ICE or Dragon?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:27:52 pm
content: Quoteunfortunately not. That's why I'm using the ArduinoJust gave a quick ebay search. Should I get myself a one hung low one to play around with or go the extra and get a brand name one?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:28:29 pm
content: ...I'm slowly reading through those webpages you linked to.Apparently avrdude will talk to the Arduino ISP using the AVR ISP mkII protocol.If so then you should be able to run:avrdude -p m8 -c avrispmkII -P com7 -t...to get into terminal mode. You might try it and see if you can talk to the device and read the fuse bits.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:31:18 pm
content: QuotePersonally, for the money I'd get an Atmel brand. That's a topic that will start a war of religions, though, so that's just between you and me.

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 01:33:07 pm
content: Quote from: GabYoung92 on July 18, 2012, 01:19:10 pmI'm not sure, CKOPT just adds a capacitor to ground for doing an external RC osc. It may still work with it enabled.I've not used Arduinos before, only raw AVRs with avrdude. So i'm not sure exactly how the arduino ide fits into things but..I can't see it ever working until avrdude finds the correct signature.From your post on the previous page we can see it's finding the programmer mcu and not the ATMega8.So there must be a setting wrong somewhere.However.QuoteThis text you posted indicates that the programming has actually started but has encountering a mismatch error. Which would indicate that the signature was correct (or it wouldn't have started)So i'm quite confused.But if i had to guess i'd say your ATmega8 is still ok and running off the internal RC oscillator correctly.If a clock fuse had been set wrong and the RC osc stopped working you wouldn't be getting mismatch errors.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:34:02 pm
content: Quote from: TerminalJack505 on July 18, 2012, 01:28:29 pmUsing -c arduino I get incorect signature (the 328p responds)Using -c avrispmkII I get a solid error led and:avrdude -p m8 -c avrispmkII -P com7 -tavrdude: stk500v2_ReceiveMessage(): timeoutavrdude: stk500v2_ReceiveMessage(): timeoutavrdude: stk500v2_ReceiveMessage(): timeoutQuote from: TerminalJack505 on July 18, 2012, 01:31:18 pmFair enough. I may get a cheapie for now. Then later down the track get a proper programmer.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:39:00 pm
content: PSI, that's what has had my confused.It needs an upload bitrate of 19200 to work at all, status lights display programming correctly, it's just the verification that's the issue.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:41:00 pm
content: QuoteYou might need to use either the -b option or the -B option. Either that or the -P option will be something different.For now try using -B...avrdude -p m8 -c avrispmkII -P com7 -B 100 -t

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 01:42:31 pm
content: So you get the avrdude progress bar ####### etc...It just says mismatch during the read back part?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:45:50 pm
content: TerminalJack505,Code:avrdude -p m8 -c avrispmkII -P com7 -B 100 -tavrdude: stk500v2_ReceiveMessage(): timeoutavrdude: stk500v2_ReceiveMessage(): timeoutavrdude: stk500v2_ReceiveMessage(): timeoutavrdude: stk500v2_ReceiveMessage(): timeout^CPsi,No there's no progress bar (I'm assuimging you mean in the Arduino IDE) Just going straight to and error.Not sure what I've done now, but all I'm getting is an invalid signature error.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:47:50 pm
content: You might try this then...avrdude -p m8 -c avrispmkII -P com7 -b 19200 -t

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 01:52:38 pm
content: Quote from: TerminalJack505 on July 18, 2012, 01:47:50 pmI just get:Code:avrdude: stk500v2_ReceiveMessage(): timeoutHowever....Code:C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>avrdude -p m8 -c AVRisp -P com7 -b 9600 -tavrdude: stk500_getsync(): not in sync: resp=0xffavrdude done. Thank you.C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>avrdude -p m8 -c AVRisp -P com7 -b 38400 -tavrdude: stk500_getsync(): not in sync: resp=0x66avrdude done. Thank you.C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>avrdude -p m8 -c AVRisp -P com7 -b 19200 -tavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.08savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.avrdude done. Thank you.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 01:57:06 pm
content: Well, you might as well use the -F option just so you can maybe get a little peek at what it's connecting to.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:00:38 pm
content: Quote from: TerminalJack505 on July 18, 2012, 01:57:06 pmCode:avrdude -p m8 -c AVRisp -P com7 -b 19200 -t -Favrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.07savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATMEGA8 is 1E 93 07avrdude> ?>>> ?Valid commands:dump : dump memory : dump <memtype> <addr> <N-Bytes>read : alias for dumpwrite : write memory : write <memtype> <addr> <b1> <b2> ... <bN>erase : perform a chip erasesig : display device signature bytespart : display the current part informationsend : send a raw command : send <b1> <b2> <b3> <b4>parms : display adjustable parameters (STK500 only)vtarg : set <V> (STK500 only)varef : set <V> (STK500 only)fosc : set <oscillator frequency> (STK500 only)sck : set <SCK period> (STK500 only)spi : enter direct SPI modepgm : return to programming modehelp : help? : helpquit : quitUse the 'part' command to display valid memory types for use with the'dump' and 'write' commands.avrdude> sig>>> sigReading | ################################################## | 100% 0.08sDevice signature = 0x000000avrdude> part>>> partAVR Part : ATMEGA8Chip Erase delay : 10000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 4 20 128 0 no 512 4 0 9000 9000 0xff 0xffflash 33 10 64 0 yes 8192 64 128 4500 4500 0xff 0x00lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00avrdude>

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:06:35 pm
content: That's encouraging. Try the following...dump lfuse 0 0dump hfuse 0 0dump lock 0 0dump signature 0 3

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:08:09 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:06:35 pmI'm hoping that I have done this correctly:Code:avrdude -p m8 -c AVRisp -P com7 -b 19200 -t -Favrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.08savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATMEGA8 is 1E 93 07avrdude> dump lfuse 0 0>>> dump lfuse 0 0avrdude> dump hfuse 0 0>>> dump hfuse 0 0avrdude> dump lock 0 0>>> dump lock 0 0avrdude> dump signature 0 3>>> dump signature 0 30000 00 00 00 |... |avrdude> sig>>> sigReading | ################################################## | 100% 0.07sDevice signature = 0x000000avrdude> part>>> partAVR Part : ATMEGA8Chip Erase delay : 10000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 4 20 128 0 no 512 4 0 9000 9000 0xff 0xffflash 33 10 64 0 yes 8192 64 128 4500 4500 0xff 0x00lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00avrdude>

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 02:11:18 pm
content: Looks like it's communicating with thin air.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:12:46 pm
content: Quote from: Psi on July 18, 2012, 02:11:18 pmWhich is the opposite of what I wantI noticed in the help menu, an option to erase chip... Should I give this a go?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:13:01 pm
content: That's weird. It didn't read any of the fuse settings and the signature is blank. I'm pretty sure that's how you read the fuse bits.You might have some options you can set via the 'params' command as well since your Arduino is emulating an AVR ISP.There's a timing-related parameter in there that I've had to change a few times.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:14:29 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:13:01 pmI'm all ears to try anything.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:17:41 pm
content: Try dumping some of the flash memory. I'm just curious if you're really communicating with the chip.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:20:11 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:17:41 pmATmega8 chip I got today:Code:avrdude> dump flash>>> dump flash0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|avrdude>ATmega8 chip I bought a couple of days ago:Code:avrdude> dump flash>>> dump flash0000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|0010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|0020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|0030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|avrdude>

author: Psi
author_rank: Super Contributor
timestamp: July 18, 2012, 02:26:09 pm
content: Does your computer have a printer port (LPT)You can pretty much wire them up pin for pin to any AVR and reprogram it with avrdudeavrdude -i 20 -p m8 -P lpt1 -c bsd -e -U flash:w:mycode.hexYou need to get 5V from somewhere else though, there is no 5V out on a printer port sadly.The pinouts can be found herehttp://www.pocketmagic.net/wp-content/uploads/2009/02/avr-bsd.pngThe labels given (MISO etc.) are the slave micro pins. so just match them up 1:1The 4 resistors can be anything less than 1K, i normally use 220R or sometimes leave them out completely (risky).

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:34:54 pm
content: So what does the 'parms' command return? There's a 'SCK period' setting. My ISP returns 10.37 us. I'm curious what yours is.Code:~ > avrdude -p m8 -c avrispmkII -P usb -tavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.01savrdude: Device signature = 0x1e9307avrdude> parms>>> parmsVtarget : 5.0 VSCK period : 10.37 usavrdude>

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:38:20 pm
content: Quote from: Psi on July 18, 2012, 02:26:09 pmI'll have to try that tomorrow on another computer (My laptop doesn't have a LPT). Power will be no problemTerminalJack505:Code:avrdude> parms>>> parmsVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usavrdude>A whole load of nothing... by the looks of it. Using my DMM, GND to VCC has 5.14Vhttp://www.logikdev.com/2011/02/15/reset-clock-fuse-bits-on-avr/I know that's not for my chip, but maybe?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:39:57 pm
content: Just realized that I gave you the wrong commands for reading the fuses. Try these...dump lfuse 0 1dump hfuse 0 1dump lock 0 1

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:41:00 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:39:57 pmCode:avrdude> dump lfuse 0 1>>> dump lfuse 0 10000 00 |. |avrdude> dump hfuse 0 1>>> dump hfuse 0 10000 00 |. |avrdude> dump lock 0 1>>> dump lock 0 10000 00 |. |avrdude>

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:45:03 pm
content: Those fuse settings aren't right, obviously.That SCK period may be too fast. Try changing it with the SCK command.Code:sck 11

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:47:28 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:45:03 pmI wired up an ATmega8515 and I'm getting the same thing. Maybe it's the arduino or the protocol that's causing errors?Code:avrdude -p m8515 -c AVRisp -P com7 -b 19200 -t -Favrdude: please define PAGEL and BS2 signals in the configuration file for partATMEGA8515avrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.07savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATMEGA8515 is 1E 93 06avrdude> sig>>> sigReading | ################################################## | 100% 0.07sDevice signature = 0x000000avrdude> part>>> partAVR Part : ATMEGA8515Chip Erase delay : 9000 usPAGEL : P00BS2 : P00RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 4 20 128 0 no 512 0 0 9000 9000 0xff 0xffflash 33 6 64 0 yes 8192 64 128 4500 4500 0xff 0xfflfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00avrdude>

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:50:08 pm
content: Could be. That page you linked to used a setting of 1000 for the SCK parm. You might try that. That setting basically controls how fast the programmer talks to the chip so 0.1us may be to fast. I'm using 10us on my programmer. 1000us should work for any clock speed.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 02:55:16 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:45:03 pmCode:avrdude> sck 11>>> sck 11avrdude: stk500_setparm(): (a) protocol error, expect=0x14, resp=0x12avrdude (sck): failed to set SCK period (rc = -2)avrdude>Plus, the heartbeat, error and programming leds are all on now.I don't know.. I think I may leave this for now and give the LPT port a go later on.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 02:58:27 pm
content: I bet the Arduino ISP firmware doesn't support that option. The timing is probably hardcoded.Did you check the status of the RESET# pin on the ATmega8 while you where in avrdude? It should be low.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 03:01:45 pm
content: Quote from: TerminalJack505 on July 18, 2012, 02:58:27 pmWhile avrdude is running. The programing led is on, and I'm getting (DMM) 0V on the reset pin of the ATmega8 chip. With reference to VCC, the RESET pin is -5.1 volts, so low.Something I've just noticed...Code:avrdude> parms>>> parmsVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usOscillator is off.. should that be?

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 03:10:15 pm
content: I'm guessing we're not using avrdude correctly for the ISP 'programmer'.Just for grins you might try this as well when you launch avrdude...avrdude -p m8 -c avrispmkII -P usb -tThe oscillator option probably works like the STK500 where you can have it (the STK500 board) generate a clock for the MCU. You don't want that in this case.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 18, 2012, 03:17:27 pm
content: Quote from: TerminalJack505 on July 18, 2012, 03:10:15 pmChanging the -c param causes the error LED to light and I just receive a timeout message. I've found using -c with AVRisp is the only way to get avrdude communicating through the arduinoISP. (Not sure if it is actually working, but the terminal seems to like it).I've got a feeling that the chip has been programmed to use an external clock which I think may explain why they are not responding as expected.I will give the printer port a go tomorrow. Thanks guys!

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 18, 2012, 03:26:40 pm
content: QuoteHave you tried hooking up a crystal and capacitors to the XTAL1 and XTAL2 pins?

author: Erwin Ried
author_rank: Regular Contributor
timestamp: July 19, 2012, 01:12:14 am
content: Quote from: GabYoung92 on July 18, 2012, 03:17:27 pmBuy a cheap USB ISP programmer in ebay, I got mine at 4 usd with the cable and shipment (http://www.ebay.com/itm/USB-ASP-ISP-Programmer-Adapter-10-Pin-Cable-For-ATMega8-AVRDude-CAN-PWM-Series-/140784185108?pt=LH_DefaultDomain_0&hash=item20c7642f14). I use khazama programmer to upload the code, no commands and let your arduino to be free

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 01:18:56 am
content: Just bought the programmer... Now to wait till it arrivesTerminalJack505,I don't have any spare ones, however I could pull one out of an old device. Should I try and find a certain frequency?And I'm unable to use the parallel port

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 01:27:39 am
content: Quote from: GabYoung92 on July 19, 2012, 01:18:56 amThe more I think about it, the more I suspect the 'programmer'. Especially considering it didn't work with the 8515. Assuming, of course, we were invoking avrdude correctly for that particular programmer.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 02:09:58 am
content: Ok I found a LPT header in my tower, grabed pin diagrams and hooked it up as per a previous post.I've tried to install the giveio but...Code:H:\avr\bin>install_giveioCopying the driver to the windows directorytarget file: C:\Windows\giveio.sys1 file(s) copied.Remove a running service if needed...Installing Windows NT/2k/XP driver: giveioinstalling giveio from C:\Windows\giveio.sys... ok.starting giveio... start failed (status 1275):This driver has been blocked from loadingERROR: Installation of giveio failedI am running windows7 64bit. I've given a quick google search and most things I've read say it doesn't work on 64bit. Is there any other program I could use or would it be best to wait until my programmer arrives?(http://www.ebay.com/itm/USB-ASP-ISP-Programmer-Adapter-10-Pin-Cable-For-ATMega8-AVRDude-CAN-PWM-Series-/140784185108?pt=LH_DefaultDomain_0&hash=item20c7642f14)

author: Psi
author_rank: Super Contributor
timestamp: July 19, 2012, 02:20:24 am
content: Just to test it you could boot that PC on a ubuntu linux live cd.sudo suapt-get install avrdudeavrdude -i 20 -p m8 -P /dev/parport0 -E noreset -c bsd -e -U flash:w:mycode.hexIf you're wondering what the "-E no reset" does it just means the mcu will start running once avrdude finishes.(Otherwise avrdude sets the port back how it found it, which in linux is with reset held low)

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 02:26:04 am
content: Quote from: Psi on July 19, 2012, 02:20:24 amI'll give that a go. Downloading 12.04 now,Am I able to upload the arduino bootloader to the chip using avrdude so that programming is easy until my programmer arrives?

author: Psi
author_rank: Super Contributor
timestamp: July 19, 2012, 03:04:24 am
content: Yes, if you have a bootloader hex file you should be able to upload that in the same way.However you will need to change the fuse bits to enable the reset vector and set the required boot blocks size.It may also need the EEPROM preserve fuse set, if the boot loader uses the eeprom?To change a fuse bit you can goavrdude -c bsd -p m8 -E noreset -P /dev/parport0 -U lfuse:w:0x??:mavrdude -c bsd -p m8 -E noreset -P /dev/parport0 -U hfuse:w:0x??:mwhere ?? is the hex value to set and where lfuse/hfuse specifies which fuse byte you're settingThis is where people make mistakes and set the hfuse to what the lfuse should be or get the bit order reversed etc..Best thing to do is first read out the current fuse bits and check to see if they make sense, as this checks if your method of reading/understanding them is correctly.I don't think you can just display them on the screen with avrdude but you can read them out as filesavrdude -c bsd -p m8 -E noreset -P /dev/parport0 -U hfuse:r:high.hex:ravrdude -c bsd -p m8 -E noreset -P /dev/parport0 -U lfuse:r:low.hex:rNow you have two files.. high.hex and low.hexIf you run "hexdump low.hex" you will get0000000 00ef0000001So EF is the current low fuse value for that example.Convert to binary and compare to datasheet to see which flags are set.If you're unsure about fuse bit stuff, ask before doing it.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 06:47:28 am
content: Oh noes! I think..First go I connected to the ATmega8.. second go I plugged it into the 328p on the arduino board..Is there something I'm doing wrong here?Code:ubuntu@ubuntu:~$ sudo avrdude -p m8 -b 19200 -P /dev/parport0 -c bsd -Favrdude: AVR device not respondingavrdude: initialization failed, rc=-1avrdude: AVR device initialized and ready to accept instructionsavrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATMEGA8 is 1E 93 07avrdude done. Thank you.ubuntu@ubuntu:~$ sudo avrdude -p m328p -b 19200 -P /dev/parport0 -c bsd -Favrdude: AVR device not respondingavrdude: initialization failed, rc=-1avrdude: AVR device initialized and ready to accept instructionsavrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATMEGA328P is 1E 95 0Favrdude done. Thank you.

author: Psi
author_rank: Super Contributor
timestamp: July 19, 2012, 07:20:05 am
content: -b does nothing when using the LPT port, it's for setting the serial port baudrate.I've never needed to use -F to force communication. If it can't detect the signature then it's not going to work so there's no point forcing it.Try add -i 20 that will slow down the LPT program rate.Do you have the mega8 connected to the printer port pins correctly and are you supplying the mega8 with 5V power from somewhere?Can you post a pic of it?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 07:39:34 am
content: Quote from: Psi on July 19, 2012, 07:20:05 amI've unpluged it since then. I salvaged a 14.3F1FB crystal and two caps. Connected them up using the arduino as ISP and tried again... But I can't seem to get it to read the signature.Picture of what i've got currently

author: amyk
author_rank: Super Contributor
timestamp: July 19, 2012, 08:21:34 am
content: I was also thinking of recommending you try the simple parallel port interface, but it seems you can't get any communication happening. This can happen if you've accidentally programmed RSTDISBL, which may have been due to the same thing that caused the corruption earlier.If I were you I'd just hook it up in parallel programming mode manually (a few switches and debounced pushbuttons is enough, and a 12V source through current-limiting resistor - 250uA is enough) and at least see if the signature bytes can be read out. The advantage of this mode is it doesn't need a clock at all, and while they're latched on the output you can probe the pins with a multimeter to see if they're the expected values. The datasheet explains the procedure in detail.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 08:25:40 am
content: That should probably work if the MCU is set to use an external xtal. Are those caps ~15pF?The code for the programmer firmware says:QuoteIs this the version of avrdude you're using?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 08:51:24 am
content: Quote from: TerminalJack505 on July 19, 2012, 08:25:40 amI'm not sure of the fuse programming. I used the boards template onhttp://arduino.cc/forum/index.php?topic=112452.0to try and program it to use the internal clock.The markings on them are 102 100v, 1000pF from doing a quick search.. I know they are far too large.. but it was the only caps I could salvage to try the XTAL. I've got an order of 16MHz crystals and 20pF caps on the way. But for the time I'd thought I would try this setup.Yes, I was using avrdude which was inside my Arduino IDE package. I'm installing WinAVR as I'm typing this.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 09:00:14 am
content: You never programmed the 8515, right? And it doesn't work with the programmer either? If so then I say something's wrong on that side instead of the MCU.Did you make any changes to the firmware? I saw one of thepagessuggest a change that looks like would affect the timing.Quote

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 09:05:24 am
content: Quote from: TerminalJack505 on July 19, 2012, 09:00:14 amNo I've never been able to program the 8515. Well my arduinoIDE has always told me it's failed.I'm using 1.0.1 which has updated the sketch already so I didn't have to change any of the code.I think its the chip. I'm trying to burn the bootloader onto the ATmega8 using the Arduino via arduinoIDE but I'm still getting the signature error.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 09:14:35 am
content: I'm wondering if your sketch is the same one that I got then. I grabbed the latest version (.04) and the code still has this...Code:void heartbeat() {if (hbval > 192) hbdelta = -hbdelta;if (hbval < 32) hbdelta = -hbdelta;hbval += hbdelta;analogWrite(LED_HB, hbval);delay(40);}So far as the 8515 goes, if it's never been programmed then avrdude shouldn't have any issues connecting to it since there's no chance that the fuses have been fubarred yet.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 09:17:26 am
content: Quote from: TerminalJack505 on July 19, 2012, 09:14:35 amLoaded up Arduino 1.0.1, ArduinoISP sketch. Yep, delay(20);I'll re-upload the ISP program to my 328, connect the 8515 and give it a go.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 09:27:50 am
content: Code:avrdude -p m8515 -c avrisp -b 19200 -P COM7avrdude: please define PAGEL and BS2 signals in the configuration file for partATMEGA8515avrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.07savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.avrdude done. Thank you.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 10:15:59 am
content: I'm out of ideas. I guess the next thing to try is HV parallel programming. You might be able to find a Arduino sketch to help in that regard.

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 19, 2012, 12:49:59 pm
content: Just something I noticed: I think you don't have to specify the-P COM7if you're using an USB programmer like the AVRisp (Arduino). At least I never did when I used the AVRisp to programm my perfboard USBtinyISP (ATtiny2313). Maybe that's why it's reading garbage, because it's trying to access the COM Port 7 somehow and nothing is connected to it?http://www.ladyada.net/make/usbtinyisp/avrdude.htmlQuoteI think the Arduino AVRisp works the same way. (Might not be true for Linux?)I managed to fix some AVRs with bad fuse settings this way:- I set up my Arduino to generate a clock (basically the blinky sketch without delays is what I used here). Any other clock source will probably do, like the calibration output of a scope. If you own one.- Hooked up the clock output of the toggleing Arduino to the XTAL1 input of the broken AVR. GND of Arduino connected to GND of the AVR (obviously).Used USBtinyISP to flash fuses with following command:avrdude.exe -p m168 -c usbtiny -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xf9:m -B 2000Notes:Not all AVRs have extended fuses (efuse).The -B option specifies the ISP clock speed. 2000 is a rather slow value. It didn't work for me without that -B option. You can read some more about the -B option on the link to Lady Ada a bit further up my post.I put in the default fuse settings for the ATmega168 (m168). You can find out the default fuse settings of many AVRs on this handy homepage:http://www.engbedded.com/fusecalc/I admit I didn't read the full thread, so if this has been said before, I am sorry.Cheers,Florian

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 19, 2012, 12:58:43 pm
content: LEECH666 I'll have to give that a go in the morning. See if it makes a difference because it sort of makes sence because com7 is the port to the arduino.. this may be an issue, I'm not sure, but worth a go of course!No DSO as of yet, but I recently ordered a Rigol ds1502eand was hoping for it to turn up today!no luck so maybe in the morning. Would the 1khz clock be fast enough? I'm using my only arduino as the ISP so I don't think I've got any way to do the clock, except on the DSO I'm waiting on...Great website! now to make sure I select the right thing and that I can get these chips working againDon't worry, It's pretty much me trying different ways to get this to work, and failing

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 01:04:45 pm
content: There is documentation for the Arduino ISP firmwarehere.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 19, 2012, 01:57:29 pm
content: Wow! Did you seethis bug?QuoteThat's a big problem. Basically the programmer brings the MCU out of reset for 50 ms and during that time has the SCK pin set as an output and drives it low. If the firmware on the chip being programmed happens to use that pin as an output and drives it high it can damage the chips.You might check to see if your Arduino can still make use of that pin. It might be fried. I would also put current-limiting resistors on all those pins from now on until you get a real programmer. I looked through the programmer firmware and it's pretty much a big hack.

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 19, 2012, 06:00:56 pm
content: I guess you also could use your PC soundcard plus some waveform generation software as a clock source.I'm tempted to make a video on fixing AVRs with wrong clock fusebit settings using different kinds of clock sources and an Arduino / USBtinyISP.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 20, 2012, 02:55:37 am
content: TerminalJack505,I've just extended to the blink program to switch all of the digital pins on, and all of them go HIGH and LOW, so no problems there.Yea I was hoping to use it without having to get a programmer, but I've bought a cheap Chinese one so hopefully I get some luck then!LEECH666,I was thinking of doing something like that. I know i would wire up the com of the audio jack to ground, but the pos pin, should I wire that to XTAL1 or XTAL2 on the ATmega8?Go for it! Be great to watch, and hopefully I can learn from it

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 20, 2012, 06:40:39 am
content: But you would be faced with my horrible German accent.Might try to shoot a video later.I think it was XTAL1 which needs to be used.Cheers,Florian

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 20, 2012, 06:44:06 am
content: Quote from: LEECH666 on July 20, 2012, 06:40:39 amDon't mind German(One of my lecturers has a strong Russian accent which at times is quite funny when he says things).I'll have to give it a go. Thanks!

author: amyk
author_rank: Super Contributor
timestamp: July 20, 2012, 09:56:36 am
content: Quote from: LEECH666 on July 19, 2012, 06:00:56 pmThat might not produce enough voltage. According to the datasheet for the ATmega8 it has to be at least 0.8Vcc which is 4V for a 5V supply and 2.64V for 3.3V. Line level output is usually 2Vpp. (It can go below 0 to -1V, which is definitely not good for the AVR at all, but this could probably be avoided in software.) Careful use of an amplifier might work.I'd go the HVPP route if I were you. Not as much equipment needed to setup if all you want to do is erase the chip and/or reset the fuses. Then again, some of us on here probablydolike playing with all that extra stuff

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 20, 2012, 10:00:00 am
content: Quote from: amyk on July 20, 2012, 09:56:36 amIf I used the sound card, I would interface it with a transistor pair and source through a sensible voltage to the clock pin.I'm not sure how to do the HVPP, is there a good tutorial I could follow?

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 20, 2012, 10:21:07 am
content: Since you already have an Arduino you might want to check out this Arduino shield.http://mightyohm.com/blog/products/hv-rescue-shield-2-x/You could probably slap smth together on a breadboard or perfboard that will work. I think you will need to have either access to a 12V source or use a step up converter to create the 12V from the 5V USB supply of your PC (like the shield does).There is an older version of that shield that uses a transistor based step up converter instead of a single IC in a SOT23-6 package.Let me try to find it ...Cheers,Florian.//EDITFound the old transistor based version here:http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/Probably just another hack job really. Might be okay for the occasional hobbyist fix tho.PS: amyk - Your points are valid. I didn't think about that at all.Thanks for bringing it up.//EDIT 2Well DERP! Apparently it's not a step up converter at all. Upon rereading the article I just noticed that you still have to apply 12V externally.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 20, 2012, 11:24:41 am
content: Cool! Thanks! No probs wiring up an external source.Bummer! I'll have to pick up some more 1k resistors at work tomorrow. And hopefully I can use a 2n3904 instead of the 2n3903.Readinghttp://denki.world3.net/avr_rescue.html I will make sure I connect everything up, and I'll probably make a shield.

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 20, 2012, 11:36:24 am
content: I think that transistor is just there to switch on/off the 12V volts, so probably any small signal jelly bean NPN transistor will do. The 2N3904 seems to belong to the same family of transistor as the 2N3903, so it should be fine.Those 1K resistors are most likely there for protection (current limit) of the connected device and the Arduino. In the later versions of the HV shield those resistors are omitted. I think he even said so in his blog. Can't be bothered to look where he wrote that tho.In general I'd say you can omit them too or replace them with a similar value (470R to 3K or smth like that). It probably doesn't really matter.Also take note that this is not a fully fledged programmer, it's just there to fix bad fuses. It doesn't seem to support writing to the flash memory, just the lfuse, hfuse and efuse area. I don't know if efuse memory area is included in the older version of the shield.Cheers, Florian

author: LEECH666
author_rank: Frequent Contributor
timestamp: July 20, 2012, 12:26:30 pm
content: I really really like this programmer because it can programm a lot of AVRs and a lot of PICs too. I plan to build it some day. But so far I haven't found the time to do so, as I plan to do my own PCB of this programmer.http://home.arcor.de/bernhard.michelis/index.htmlCheers,Florian

author: bsiswoyo
author_rank: Newbie
timestamp: July 23, 2012, 04:16:38 pm
content: Dear,I have had success using the ATmega 8 as the Handmade Arduino. However, the program can succesfully be uploaded using ISP with the Arduino IDE ver. 0.22.Also if you make the ATmega 328 Arduino is uploaded using a USB-Serial-to-TTL in the Arduino 1.0.1 environment. You must modify the boards.txt file with nano328.upload.protocol=stk500.The completely informations visit:http://bsiswoyo.lecture.ub.ac.id/2012/07/arduino-1-0-1-serial-upload-using-with-handmade-board-of-atmega328/best regardbambang siswoyo

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 28, 2012, 11:48:02 am
content: Great success!The 16MHz crystals arrived, and now I can read the signature no problem. I can't reprogram the chip once I've programmed it. However, if I use avrdude to erase the chip I can reprogram the device.Program using arduino --> Erase using avrdude --> reprogram using arduino. No problems!My DSO also arrived so checking a 500Hz output pulse is spot on, and a 100KHz shows 100.038KHz on the ds1052e counter.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 28, 2012, 06:17:30 pm
content: It sounds like something is wrong with the fuse settings still since you have to erase before programming.I just looked at the fuse settings again from your earlier post and notice something interesting.Here's the fuse settings you seem to be using...QuoteThe CKSEL[3..0] bits are set to 0100, which selects the internal 8 MHz oscillator. However, the CKOPT fuse is programmed (set to 0.)The datasheet (page 30) has this to say about that particular combination...QuoteTake special note of that last sentence.I wonder if that's causing the problem?

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 28, 2012, 11:38:14 pm
content: Before the previous post, I wrote new fuse settings using avrdude which worked, and I had modified my boards.txt file to include the new fuse settingsCode:atmega8u.name=ATmega8 - External 16MHz crystalatmega8u.upload.protocol=arduinoatmega8u.upload.maximum_size=7168atmega8u.upload.speed=19200atmega8u.bootloader.low_fuses=0xFFatmega8u.bootloader.high_fuses=0xC9atmega8u.bootloader.path=atmega8_noxtalatmega8u.bootloader.file=ATmegaBOOT.hexatmega8u.bootloader.unlock_bits=0x3Fatmega8u.bootloader.lock_bits=0x0Fatmega8u.build.mcu=atmega8atmega8u.build.f_cpu=16000000Latmega8u.build.core=arduinoatmega8u.build.variant=standardI was using the website to 'calculate' the fuse settings, plus I was reading up on threads where atmega8's fuse settings were the topic.I don't mind having to erase the chip, as once I get my pcb made, the chip will be placed in and left in. I'm making a volt meter for a linear psu I've built.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 29, 2012, 12:06:27 am
content: Yep, I hear you. I'm sure you're happy to have it working again and glad you didn't completely brick the MCU.

author: GabYoung92
author_rank: Regular Contributor
timestamp: July 29, 2012, 12:15:51 am
content: Quote from: TerminalJack505 on July 29, 2012, 12:06:27 amYup, this shows me how arduino has simplified microcontrollers. Thanks for all of your help.