Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Mega324p port info

Mega324p port info

2008-04-29 by Bob Gardner

This is probably in the data sheet but I can't find it or maybe don't 
understand it.  I'm working on a project with two Mega324p processors.  
One is running at 5 volts and the other is running at 3.3 volts.  I am 
planning to communicate between them using the built in serial ports.  
Do I need to do something  between the two ports or I can I connect the 
serial ports diretly together?  I'll probably use a 1K resistor to 
protect the ports but am not sure if I have to reduce the output from 
the 5 volt processor to 3.3 volts.

Thanks for any suggestions.

Bob

Re: [AVR-Chat] Mega324p port info

2008-04-29 by James Wagner

On Apr 28, 2008, at 9:34 PM, Bob Gardner wrote:

> This is probably in the data sheet but I can't find it or maybe don't
> understand it. I'm working on a project with two Mega324p processors.
> One is running at 5 volts and the other is running at 3.3 volts. I am
> planning to communicate between them using the built in serial ports.
> Do I need to do something between the two ports or I can I connect the
> serial ports diretly together? I'll probably use a 1K resistor to
> protect the ports but am not sure if I have to reduce the output from
> the 5 volt processor to 3.3 volts.
>
> Thanks for any suggestions.
>
> Bob
>
>
> 
I;ve done this several ways. The best , over and over, has been to use  
a 74LCX125. It has an open-drain with 5V compliance (IN and OUT) even  
when powered from 3.3V. When the enable is tied LOW, it is a simple  
non-inverting buffer that needs an output pullup.

On the 5V output, just connect the pullup to +5V and, voila, you have  
a 3.3V in, 5V out, buffer. On the 3.3V output, connect that output  
pullup to 3.3V power and bring the 5V logic into its input.

Works great. Little pain. Almost guaranteed.

Jim Wagner
Oregon Research Electronics




[Non-text portions of this message have been removed]

Re: [AVR-Chat] Mega324p port info

2008-04-29 by John Samperi

At 03:11 PM 29/04/2008, you wrote:
>The best , over and over, has been to use a 74LCX125.

I would be tempted to use I2C level converters
something like a PCA9515 or other similar 8
pin repeaters. They have nothing much more than
a couple of fets per channel.

A P82B96 can buffer 2-15V busses.

I have used them for purposes other than I2C stuff.

Microchip may do cheaper versions of similar chips.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

Re: Mega324p port info

2008-04-29 by Bob Gardner

So, I'm assuming from the replies that, even though the 324P can 
operate at 2.7V to 5.5V, if I power it from 3.3V it can't tolerate 5V 
at an input?  Is that correct?

Thanks,

Bob


--- In AVR-Chat@yahoogroups.com, John Samperi <samperi@...> wrote:
Show quoted textHide quoted text
>
> At 03:11 PM 29/04/2008, you wrote:
> >The best , over and over, has been to use a 74LCX125.
> 
> I would be tempted to use I2C level converters
> something like a PCA9515 or other similar 8
> pin repeaters. They have nothing much more than
> a couple of fets per channel.
> 
> A P82B96 can buffer 2-15V busses.
> 
> I have used them for purposes other than I2C stuff.
> 
> Microchip may do cheaper versions of similar chips.
> 
> Regards
> 
> John Samperi
> 
> ********************************************************
> Ampertronics Pty. Ltd.
> 11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
> Tel. (02) 9674-6495       Fax (02) 9674-8745
> Email: john@...
> Website  http://www.ampertronics.com.au
> *Electronic Design * Custom Products * Contract Assembly
> ********************************************************
>

Re: [AVR-Chat] Re: Mega324p port info

2008-04-29 by wagnerj@proaxis.com

> So, I'm assuming from the replies that, even though the 324P can
> operate at 2.7V to 5.5V, if I power it from 3.3V it can't tolerate 5V
> at an input?  Is that correct?
>
> Thanks,
>
> Bob
>
Well, "can't tolerate 5V is correct". How you deal with it depends a lot
on the design. If it is a hobby project, I might live with marginal logic
high (3.3V out to 5V in) and a series current limit resistor (5V out to
3.3V in) so long as the logic actions are relatively slow and it did not
have to operate at -40C or +70C. In this case, you could probably get away
with the simple solution.

If it is going to be a commercial product, or outside the limits of narrow
temperature range and slow logic, I'd say: do it right.

Jim Wagner
Oregon Research Electronics

Re: Mega324p port info

2008-04-29 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "Bob Gardner" 
<bob.linda.gardner@...> wrote:

> So, I'm assuming from the replies
> that, even though the 324P can 
> operate at 2.7V to 5.5V, if I power
> it from 3.3V it can't tolerate 5V 
> at an input?  Is that correct?

Well, why don't we go to the data sheet, where you said you "can't 
find" or "maybe don't understand" the information you're looking for.

You want the DC Characteristics table on page 326 (8011H–AVR–04/08).  
The maximum "Input High Voltage" is given for all pins as VCC + 0.5.  
If VCC is 3.3V, this evaluates to 3.8V.  So, yes, an ATmega324P 
powered from 3.3V cannot tolerate 5V on an input.

What isn't in the data sheet, but we all know, is that there are 
protection diodes between each input and VCC.  At VCC + 0.5V, they 
will start to turn on.  By 5V, they will be fried.  But, if you limit 
the current with a resistor, they can be used to prevent the input 
voltage from going much above the maximum.  Pragmatically, this will 
be OK and you can get away with it at low switching speeds.  The use 
of serial ports (I presume you mean the UARTS, "serial" is ambiguous) 
will qualify as low speed.

We also need to ask whether the 3.3V device will be able to produce a 
logic one that the 5V device is happy with.  The minimum Output High 
Voltage is given as 2.3V for a 3V supply, so it is reasonable to 
expect 2.6V at 3.3V.  The minimum Input High Voltage is given as 
0.6VCC, which at 5V is 3V.  So this doesn't look as if it will work.  
Again, pragmatically, the minimum Output High Voltage is given with a 
10 mA current load.  Driving just another device's input, we know 
that you can expect almost the supply voltage.  Here it's close, but 
it will probably work.

So, the advice you're getting is that to do the job properly you need 
level converters.  But, if you're willing to cut corners you can 
probably get away with the resistors you originally proposed.

Graham.

Re: Mega324p port info

2008-04-29 by Bob Gardner

Graham, Jim, and John,

Thanks very much for all the information.  It will definitely help me 
in the future to better understand these issues.  And, no, I don't 
want to cut corners.  I will definitely use some type of level 
converter.  John's suggestions looked good.

Thanks again, I learned a lot.  This is a great forum.

Bob


--- In AVR-Chat@yahoogroups.com, "Graham Davies" <Yahoo37849@...> 
wrote:
>
> --- In AVR-Chat@yahoogroups.com, "Bob Gardner" 
> <bob.linda.gardner@> wrote:
> 
> > So, I'm assuming from the replies
> > that, even though the 324P can 
> > operate at 2.7V to 5.5V, if I power
> > it from 3.3V it can't tolerate 5V 
> > at an input?  Is that correct?
> 
> Well, why don't we go to the data sheet, where you said you "can't 
> find" or "maybe don't understand" the information you're looking 
for.
> 
> You want the DC Characteristics table on page 326 (8011H–AVR–
04/08).  
> The maximum "Input High Voltage" is given for all pins as VCC + 
0.5.  
> If VCC is 3.3V, this evaluates to 3.8V.  So, yes, an ATmega324P 
> powered from 3.3V cannot tolerate 5V on an input.
> 
> What isn't in the data sheet, but we all know, is that there are 
> protection diodes between each input and VCC.  At VCC + 0.5V, they 
> will start to turn on.  By 5V, they will be fried.  But, if you 
limit 
> the current with a resistor, they can be used to prevent the input 
> voltage from going much above the maximum.  Pragmatically, this 
will 
> be OK and you can get away with it at low switching speeds.  The 
use 
> of serial ports (I presume you mean the UARTS, "serial" is 
ambiguous) 
> will qualify as low speed.
> 
> We also need to ask whether the 3.3V device will be able to produce 
a 
> logic one that the 5V device is happy with.  The minimum Output 
High 
> Voltage is given as 2.3V for a 3V supply, so it is reasonable to 
> expect 2.6V at 3.3V.  The minimum Input High Voltage is given as 
> 0.6VCC, which at 5V is 3V.  So this doesn't look as if it will 
work.  
> Again, pragmatically, the minimum Output High Voltage is given with 
a 
> 10 mA current load.  Driving just another device's input, we know 
> that you can expect almost the supply voltage.  Here it's close, 
but 
> it will probably work.
> 
> So, the advice you're getting is that to do the job properly you 
need 
Show quoted textHide quoted text
> level converters.  But, if you're willing to cut corners you can 
> probably get away with the resistors you originally proposed.
> 
> Graham.
>

Re: Mega324p port info

2008-04-30 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "Bob Gardner" <bob.linda.gardner@...> 
wrote:

> ... I don't want to cut corners.

Then there's one more trick that might be worth bringing up.  All the 
level converter ICs mentioned will work great, but you probably don't 
have them in your spares drawer.  For two connections at fairly low 
speed (I'm still assuming you're using the UARTS) you will also be able 
to use a couple of transistors in common-base configuration as level 
converters.  Any old NPN small signal transistors will do, such as the 
2N3904.  Pull the base up to VCC on the driving side with a fairly high 
value resistor.  Connect the driving port bit to the emitter.  Pull the 
collector up to VCC on the driven side with a medium value resistor and 
connect it to the driven port bit.  Without doing the math, I would try 
something like 4.7 kohms on the collector and 47 kohms on the base, but 
anything in this area should work.  When the driving output is higher 
than the base resistor, the transistor is off and the collector 
resistor pulls the driven input up.  When the driving output goes low, 
the transistor turns on and pulls the driven input down to about 0.2 V 
above the driving output voltage.  You lose a small amount of noise 
margin, but in many projects this is of little consequence and the big 
advantage is you can often pull this trick with parts on hand.

Graham.

Re: Mega324p port info

2008-04-30 by n4hhe

--- In AVR-Chat@yahoogroups.com, "Graham Davies" <Yahoo37849@...> wrote:
> 
> What isn't in the data sheet, but we all know, is that there are 
> protection diodes between each input and VCC.  At VCC + 0.5V, they 
> will start to turn on.  By 5V, they will be fried.  But, if you limit 
> the current with a resistor, they can be used to prevent the input 
> voltage from going much above the maximum.  Pragmatically, this will 
> be OK and you can get away with it at low switching speeds.  The use 
> of serial ports (I presume you mean the UARTS, "serial" is ambiguous) 
> will qualify as low speed.

There is an Atmel apnote documenting the above unofficial technique.
IIRC the apnote was discussing building an AC utility power meter and
how one could interface high voltage 240 VAC to detect zero crossings.
They said to select the resistor so that about 1 mA or less flowed through
the protection pullup diodes on the AVR inputs and one should be OK.

The classic brute force technique is to use a series resistor and a pulldown
resistor to build a voltage divider.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.