Category Archives: Tools

AVR Dragon

I have been using an AVRISP mkII for programming my AVR microcontrollers since I started playing with them a year or so ago. I really like the AVRISP because it’s inexpensive, it works well and it’s small enough to carry around. I recently made a mistake on a little test chip that I was using and programmed the RSTDISBL fuse because I wanted to use the reset pin as a port. Well that made it impossible for my AVRISP to reprogram the chip. It seemed obvious after I did it. You see the chip needs to be held in reset for the in circuit serial programming to work. Since I disabled the reset pin it couldn’t do this anymore. Well I decided to bite the bullet and buy an AVR Dragon, since I kinda wanted one for its debugging capabilities anyway. Now I had an excuse, I needed the high voltage programming to fix my screw up.

This little programmer/debugger is pretty cool. It has the ability to program all the modes of most (if not all) of the AVR line of microcontrollers. It also talks to AVR Studio and can be used as an in circuit emulator. Actually it’s a little bit better than an emulator because it doesn’t emulate, it actually executes the code on the target microcontroller. It uses either the JTAG or DebugWire interface on the microcontroller to control the chip. It can do this on the prototype area on the Dragon board or in the target circuit.

I had a little bit of trouble with mine at first. I use a Mac and have Windows running in VMWare Fusion. This has usually worked really well for me but for some reason I was unable to update the firmware in the AVR Dragon. I had an old laptop at work with XP installed on it, so I put AVR Studio on that machine and used it to update the firmware. It works fine. I hope that Atmel gets that figured out before too long. Surely I’m not the only one having that problem. Once the firmware is updated, it works fine from VMWare but there was something about the firmware update.

The documentation for the Dragon is pretty good in some areas and not so good in others. It’s great for wiring but it took a little digging and Googling for me to figure out that the Dragon doesn’t really do any emulation. It simply uses the debugging interfaces on the target chip. This is actually a better deal than emulation since it runs on the actual hardware but it means that you do have to have the target chip to plug into the Dragon.

The software interface to AVR Studio is simple and easy. You just select AVR Dragon as the programming interface if you want to use it for programming. You can also select it as the debugging device instead of the simulator and use the emulation capabilities. The programming interface is pretty intuitive but it can be a little tedious. The Dragon doesn’t actually connect the debug/programming interface to the prototype area on the board. The High Voltage programming port, the ISP port and the JTAG port are all put on dual row headers (one you have to install yourself) and then there is another 40 pin header that corresponds to the pins on the microcontroller socket (that you also have to install yourself). I found that it was very helpful to have some little jumper wires with female header connectors on them so that it’ll be easy to wire up from one AVR to another.

AVR Studio has all the documentation for wiring in the AVR Tools Help menu. The wiring for each of the AVR line is laid our really well and in color which makes it quite easy to hook up.

I also found it helpful to install a 40 pin ZIF socket on the prototype area. This lets me put any AVR that the Dragon supports (well any that are PDIPs) in this socket very easily. Here is a picture of my Dragon with the jumper wires set up to do high voltage programming on an ATtiny84.

Oh the story on my little ATtiny that I disabled reset on ends well. I put it in the Dragon, unprogrammed the fuse, put it back in my target circuit and it works just fine. It’s short one I/O pin (that I didn’t really need anyway) but I can program it with my AVRISP mkII again.

ATX Power Supply Conversion

Commercial lab power supplies can be pretty expensive. For most of what I do in my little lab I don’t really need that level of sophistication. ATX computer power supplies are cheap and plentiful. I had an old one laying around and I decided to turn it into something that I could use in the lab.

In the old days of the AT power supplies it was easy to turn them on and take power from them. I used a few of these for powering prototypes years ago but the ATX power supplies are a little more complicated and I never got around to figuring out a way to turn them into something useful.

One of the extra features of the ATX power supplies over the old AT versions is that the ATX power supply can be turned on and off by the computer itself instead of a big giant switch that turns the AC power to the supply on and off. This is done by simply grounding one of the wires in the main connector. It’s the green wire. The ATX supplies have a pretty high current capacity for 3.3V 5V and 12V outputs. There are also -5V and -12V outputs, but these aren’t capable of delivering the same current.

The one that I modified had the following specs…

Total Power Output 230 Watts
5V 18 Amps
3.3V 10 Amps
12V 7 Amps
-12V 0.8 Amps

It also has a +5V standby of 2A that is on all the time whether the supply is powered up or not. I had no use for this one so I clipped it off.

I took the power supply apart to figure out where to put the binding posts and the power indicator LED. It made sense to use the same side where the wires come out of the circuit board. The problem with this for me was that this side of the box is on the part of the enclosure that comes off from the rest of it. It worked okay but the soldering was tricky. Other supplies will have different geometry and may be easier. This one is physically very small so I struggled with it a bit.

Radio Shack didn’t have enough of the big binding posts that I wanted so I bought a couple of little ones. I figured that since the negative voltage outputs won’t supply much current that they could stand to be on the smaller ones. It would have also been nice to have a different colored one for each voltage but RS only supplies red and black so I went with those. I didn’t want to spend forever on this little project.

The color code for all the wires…

Green Power Supply On
White -5 V
Blue -12 V
Red 5 V
Orange 3.3 V
Yellow 12 V
Black Ground
Purple 5 V Standby (Not Used)
Gray LED Power Indication

After I laid out and drilled the holes for the binding posts I started cutting and soldering the wires. The first thing I did was solder the green ON wire to one of the black ground wires. You could wire this to a small switch if you want to but the way mine turned out I have pretty good access to the main switch that came on the power supply. If you want to use the standby 5V power then you’ll have to put a switch between the green wire and ground for powering the supply on and off. You could also build a fancy little circuit that could power the supply off after some time. The sky’s the limit with this.

I put a 220Ω resistor in series with a small LED (check the polarity) and connected it to one of the red 5V wires and one of the smaller black ground wires. This gives me a power on indication. After I finished I discovered that the gray wire is designed to be used for this purpose. Oh well, I’ll remember that next time. Using one of the red wires works just fine.

After that I started cutting and bundling the different colors of wires together. I tried to tie as many of each color to it’s respective binding post as I could but there was no way to get all of those black wires on one post. Since I had extra black binding posts I used a couple for the ground. I tend to have banana plugs hanging 6 inches off of my power supply grounds so this will give me more options anyway.

Once I got them all soldered together I put the power supply back together and turned it on. It just blinked and went back off. It didn’t take me long to figure out what I had missed. This particular supply has a couple of small sense wires coming off of the circuit board. One was orange and the other was black. I took the thing back apart and connected the orange one to the 3.3V post and the black one to ground. When I turned it on this time it stayed one. Success!

In my research I found that there are several different types of power supplies and some have a sense wire that has to be connected and some do not. On some of them it is a different color. It may take a little playing around with whatever power supply you have. There is plenty of information on the internet too.

There also seem to be some power supplies that won’t stay on if there is no load. In this case you will need to get a 10 or 20Ω – 10W resistor and put it between one of the red wires and ground. This will give the supply enough load to stay on. Mine worked without it.

The last thing, was to make some labels with my label maker.

These ATX computer power supplies are actually pretty good switched mode power supplies, and with a little hacking they are easy to convert to bench use. This whole project can be done for less than $15 if you have an old power supply laying around. If not they are easy to find.