AVR NooB

Status
Not open for further replies.
Hi Jason (and guys),

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...

Kind regards, Mike
 
Last edited:
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.
 
Tried that:

Setting ISP frequency SD=0xa3 .. FAILED!

I get a similar error for all SETTINGS.... you think its a Windows 7 issue? or maybe its my 7 port USB Hub ?
 
Last edited:
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:
I am uploading a video to YouTube now on what i mean is happening ... i removed the HUB and plugged it straight to PC just in case but same issues... ill update this POST with video link when done....

[embed]http://www.youtube.com/v/JEGAoN9fAtM[/embed]
 
Last edited:

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..

Video from above:
https://www.youtube.com/watch?v=JEGAoN9fAtM
 
Last edited:
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:
By the way, I'll be in the active chat app for a little bit if you have any questions for me immediately. I can log the chat so anything covered there could be posted here.
 
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?

If so how the hell do i check the current FUSES?
 
If i cant FIX this AVR myself ill order a couple new ones heh and then try again but make sure i pick correct fuses heh
 
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 =)
 
Jason,

Did you come up with a clock source and were you able to program the device?

Which AVR chips are you ordering?

Mike
 
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:
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:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…