AVR Programming Woes

Electronics Computer Programming Q&A
Post Reply
User avatar
jaem
Posts: 148
Joined: Thu Feb 15, 2007 3:36 pm
Location: BC, Canada
Contact:

AVR Programming Woes

Post by jaem »

So... I have a Solarbotics Sumovore robot that I got from a friend (who got it from his friend, who got it from his electronics class), along with an Olimex #AVR-PG2 ISP programmer (also used by the friend of a friend). After fighting with it for a couple hours on Christmas Day (this past one), I discovered that I needed to hold down the Reset button on the robot for the programming to work (although it was still a bit patchy). Fair enough, I thought, it's not documented, but I guess it was just a mistake; that's easy enough to do. Then, more recently, I try to use it with a breadboarded circuit I made - and what do you know? - it doesn't work. As it was 2AM at that point, my feeble attempts at replicating the Reset part of the circuit from the robot didn't go so well, especially since I was using a different model of AVR. (mapping pinouts between models from 3 different diagrams late at night is always fun...) I tried again a few days later (also late at night)... still no luck. Then things got busy, and I put it down for a while. That brings me to tonight. This time, I was trying to use the sumobot again, with my new install of Mandriva Linux. I had just finished building the toolchain, the downloader, and the IDE from source, since I couldn't easily find a Mandriva binary for the tools. This time, I ran into even more problems, and it never ended up working properly, nor even working two times in a row. I had previously been informed on a local mailing list that having to hold down the Reset button meant there was probably something wrong with my programming cable. So I take apart the cable, and peer at it for at least 45 minutes with one of those jewelers eyepieces that I can't currently remember the name of (if you don't have one, you should get one... quite useful). Finally it hits me (and this will be a real shocker to all of you, I'm sure) -- are you ready for it? -- Get this: ICs need POWER! Who would have thought? To elaborate, the issue was that the programmer (which is of the often-cloned buffered parallel port type) expected to be powered from the target board, and the target board expected the programmer to be powered from the PC... thus, there was no VCC line going from the robot to the programmer. Looking in the robot's manual again, I can see why - they recommend an unbuffered cable (read: a few wires), which of course doesn't NEED power. Gah!

This did teach me two lessons:
1) don't assume that two things work together, just because someone hands you them and tells you they do
2) RTM

Anyhow, I'm still rather confused - nay, completely befuddled. For starters, how the HECK is this thing working even *some* of the time, with no VCC? I talked to a friend, and the only thing we can come up with is that the buffer (a 74XX244 - (HC, IIRC)) must be leaching power from something else -- but the only other connections are GND, SPI data and clock, and Reset. If this is indeed how it is doing it (or even if it's something else), then the fact that you can get this to work at all has to be *the* *worst* hack I have *ever* heard of!
My second point of confusion is -- what the *heck* was my friend's friend's instructor thinking, taking advantage of such a hack instead of doing it properly??! They purposely heat-shrunk an adapter cable onto it so it would fit the robot's header, so they must have known it wasn't meant for this kit. Oh my... *Shakes Head*

Sorry for the rant... If anyone can shed light on my question (the second-to-last, not the last :P), I'd appreciate it. You can find the approximate schematic of the programmer either by Googling "stk200" on Image Search, or looking up the AVR-PG2 on Olimex's site. Note however, that none of the schematics, official or otherwise, actually match my hardware completely, so have fun...

Thanks,

Jeff
Sambuchi
Posts: 366
Joined: Tue Jan 18, 2005 1:01 am
Location: Orlando FL
Contact:

Post by Sambuchi »

Not sure of your entire setup but I use an ATMEL part ATMEGA8L.

with the mkII
Image

correct, the do not provide pwr to the board when programming. Thats sometimes due to the load that the user may have. In my programmer I added a 3.3V jumper to the Vcc pin and was able to program ATMEL chips without powering up my boards :D
_________________
Tony

You can look at my projects here www.sambuchi.net
User avatar
jaem
Posts: 148
Joined: Thu Feb 15, 2007 3:36 pm
Location: BC, Canada
Contact:

Post by jaem »

Thanks, but the issue was actually the power needed by the programmer's internal buffer IC. The *programmer* was actually supposed to *get* power from the board - not the other way around. Since the board wasn't designed for this programmer, it had no connection to do so. As I was given them together, and told that they had been used by someone else previously, I just assumed there wouldn't be any problems (at least, not of that sort). A guy on my mailing list confirms that the programmer has been operating (or not) on leakage current for the whole 3 months I've been using it. Not a good setup at all...

Please note that the OP was written shortly after I had discovered this issue which had been plaguing me for so long - hence it is somewhat of a rant... my apologies. :P
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests