I/O operating voltages between two ATMEGAs

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I have a system that includes two ATMEGAs, one is run at 3.3V because it interfaces with the SD card.  The other is run at 5V at max clock of 20Mhz. The 5V one has some of its GPIO lines (as output) connected to the 3.3V one's GPIO lines as input.  The 3.3V should be OK with 5V input, that is, no need to level shifting or anything? I think so, but I just wanted to make sure there is no bad side effect or anything.

 

Thanks for your thoughts!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 3.3V should be OK with 5V input, that is, no need to level shifting or anything?

Why should it be ok? (It is not) A read of the data sheet would be a good investment of your time 8). You will need something for level shifting, depending on what speed these signals are for it may be very simple or not 8)

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano wrote:
The 3.3V should be OK with 5V input, that is, no need to level shifting or anything? Why should it be ok? (It is not) A read of the data sheet would be a good investment of your time 8). You will need something for level shifting, depending on what speed these signals are for it may be very simple or not 8)

 

The uC that runs at 3.3V is 5V tolerant. And it basically has some pins setup as input at 5V max.  Why do I need a level shifting to 3.3V?  You said "it's not" OK, but not stating the reason(s).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the chip is truly 5v tolerant then no problem.  You said two "atmegas", I'm just not familiar with any that are 5v tolerant, something new perhaps?

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The AVR IO pins are not "tolerant".
This is the equivalent circuit of the input.

 

If this circuit is operating at 3.3V and 5V is input to PIN, you will find that the upper diode will cause problems.
Although inserting resistors can limit the inflow current and suppress the occurrence of problems, it is not recommended.

Conversely, when connecting from a 3.3V chip to a 5V chip, the guaranteed value of the output voltage on the 3.3V side is about 2.6V, and the guaranteed value of the voltage that the 5V side recognizes as H level is 3V(0.6 x VCC).

 

You are free to forgive this dangerous situation as your personal hobby. Even if it malfunctions, it will not bother others.

Never leave that circuit away from your hands.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Feeding a strong 5V sig directly into an AVR running at 3.3V, will very likely damage it, unless you include some series resistance....then it might tolerate it.  The excess voltage will then be clamped to 3.3V by the internal parasitic diodes & voltage dropped across your resistor.  Zero ohms would lead to those diodes being blown.   Or, in some cases, cause the entire avr to try & power up to 5v via the pin (very bad), depending on whether the 3.3Vsupply prevents it.    A two resistor divider is the simple solution  (though may be "sluggish" due to high impedance/capacitive effects if you need ns response times).

 

Feeding 3.V signals into an avr running at 5V, is "ok"...it may give poor noise margin performance, or cause a larger current to be drawn (digital inputs do not appreciate mid-level voltages)...or it can be fed into the comparator or ADC.

 

For the highest speed signals response, a logic translator is your best bet. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Jun 13, 2019 - 12:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about a 3V or 3.3V zener in place of the bottom

resistor of the divider?

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think it is the 74lvc series of chips that are 5V tolerant input. These are available in a number of packages - even small single gate ones. TI have a range of level translator devices as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about a 3V or 3.3V zener in place of the bottom resistor of the divider?

Sounds ok, though the inexact knee might make the final voltage sloppy.   A zener advantage is you could use a lower R value (fast) without much power penalty 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There used to be a sticky thread at the top of the Electronics forum about 3.3/5 interfacing.

EDIT: yup, this one:  https://www.avrfreaks.net/forum/electronics-interfacing-101-aka-tips-tricks

Last Edited: Thu. Jun 13, 2019 - 08:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, all.  A 74LVC245 should help.  " Inputs can be driven from either 3.3 V or 5 V devices. When disabled, up to 5.5 V can be applied to the outputs. These features allow the use of these devices in mixed 3.3 V and 5 V applications."  Place the 74LVC245 between the two ATMEGAs where the I/O takes place.

 

Cheaper alternative is the HEF4050. It has only 6 pins of IO.  I can have both ATMEGAs run at 5V and place this IC between the one ATMEGA and the SD card.