Author Topic: Programming atMega168 with AVRISP MKII  (Read 32016 times)

0 Members and 1 Guest are viewing this topic.

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Programming atMega168 with AVRISP MKII
« on: January 24, 2008, 08:52:50 PM »
I have practically gone insane from the AVRISP MKII controller by now, so I resort to finally creating an account and asking all you awesome people here for help.  :)  I have read all the documentation on both the programmer and controller (well, almost all), and as far as I can see, everything is connected the way it is supposed to.

Anyways, the problem is that when I have powered the board and plugged in the programmer, all I get is an incessant orange flashing, and an error saying either I have the ISP pins in incorrectly, or the pull-up resistor on the reset pin is too strong (stronger than 4.7k ohms). I have played around with a number of things but nothing as worked. Also note that below the voltage regulator the breadboard is slightly melted (connected ground and power in reverse  :'(), nothing seems to have been harmed though, as replacing the components doesn't help.

Thank you, brave soul for helping the meager underling that is myself!

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #1 on: January 24, 2008, 09:18:04 PM »
In the pictures, you don't have a pullup resistor on the reset line.

Other than that, you seem to have it wired correctly...

- Jon

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #2 on: January 24, 2008, 11:22:24 PM »
As in what? I'm not sure what that is, and the 50$ robot tutorial doesn't mention it either...

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #3 on: January 25, 2008, 07:45:10 AM »
You need to put a resistor (I typically use a 10K one) between pin 1 on the AVR (RESET) and your 5 volt bus.

- Jon

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #4 on: January 25, 2008, 09:40:04 AM »
Can you use a multimeter to check the voltages on your power pins?

Offline bukowski

  • Robot Overlord
  • ****
  • Posts: 219
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #5 on: January 25, 2008, 11:20:00 AM »
It has an internal pull up, dont worry about that (just dont leave your programmer plugged into it without power).



I think you have the orientation of the programmer pins wrong. You have pin one going to VCC, instead of MISO. Pin two you have going to MISO instead of VCC. etc. etc.

See if that works.
-Buk

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #6 on: January 25, 2008, 05:17:55 PM »
Well, my isp setup still looks right to me. Looking at the voltages, things seem a little weird. Without regulation the battery set reads 5.15V, and after it, 3.84V. As well, none of the components are warm either. Also I already tried some resistor from the power bus to the reset pin, though nothing seemed to happen...

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #7 on: January 25, 2008, 05:39:27 PM »
Quote
Without regulation the battery set reads 5.15V, and after it, 3.84V
yeap, I suspected this was your problem.

Your battery needs to be about 6V for the regulator to give a 5V output. Go recharge it! ;)

Always do this when debugging circuits:
http://www.societyofrobots.com/robot_faq.shtml#circuit_debug

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #8 on: January 25, 2008, 05:45:23 PM »
It is 4 1.2v cells, looking at the overall pic, how can I add another one without having to resort to alkaline cells?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #9 on: January 25, 2008, 05:47:25 PM »
yea thats only 4.8V . . . you need another cell in parallel. Either solder some wires to it (search the forum for instructions) or get a 2nd battery holder.

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #10 on: January 25, 2008, 06:12:08 PM »
I put the extra 1.2v cell in series, which is what I think you meant.

Unregulated: 6.35V, Regulated: 4.88V

It's the regulator in the 50$ robot tutorial, but the programmer still blinks orange...

:(

Offline bukowski

  • Robot Overlord
  • ****
  • Posts: 219
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #11 on: January 25, 2008, 06:38:06 PM »
Call me a retard, but i still think you have it wired wrong. Pin one is next to the red wire, on the inside, pins 2, 4, 6 are on the outside.
I still think you have pin one on the programmer going to Vcc, and the rest of them reversed also.

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #12 on: January 25, 2008, 06:48:28 PM »
Looking at my and your pics, both have pin 1 next to pin 3, which has an indent. As well, after switching it around, it couldn't even detect anything connected at all! (I switched the connection inside the programmer for convenience, =)).

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #13 on: January 25, 2008, 07:31:04 PM »
Quote
I put the extra 1.2v cell in series, which is what I think you meant.
oops, yea, in series. I was rushing with my reply so I could catch my bus . . .

anyway, Maltaeron, bukowski is right.

your pin 1 is connected to ground instead of miso, for example. a quick look at the bottom image that bukowski posted shows pin 1 . . .
http://www.societyofrobots.com/robotforum/index.php?topic=3013.msg22300#msg22300

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #14 on: January 25, 2008, 08:06:18 PM »
Ok, switched directly too now, although I am now getting an error saying, "target appears to have lost power" with a solid red light.

Still, the problem I have with switching the orientation is that I still think pin 3 should be the notched pin, not pin 4...

Thanks again, though :)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #15 on: January 25, 2008, 09:06:18 PM »
well i didn't check all your pins, but im pretty sure all of them are wrong and should be swapped . . .

hope you didnt fry anything ;)

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #16 on: January 25, 2008, 09:17:57 PM »
If you look at the closeup picture from the first post, its pretty clear he had the pins done correctly.

Pin 1 is on the same side of the 3x2 as the little outdent. The gray wire goes to that pin, and is going to MISO (as it should). Pin 2 is on the flat side, and the yellow wire goes to Vcc, as it should. Pin 5 is the red wire, and it goes to pin 1 on the ATmega168, which is the reset pin.

This is all correct.

If you're using a 7805 as your voltage regulator, you should be feeding it at least 7 volts - the voltage drop on those is pretty nasty. Get a 6 cell battery holder, or a 7.2 volt or 9.6 volt R/C battery pack, and use that.

- Jon

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #17 on: January 25, 2008, 09:33:40 PM »
Well, anyways this is how they are now, not working... lol

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #18 on: January 25, 2008, 10:01:04 PM »
Switched back header connections to the original, and added another cell to the battery, unregulated: 7.6V regulated: 4.9V
I wonder if 5V regulator really means that as input voltage approaches infinity, output approaches 5... lol

Orange blinking is back as well with the "The ISP connector appears to have been connected the wrong way, or the rest line may have an incorrect pull-up." error.

Thinking about my luck, I wouldn't be too surprised if it was just some weird mistake in the programmer... That would prove I have been cursed... Considering that I just had a short-circuit in my battery for a few seconds trying to add the 6th cell. :)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #19 on: January 25, 2008, 10:03:07 PM »
the wiring looks correct . . . I just realized the image that bukowski supplied shows the connector connected in reverse to how it is on your connector, resulting in my confusion . . .

hmmmm try connecting microcontroller pins 7 and 8 to power and ground respectively and see what happens . . . but I think they are already connected internally (im too lazy to check the datasheet)

there is the chance you damaged the programmer when you shorted stuff . . . I broke one of my programmers once by reversing power to it . . . back in my noob days :-\

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #20 on: January 25, 2008, 10:31:35 PM »
7 & 8 are connected, you just can't see that in the most recent pic, looking a little farther back to the top images, the connections are there.

Also, I don't think the programmer could have been damaged because the three times I shorted(or something similar) was when:

1) I connected ground and power in reverse, I think all the energy was contained to the regulator considering the breadboard melted on its three pins and nothing else got even warm.

3) I connected the microcontroller's power and ground in reverse.

2) Connected part of battery in a loop, with no external connections.

As well, because I bought extra, I have been able make sure neither the microcontroller or voltage regulator have been damaged, though for aesthetic reasons I switched the regulator.

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #21 on: January 26, 2008, 07:38:34 AM »
You still don't appear to have a pullup resistor on the RESET line. You have to have an external pullup on the RESET line in order to program the AVR.

Throw a 10K resistor between pin 1 on the AVR and Vcc and see if that helps.

- Jon

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Programming atMega168 with AVRISP MKII
« Reply #22 on: January 26, 2008, 09:10:48 AM »
Quote
You have to have an external pullup on the RESET line in order to program the AVR.
hmmmm not true, I've never programmed an AVR with a resistor on the reset line . . . perhaps its already built into the programmer?

I'm kinda stuck on solving this one . . . I'm thinkin just take the whole thing apart and start over again, perhaps there is something missed . . . I'd also check the breadboard with a multimeter to make sure it doesn't have any traces broken/missing inside . . .

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #23 on: January 26, 2008, 09:51:34 AM »
If your multimeter has a continuity check, use it and see that you have continuity between each of the wires sticking out of your programmer plug and the corresponding pin on the AVR (which essentially checks what Admin was saying, that your breadboard doesn't have any broken traces). Also check between your +5 bus and the Vcc pins, and your ground bus and the ground pins on the AVR.

Make sure your output voltage is 5 volts - if it isn't, use a battery with more cells.

Try the pullup resistor on RESET anyways - it can't hurt.

After that, you're down to trying another AVR chip (in case you fried that one), and if that doesn't work, trying a different programmer.

- Jon

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #24 on: January 26, 2008, 07:14:54 PM »
Huh, even with changing the controller and adding a pull-up, it still blinks incessantly. I even tried reprogramming the firmware, also to no avail. :(

Considering that the problem might be with the programmer (like hardware or something), is there any warranty on it? I bought it from digikey, but I don't know if that makes any difference. Also should I bother trying this with atmel's support (if any?), as well, what is the real difference between the AVR ISP programmer and the AVR ISP MKII? Might the former work better?

Thanks for all the support. :)

Offline bshir

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #25 on: January 26, 2008, 07:35:48 PM »
Hi all,
I'm also new to AVR's, though I've done a fair bit of ICSP with PIC's, and I'm seeing the exact same behavior as Maltaeron using an AVRISP mkII and an ATMega168.  I get nothing but an orange blinking light when I connect the AVRISP mkII to the target.

I've tried two different experimental setups, and two different brand-new AVRISP mkII's, with the same results.

1) I just put an ATMega168 + 7805 on a solderless breadboard, with pwr, ground, 3-wire-SPI, and a 1k-1M pullup on RESET'.
2) A brand new, verified working, Arduino Diecimila board.

I'm pretty sure I've got the polarity of the AVRISP mkII 6-pin IDC correct, but I get the same results in both setups regardless of which way I plug it in.

The computer is talking to the AVRISP mkII fine; in fact, it can correctly read the 5.0-5.2V rail of my target in both setups.  AVRStudio insisted on updating each programmer's firmware the first time I connected them.

Anyway, if I were just seeing this on setup #1 (my wiring), I'd assume it was my fault.  The fact that the Arduino, which explicitly advertises that you can reflash it with an AVRISP mkII, has the same behavior, makes me think there's some kind of bug with the programmer, unless there's a prep step I'm missing in both setups.

I don't have any other ATMega/Tiny chips to try this with, so I don't know if the programmers work on other targets.

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #26 on: January 26, 2008, 08:04:07 PM »
Wow, and I though I was the only one, :)

That it didn't work on the Arduino board really surprises me, makes me think that maybe this is a regression with the firmware. I will see if I can downgrade it...

Glad to know this isn't only some obscure problem of mine :)

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Programming atMega168 with AVRISP MKII
« Reply #27 on: January 26, 2008, 08:07:22 PM »
Well, here's a picture of my AVRISP MKII, plugged into one of my ATmega168 boards I just had printed.

As you can see, both green lights are on. I bought my programmer from Digikey as well.

This is what AVRStudio reports for my programmer:

Getting revisions.. HW: 0x01, FW Major: 0x01, FW Minor: 0x06 .. OK

- Jon

Offline MaltaeronTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 0
Re: Programming atMega168 with AVRISP MKII
« Reply #28 on: January 26, 2008, 11:53:56 PM »
What is the schematic for that? I looked for the board on Google as "bloloid" but couldn't find anything... Also, what revision of Avr Studio are you using?

Thanks

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming atMega168 with AVRISP MKII
« Reply #29 on: January 27, 2008, 12:01:20 AM »
What is the schematic for that? I looked for the board on Google as "bloloid" but couldn't find anything... Also, what revision of Avr Studio are you using?

Thanks

Search google for BIOLOID not bloloid   . You will get a ton of hits
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here