Sunday, July 27, 2014

My take on an AVR ISP programmer

I've been using the SparkFun Pocket AVR for all of the time I've been doing it.

It does well enough for what I need, but it does have a couple of deficiencies that I'd address, if I had my druthers.

Firstly, it comes with a Mini USB plug. It's the only thing in our house that has one of those. Everything else is either full size or micro-B. I'd much prefer either over the now oddball mini B connector.

Secondly, though it comes with a switch to select whether or not to apply target power, there is a leak through the buffer control pull-up resistor that applies power even when target power is disabled. Others on the SparkFun comments for the product have noted this, pointing out that it's not safe to use with 3.3 volt devices. Even if it were, your choice is to either power the target at 5 volts or not power it at all.

Adafruit was the source of the original design. They sell a USB Tiny AVR kit. It didn't have the problem of leaking USB power to the target despite target power being disabled because it simply lacked the pull-up resistor. But that means that if you leave the USB end disconnected that the buffer pin will float, potentially taking the buffer chip out of its high-impedance state when you're not actually programming. Also, like SparkFun's programmer, there's no choice other than 5 volt target power or nothing.

So I sat down to make the best-of-breed USB Tiny ISP. My design is all surface mount, so it's quite small. It has a 6 pin ISP socket rather than a 10 pin, because 6 pin is all I use, and if you must, you can always make a wiring shim to turn 6 into 10. Like the original design, there is a 74HC125 bus buffer chip, and when target power is turned off, it is itself powered from the VCC pin of the ISP plug, so it is guaranteed to feed target-power based logic levels at all times. My addition to the design is a 3.3 volt LDO and a 3 pin .1" header that can be used with a jumper to select whether to provide the target with 3.3 volts, 5 volts or no power at all. I also kept the SparkFun addition of a PTC on the USB power input to protect the host PC. In the SparkFun version, they added a pull-up resistor on the BUFFEN line to insure that when the programmer wasn't actually programming the target that the buffers would be tri-stated. The problem with their design is that nothing prevents 5 volt power from being applied to the target through the pull-up from the CTL line when it is high. A simple 1N4148 diode fixes that problem.

In fact, the SOT-23-5 layout for the LDO can, in principle, take a 1.8 volt LDO as well, should you be designing for that voltage instead of 3.3. Turns out that the problem with a 1.8 volt programmer is that the ATTiny still running at 5 volts has a logic-high threshold of over 2 volts. A 1.8 volt programmer would need similar diode-and-pullup treatment on the "near" side of the bus buffer chip, and I'm not going to bother with that. You could power the ATTiny at 3.3 volts. You'd then have to move the zener-and-protection-resistor trickery from the USB bus pins over to MISO. I might consider looking into that as a next step in the design if 1.8 volt programming is a real demand.



JP1 is the self-programming interface. Since the 2313 is SMD, there's no (good) opportunity to program it out-of-circuit, so there needs to be an ISP for it, and since the buffer chip isn't bi-directional, the target ISP socket can't be used. Since I have a pogo pin ISP adapter I got from SparkFun, I can program the 2313 with that and to save space, bury it on the bottom of the board under the 2313.

No comments:

Post a Comment