Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Just wanted to say congrats' for jumpin' in with both feet. It looks like you're off to a good start.

I'm just starting to teach myself AVR assembler and I was wondering if anyone has experience using an Arduino MEGA-ISP Shield and software or something similar to program their AVR chips? Apparently, after you load the MEGA-ISP firmware 'sketch' onto the Arduino it's recognized as an "avr isp" or as an "arduino programmer" by avrdude or avrdude-gui. I would love to be able to use the Arduino clone I purchased last year as an AVR programmer...

Thanks Im still stuck tho.. For some reason i just unticked the CKDIV8 fuse so it doesnt divide the CLOCK by 8 and now i cant seem to connect to it again... Why the hell does this have to be so confusing? lol

Drop the programming frequency to it's lowest possible setting. the ISP clock has to be a maximum of half the speed the chip runs at or it won't work. 1/4 is recommended I think. Verify your fuse and lockbits and remember that the logic for fuse bits can be a little flaky.. Fuses are inverted logic so a set fuse is actually a logic 0 for the feature it enables/disables, I'm not sure if the programmer dialog accounts for this or not so it could re-invert it for which can get a little confusing. The MCU's clock not running at what frequency you think it's running at is a great cause of problems like this.

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."

no just with the AVR itself i think.... it connects to dragon no issue i assume since when i press connect it gives me that dialog to change settings... When i disconnect the dragon it wont show that dialog at all

No, it seems to me to be a target issue, did you accidentally change the clock to an external clock that isn't running properly? If you have the ISP programing rate at it's lowest value and the target is wired properly it should program, unless it's not getting a proper clock from an external source.

Unplug everything and go from start to end verifying the way you have things setup are as you think they actually are.

Last edited: Apr 3, 2010

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."

No, it seems to me to be a target issue, did you accidentally change the clock to an external clock that isn't running properly? If you have the ISP programing rate at it's lowest value and the target is wired properly it should program, unless it's not getting a proper clock from an external source.

Unplug everything and go from start to end verifying the way you have things setup are as you think they actually are.

Click to expand...

I think i did program it to external clock instead of external crystal. How the hell do i revert or go back? Do i have to HV_PROG to get it back? Thats 20 wires tho heh..

No, programming is impossible till the chip can clock. Feed it the output of a 22khz square wave from a sound card output, that might be enough to clock it, if you can program any other chips you currently have to generate a simple clock it'll take that. The output voltage only needs to be enough to trigger the logic shift on the pin. External oscillator modes simply disable the internal chips amplifier stage and feed the input from the Xtal pin (I forget which one but only one is needed) to the clock module. The other xtal pin is only required for external crystals as it's the output from the tuned amplifier stage. This information is covered in details PDF's if you read them all letter for letter but that's the jist of it. If I can explain anything else lemmi know. As long as you can feed Xtal2 (Ithink) a clock it'll work, if xtal 2 doesn't work use 1, or just feed it to both of them, although I might recommend a moderate resistor value if you're using a sound card to avoid damaging the I/O line from a negative current too high. A 1-5k resistor should be plenty safe. Feeding from an external clock source you could probably go as high as 10-100k if the output was logic level.

Last edited: Apr 3, 2010

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."

can i use a PIC to make a simple clock ? Like a 10 MIP pic and then adjust it to send out a pulse at any rate from 32khz to 8 mhz and use that as my clock ? at least so i can erase the fuses and all and revert back to normal?

Yeah, if it's setup for external clock you can feed it any signal that will trigger the internal logic, so a pic will do just fine, a couple mhz should be plenty, of course they need to share a common ground but that should be obvious =)

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."

The clock he needs to feed the chip is totally and completely dependent on the clock frequency the Dragon's ISP is set up for, I don't know what the lowest you can set it for with the Dragon. From what I remember for reliability of the ISP feature should be 1/4 the MCU's main frequency to avoid problems. If you can set the ISP frequency to 3k, you can clock it with a sound card, or an LED blinker or whatever... doesn't matter much as long as it gets about a 12k clock. AVR's are fully static, if you can slow the ISP clock down to 1hz you can clock it by tapping a debounced switch as long as it's in sync =)

Last edited: Apr 5, 2010

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."

Mike:
I have the idea in my head on what to make ... a simple 18F2525 would be able to do it. I will just have it pulse out a clock... Ill use a LCD to show the CLOCK SPEED so i can adjust it also... Ill check for button presses via interrupt so i dont have to poll the buttons...

Sceadwian:
The issue i will have is finding my current clock.... Can i clock it at what ever i wanted setup ISP for 1/4 of that speed and i should be set? Is that what your saying?

You don't HAVE a current clock =) That's what the external oscillator setting is for, so that it can be fed a clock from outside, not a crystal, not a resonator, a logic level pulsed input. You feed it a high/low alternating voltage (read the PDF to determine what the logic levels are for the xtal1 pin is) I think xtal 2 is the output from the internal amplifier circuitry which may not used in external oscillator mode, but is definitely not required.

I just ran across this blurb via searching, that the Dragon can't set it's ISP value until it can sense the target, it can't sense the target till the target has a clock. So just feed it ANYTHING for a brief period of time to get it to run through a few cycles =) As long as you meet the voltage level requirements of the XTAL line you can feed it a clock from nearly any source like a piezo buzzer or whatever, anything that causes the voltage on that line to toggle a logic level change for the number of cycles required to program the fuses, which isn't much.

Again, I've heard of people using rectified sound card output just to jump start AVRs back into a local oscillator mode for real reprogramming. You're not the first person to have done this by far =)

Last edited: Apr 6, 2010

"Because I be what I be. I would tell you what you want to know if I
could mum, but I be a cat and no cat anywhere ever gave anyone a
straight answer, har har."