1. 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.
    Dismiss Notice

AVR NooB

Discussion in 'AVR' started by AtomSoft, Feb 17, 2010.

  1. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    OMG YES!!! Thanks a TON!
    [​IMG]
     

    Attached Files:

  2. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    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: Apr 3, 2010
  3. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US

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

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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: Apr 3, 2010
  7. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Wait, you actually lost communication with the Dragon board itself?
     
  8. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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
     
  9. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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
  10. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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: Apr 3, 2010
  11. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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:
    http://www.youtube.com/watch?v=JEGAoN9fAtM
     
    Last edited: Apr 3, 2010
  12. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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
  13. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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.
     
  14. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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?
     
  15. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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
     
  16. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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 =)
     
  17. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Yeah... now to figure out which Clock source i set up :(
     
  18. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Jason,

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

    Which AVR chips are you ordering?

    Mike
     
  19. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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
  20. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    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?
     
  21. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    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

Share This Page