1
\$\begingroup\$

short question:

  • I have ATMega8A at 3.3V
  • I have USBasp programmer at 5V (from USB port)
  • Can I program this AVR with this programmer directly?

Well, ATMega can stand 5V but it's powered with 3.3V so I don't know whether it will survive.

I don't want any level shifters: I don't have one and don't have space for that and it should be simple.

If I cannot connect that directly, then can I use a voltage divider (2 resistors) to divide 5V to 3.3? There's no need to do it from 3.3 to 5V because 3.3 is already high level for 5V...

\$\endgroup\$
2
  • 1
    \$\begingroup\$ What do you mean by 'ATMega8A at 3.3V'? Do you want to program it in circuit? ATMega8 can operate at 5V and you can power it from usbasp directly. \$\endgroup\$
    – v.m.
    Commented May 9, 2015 at 10:28
  • \$\begingroup\$ If you do not have much in the way of captive loading, you may be able to sufficiently protect the lower voltage part using series resistors, while still letting the programming work (the ATmega series if that is what is in your programmer has a fairly low ViH at 5v). However, if you do have loading from any circuit functionality connected to the ISP pins, this may not program reliably. \$\endgroup\$ Commented May 9, 2015 at 17:19

4 Answers 4

2
\$\begingroup\$

If you have an USBasp like this one below: enter image description here

You can select the supply voltage with the jumper in the red rectangle. 5V and 3.3V are available this way, as the label says.

\$\endgroup\$
5
  • \$\begingroup\$ I know that, but I have access to only some poor versions witout that jumper... \$\endgroup\$
    – zupazt3
    Commented May 9, 2015 at 10:58
  • \$\begingroup\$ I understand, in that case refer to @justinrjy's answer. Atmega8A, bottom of the first page, Operating Voltages: 2.7 - 5.5V. Your uC can handle the 5V, only problem if you have some other device on the same power supply, which cannot. \$\endgroup\$ Commented May 9, 2015 at 11:04
  • \$\begingroup\$ Yes, on the same PCB, I have ARM uC that can operate up to 3.6V. But if I only program ATMega8 with 5V SCK and MOSI that shouldn't hurt ARM? \$\endgroup\$
    – zupazt3
    Commented May 9, 2015 at 11:24
  • \$\begingroup\$ Do not think so unless these lines are connected to the ARM as well. \$\endgroup\$ Commented May 9, 2015 at 11:26
  • \$\begingroup\$ I suppose, the ARM and the ATmega share a common power supply. \$\endgroup\$ Commented May 9, 2015 at 11:31
1
\$\begingroup\$

If the ATMega8A can operate at 5V (which it can, as its operating range is 2.7-5.5V), then you can program it (and run it) at whatever voltage your programmer is and it will run, as long as it is within 2.7-5.5V.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ But ATMega8 has to operate at 3.3V and I can't change that. Programer has 5V supply and I can't change that either. My question is can I programm it ATMega8 running at 3.3V with 5V programmer. \$\endgroup\$
    – zupazt3
    Commented May 9, 2015 at 10:46
  • \$\begingroup\$ Short answer is yes. Your programmer will run at 5V, and will upload your code to the chip, but that code will run regardless of whether your input voltage is 3.3V or 5V. As longa s it's between 2.7 and 5.5V, your code will run. \$\endgroup\$
    – justinrjy
    Commented May 9, 2015 at 10:48
  • \$\begingroup\$ That seems ok. I just wonder, because programmer with give SCK and MOSI signals at 5V while ATMega supply will be at 3.3V, so I didn't know how atmega will behave. \$\endgroup\$
    – zupazt3
    Commented May 9, 2015 at 10:57
  • \$\begingroup\$ @user3144058 - that will probably be out of spec. \$\endgroup\$ Commented May 9, 2015 at 17:16
1
\$\begingroup\$

If I have understood all the information through the comments, you have a design with AVR and ARM at 3.3 V powered from one supply and you want to know if you can let the programmer burn 5 V into the AVR's programming interface.

I wouldn't do that, since the AVR has ESD protection networks on the pins, which would clip the excessive voltage to the Vcc rail. It depends on the voltage regulator used for powering the chips what will happen. If it is a parallel regulator, it won't allow the supply rail to rise and the programmer probably won't like this too much (it is a short for its outputs). If it is a series regulator, the voltage will rise any you are likely to damage the ARM. The ESD diodes are quite robust (checked that for myself several times :D).

The divider on the outputs will be probably fine - don't make it too weak, you need to charge input capacitance of the MCU, the frequency will be probably quite high on the SCK line. Level conversion IC would be even better, but surely is a pain in the ass. If your programmer has an option to select voltage levels (BattleHamster's post), switch it to 3.3 V.

\$\endgroup\$
0
\$\begingroup\$

If you look at the data sheet for the ATmega328, for example, you will see that the maximum voltage that can be applied to a data pin will be Vcc + 0.5V if I remember correctly. I have myself zapped AVR chips with overvoltage programming so beware.

The AVRasp programmer shown on this page has a 5V/3.3V link but that only affects the target Vcc voltage, not the signal voltage which remains at TTL levels. The AVRISP MKII on the other hand does switch both the Vcc and signal levels.

Do not rely only on supposed overvoltage protection and always use the correct signal voltage levels for the AVR and other devices in the system.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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