0
\$\begingroup\$

I want to build the AVR High-Voltage programmer, it requires the RESET pin to source 12 volts while the rest of the AVR is powered by 5 volts. The ground for 12 volts and 5 volts is common.

I know how to switch a led/motor/whatever with a BJT like the 2N2222, but it does not connect in such a way that it can have the same ground as the 5 volts across Vbe.

How to switch 12 volts using the same GND as the 5 volts doing the Vbe switching?


Context - From page 167 (19.7.1) of the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/doc8006.pdf

Enter High-voltage Serial Programming Mode

  1. Set ... RESET pin and VCC to 0V.
  2. Apply 4.5 - 5.5V between VCC and GND. Ensure that VCC reaches at least 1.8V within the next 20 µs.
  3. Wait 20 - 60 µs, and apply 11.5 - 12.5V to RESET.
  4. ...
  5. Exit Programming mode by power the device down or by bringing RESET pin to 0V.
\$\endgroup\$
  • \$\begingroup\$ It's just a high-side switch driven by a low-side switch. Or, alternately, you can completely avoid a 12 V supply entirely and use software to generate the 12 V supply rail and periodically pump it up as it gets used during programming (that's what I did, years ago.) What are the specifications for the 12V RESET and do they tell you how much energy it takes per programmed byte? Do you already have the 12V supply rail? \$\endgroup\$ – jonk Apr 30 '18 at 21:22
  • \$\begingroup\$ I do have both the 5 volt and 12 volt supply lines, using generic LM78xx and a smoothing circuit. These share the same GND. \$\endgroup\$ – Evgeny Apr 30 '18 at 21:38
  • \$\begingroup\$ It's possible to do this with one NPN. But whether or not it works will depend on all of the electronic details of the RESET pin. Can you, for example, apply 12 V through a 10k resistor? Or a 1k resistor? Etc. It may, or may not, work depending on the intimate details. That is, if you are stuck on NPN. Another possibility is to supply a 12.5 V rail, not 12, and then allow the NPN as an emitter follower. The output might meet the 11.5V minimum then. TTL was all built on NPN, for example. There are lots of ways. Are you stuck on NPN for some reason? \$\endgroup\$ – jonk Apr 30 '18 at 22:05
  • \$\begingroup\$ BJTs like to follow voltage, but you can use an n-chan mosfet to switch higher voltages \$\endgroup\$ – dandavis Apr 30 '18 at 22:55
  • \$\begingroup\$ Not stuck with NPN, just wondering if something like this can be achieved without adding the extra variety (pnp, etc). In general, I'm having a hard time grokking how this kind of switching works - which is why I created this Q. \$\endgroup\$ – Evgeny Apr 30 '18 at 23:50
2
\$\begingroup\$

I wasn't able to find any separate "programming specification" document on the AVR, outside of the datasheets themselves. Looking as far back as the AT90S2313 (which I have a tube or two of, still), the RESET specification appears to just be used as an enable technique and no appreciable current is drawn from the pin. (This is different from some old Microchip PIC parts I used to work with, which lacked an internal charge pump for programming the devices.)

Since it appears, for these programming purposes anyway, that you do NOT need to supply \$5\:\text{V}\$ to the RESET pin, but only \$0\:\text{V}\$ and \$12\:\text{V}\$, you could get by with something perhaps this simple:

schematic

simulate this circuit – Schematic created using CircuitLab

When the I/O pin is HI, RESET will be close to \$0\:\text{V}\$. When the I/O pin is LO, RESET will be close to \$12\:\text{V}\$.

There doesn't appear to be any need for significant current so this circuit probably will work okay.

However, I do have a warning to include. You may want this circuit to come up with RESET grounded (\$Q_1\$ actively pulling down) if the I/O pin isn't connected or when the controlling MCU is still coming out of reset itself and its I/O pin is in a high impedance state prior to being ready to program a device. If I added a resistor to ground near the base of \$Q_1\$, this would have the opposite effect (probably not desired.) So this may be a problem that requires some added changes.

So, perhaps a little safer would be:

schematic

simulate this circuit

In this case, without any I/O active the BJT will be turned on, pulling down on RESET. And, if the I/O pin is an active output then you have normal control here.

\$\endgroup\$
1
\$\begingroup\$

Try something like this. You may need other circuitry for overvoltage isolation? Resistors are typical values for this type of switching.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Is it important for Q2 to be a PNP, or could this also be done using NPN somehow? \$\endgroup\$ – Evgeny Apr 30 '18 at 21:42
  • 1
    \$\begingroup\$ @Evgeny Yes, it's important that Q2 is a PNP. If you don't have any PNP transistors, you should get some. \$\endgroup\$ – immibis Apr 30 '18 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.