3.3V to 5V interfacing

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

3.3V to 5V interfacing

Neil
Hi,

I'm connecting a 3.3V-powered PIC to a 5V-powered PIC via the hardware  
USARTs.  Currently I have these prototyped and working well with  
bi-directional mosfet level converters as shown here...
http://www.nxp.com/documents/application_note/AN10441.pdf

However, I need to fit this in a small enclosure and PCB real-estate  
is a problem once again.  I'm wondering if I can eliminate or at least  
reduce the components for the logic-level converter.

In the 5V-->3.3V direction, the 3.3V RX input (PIC24) is 5V fault  
tolerant, so I should be able to direct-connect that.

In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a  
Schmitt trigger, and the electrical specs for that in the datasheet  
are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V  
signal won't work.

So that brings the 6 components down to 3 (mosfet and 2 resistors),  
but is there a better (smaller footprint) way, or something I'm  
missing here that would let me direct-connect the other direction?

FWIW, I did find monolithic converters such as this, but it doesn't  
save much space... http://www.nxp.com/documents/data_sheet/PCA9306.pdf

Cheers,
-Neil.



--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

William Bross
PICdude wrote:

>Hi,
>
>I'm connecting a 3.3V-powered PIC to a 5V-powered PIC via the hardware  
>USARTs.  Currently I have these prototyped and working well with  
>bi-directional mosfet level converters as shown here...
>http://www.nxp.com/documents/application_note/AN10441.pdf
>
>However, I need to fit this in a small enclosure and PCB real-estate  
>is a problem once again.  I'm wondering if I can eliminate or at least  
>reduce the components for the logic-level converter.
>
>In the 5V-->3.3V direction, the 3.3V RX input (PIC24) is 5V fault  
>tolerant, so I should be able to direct-connect that.
>
>In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a  
>Schmitt trigger, and the electrical specs for that in the datasheet  
>are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V  
>signal won't work.
>
>So that brings the 6 components down to 3 (mosfet and 2 resistors),  
>but is there a better (smaller footprint) way, or something I'm  
>missing here that would let me direct-connect the other direction?
>
>FWIW, I did find monolithic converters such as this, but it doesn't  
>save much space... http://www.nxp.com/documents/data_sheet/PCA9306.pdf
>
>Cheers,
>-Neil.
>
>
>
>  
>
Neil,

Have you considered trying a SN74LVC2G07DBVR and a couple of pull up
resistors?  Pull up to appropriate level on each output.  Run the G07
off either the 3.3V or 5V.  That gets you down to 3 parts total.  I've
been using this method to interface my PICs to Digi's Rabbit modules for
years and it works well.

Bill
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Harold Hallikainen-2
I often do 3.3V to 5V translation using a 74HCT part. These have TTL input
thresholds that will work with 3.3V logic. With the TinyLogic parts, one
part does the job. For the other way (5V to 3.3V), if the speed is not too
high, I just use a resistive voltage divider.

Harold



FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Kerry Wentworth
In reply to this post by Neil
You might try a PCA9306.  It is basically 2 of the FET circuits in an 8
pinIC package.

Kerry


PICdude wrote:

> Hi,
>
> I'm connecting a 3.3V-powered PIC to a 5V-powered PIC via the hardware  
> USARTs.  Currently I have these prototyped and working well with  
> bi-directional mosfet level converters as shown here...
> http://www.nxp.com/documents/application_note/AN10441.pdf
>
> However, I need to fit this in a small enclosure and PCB real-estate  
> is a problem once again.  I'm wondering if I can eliminate or at least  
> reduce the components for the logic-level converter.
>
> In the 5V-->3.3V direction, the 3.3V RX input (PIC24) is 5V fault  
> tolerant, so I should be able to direct-connect that.
>
> In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a  
> Schmitt trigger, and the electrical specs for that in the datasheet  
> are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V  
> signal won't work.
>
> So that brings the 6 components down to 3 (mosfet and 2 resistors),  
> but is there a better (smaller footprint) way, or something I'm  
> missing here that would let me direct-connect the other direction?
>
> FWIW, I did find monolithic converters such as this, but it doesn't  
> save much space... http://www.nxp.com/documents/data_sheet/PCA9306.pdf
>
> Cheers,
> -Neil.
>
>
>
>  

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Neil
In reply to this post by William Bross
This does not however save me any space over the discrete (mosfet + 2
resistors) method.  The discrete solution has a slight advantage over
being able to tuck the components into bare spots on the board also.

I was asking as perhaps someone may have had some cool trick to do this
with just a pull-up or something perhaps.

Cheers,
-Neil.


  On 8/7/2012 9:45 AM, William Bross wrote:
> Have you considered trying a SN74LVC2G07DBVR and a couple of pull up
> resistors? Pull up to appropriate level on each output. Run the G07
> off either the 3.3V or 5V. That gets you down to 3 parts total. I've
> been using this method to interface my PICs to Digi's Rabbit modules
> for years and it works well. Bill

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Spehro Pefhany
In reply to this post by Neil
At 02:47 AM 07/08/2012, you wrote:

>Hi,
>
>I'm connecting a 3.3V-powered PIC to a 5V-powered PIC via the hardware
>USARTs.  Currently I have these prototyped and working well with
>bi-directional mosfet level converters as shown here...
>http://www.nxp.com/documents/application_note/AN10441.pdf
>
>However, I need to fit this in a small enclosure and PCB real-estate
>is a problem once again.  I'm wondering if I can eliminate or at least
>reduce the components for the logic-level converter.
>
>In the 5V-->3.3V direction, the 3.3V RX input (PIC24) is 5V fault
>tolerant, so I should be able to direct-connect that.
>
>In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a
>Schmitt trigger, and the electrical specs for that in the datasheet
>are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V
>signal won't work.
>
>So that brings the 6 components down to 3 (mosfet and 2 resistors),
>but is there a better (smaller footprint) way, or something I'm
>missing here that would let me direct-connect the other direction?
>
>FWIW, I did find monolithic converters such as this, but it doesn't
>save much space... http://www.nxp.com/documents/data_sheet/PCA9306.pdf
>
>Cheers,
>-Neil.

Something like a 74LVC1T45 in SOT363 will give you one channel
of translation in a single leaded package about 2mm x 2mm (and about
30 cents, if that matters). I don't think you'll do much
better than that unless you like packages without leads like
XSON6 (1mm x 1mm)-- the same part is available in that package.
You can direct connect the other way.

--sp


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Joe Wronski
In reply to this post by Neil
On 8/7/2012 2:47 AM, PICdude wrote:
> In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a
> Schmitt trigger, and the electrical specs for that in the datasheet
> are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V
> signal won't work.
>
Eh?    How is an open drain output from the 3.3V side *not* going to
meet the 4V input spec on the 5V side, if the line is pulled up to 5V?
Unless I'm missing something, the 5V  tolerant feature of the 3.3V part
means you can just pull both lines up to 5V.
But if the 3.3V input side clamps the 5V output, the 5V side would get
confused when it's master?

Joe W
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Harold Hallikainen-2
In reply to this post by Harold Hallikainen-2
Following up on what someone else mentioned, a pin can be used as an open
drain output by driving the TRIS register instead of the PORT or LAT
register. You set the PORT or LAT bit low. When TRIS is low, the pin is
pulled low. When TRIS is high, the pin floats. If the pin has a 5V
tolerant input, it can be pulled up to 5V, making this a 5V output.

But, I think I recall the original problem being a UART interface. Since
you can't make the UART drive the TRIS bits, that would not work here. In
that case, I still think the 74HCTxxx is a good solution.

Harold





FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Neil
In reply to this post by Joe Wronski
Hmmm... was not aware that the USART TX was open-drain, but this can
make things much simpler.  I'll have to investigate that.

FWIW, each line is single direction always -- they are not bidirectional
lines.  The line that goes 3.3V-->5V is what I was worried about, as
when the 3.3V TX output goes high, it would only go up to 3.3V, whereas
the 5V RX input wants to see 4.0V. But this is moot (and solved) if it's
open drain.

I do remember that the 3.3V PIC's RX and TX pins are both 5V tolerant,
but now sure if the 3.3V side will clamp it.  I'll have to test this
with my existing prototype setup I think.

Cheers,
-Neil.


On 8/7/2012 3:03 PM, Joe Wronski wrote:

> On 8/7/2012 2:47 AM, PICdude wrote:
>> In the 3.3V-->5V direction, it seems the 5V RX1 input (18F24K22) is a
>> Schmitt trigger, and the electrical specs for that in the datasheet
>> are minimum input-High voltage of 0.8Vdd, so 4.0V, and thus the 3.3V
>> signal won't work.
>>
> Eh?    How is an open drain output from the 3.3V side *not* going to
> meet the 4V input spec on the 5V side, if the line is pulled up to 5V?
> Unless I'm missing something, the 5V  tolerant feature of the 3.3V part
> means you can just pull both lines up to 5V.
> But if the 3.3V input side clamps the 5V output, the 5V side would get
> confused when it's master?
>
> Joe W

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Marcel Duchamp
In reply to this post by Harold Hallikainen-2
On 8/7/2012 1:29 PM, Harold Hallikainen wrote:

> Following up on what someone else mentioned, a pin can be used as an open
> drain output by driving the TRIS register instead of the PORT or LAT
> register. You set the PORT or LAT bit low. When TRIS is low, the pin is
> pulled low. When TRIS is high, the pin floats. If the pin has a 5V
> tolerant input, it can be pulled up to 5V, making this a 5V output.
>
> But, I think I recall the original problem being a UART interface. Since
> you can't make the UART drive the TRIS bits, that would not work here. In
> that case, I still think the 74HCTxxx is a good solution.
>
> Harold
>
That's a good idea and Microchip has implemented it on some of the newer
parts. The PIC18F27J13 datasheet says:

20.3.3 OPEN-DRAIN OUTPUT OPTION
The drivers for the SDOx output and SCKx clock pins
can be optionally configured as open-drain outputs.
This feature allows the voltage level on the pin to be
pulled to a higher level through an external pull-up
resistor, provided the SDOx or SCKx pin is not multiplexed
with an ANx analog function. This allows the
output to communicate with external circuits without the
need for additional level shifters. For more information,
see Section 10.1.4 “Open-Drain Outputs”.
The open-drain output option is controlled by the
SPI2OD and SPI1OD bits (ODCON3<1:0>). Setting an
SPIxOD bit configures both the SDOx and SCKx pins for
the corresponding open-drain operation.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Joe Wronski
In reply to this post by Harold Hallikainen-2
Someone else might have been me, and i had assumed it was I2C given the referenced pdf. I dunno, a non-inverting TinyLogic gate or inverting one iff 3V uart out can be inverted.
Sorry about that.
Joe W

--
Sent from a cloud with K-9 Mail. Please excuse my haziness .

Harold Hallikainen <[hidden email]> wrote:

Following up on what someone else mentioned, a pin can be used as an open
drain output by driving the TRIS register instead of the PORT or LAT
register. You set the PORT or LAT bit low. When TRIS is low, the pin is
pulled low. When TRIS is high, the pin floats. If the pin has a 5V
tolerant input, it can be pulled up to 5V, making this a 5V output.

But, I think I recall the original problem being a UART interface. Since
you can't make the UART drive the TRIS bits, that would not work here. In
that case, I still think the 74HCTxxx is a good solution.

Harold





FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

RE: 3.3V to 5V interfacing

Alan Pearce - UKRI STFC
In reply to this post by Neil
>
> This does not however save me any space over the discrete (mosfet + 2
> resistors) method.  The discrete solution has a slight advantage over being able to
> tuck the components into bare spots on the board also.
>

I don't believe you need the resistors - check out the level shifter that Philips describe in their I2C specification document.


--
Scanned by iCritical.

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Mark Hanchey-2
In reply to this post by Neil
On 8/7/2012 2:23 PM, Neil wrote:


I was asking as perhaps someone may have had some cool trick to do this
with just a pull-up or something perhaps.

Cheers,
-Neil.

Zener diode and 10 ohm resistor on the 5V transmit pin  works quite well.
Nothing needed to connect the 3.3V transmit side to the 5V receive side.



Mark


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: 3.3V to 5V interfacing

Christopher Head-4
In reply to this post by Neil
On Tue, 07 Aug 2012 18:08:59 -0400
Neil <[hidden email]> wrote:

> Hmmm... was not aware that the USART TX was open-drain, but this can
> make things much simpler.  I'll have to investigate that.
>
> FWIW, each line is single direction always -- they are not
> bidirectional lines.  The line that goes 3.3V-->5V is what I was
> worried about, as when the 3.3V TX output goes high, it would only go
> up to 3.3V, whereas the 5V RX input wants to see 4.0V. But this is
> moot (and solved) if it's open drain.
>
> I do remember that the 3.3V PIC's RX and TX pins are both 5V
> tolerant, but now sure if the 3.3V side will clamp it.  I'll have to
> test this with my existing prototype setup I think.


Even if it isn't open-drain in hardware, you can always make it open
drain by shoving a diode in series. That brings you down to two
components as well as replacing a 3-pin MOSFET with a 2-pin diode.

Chris
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist