View previous topic :: View next topic |
Author |
Message |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
Is a 3.3 V level converter required for interfacing a 5V PIC |
Posted: Mon May 05, 2008 4:07 am |
|
|
Hi,
I am trying to develop a project using a 18F4550 and a MMC (this is the first time i am using a MMC and the 18F4550). I need to interface them.
The MMC works on a 3.3 V system whereas the PIC works on 5 V system, do I need to convert the I/O levels of the MMC to 5 V or will the PIC detect the 3.3V level as a high.
Also is it OK to use a potential divider to power down the 5 V level to 3.3V or should I use a device like 74VHC08.
Please bear in mind the project is a datalogger for use in an industrial environment.
Your comments would be most helpful....
thank you
arunb |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Mon May 05, 2008 8:00 am |
|
|
I think you answered your own question. Since this is for a commercial unit meant for industrial applications, why not use a dedicated level converter IC/ICs? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: Is a 3.3 V level converter required for interfacing a 5V |
Posted: Mon May 05, 2008 8:02 am |
|
|
arunb wrote: | Hi,
I am trying to develop a project using a 18F4550 and a MMC (this is the first time i am using a MMC and the 18F4550). I need to interface them.
The MMC works on a 3.3 V system whereas the PIC works on 5 V system, do I need to convert the I/O levels of the MMC to 5 V or will the PIC detect the 3.3V level as a high.
Also is it OK to use a potential divider to power down the 5 V level to 3.3V or should I use a device like 74VHC08.
Please bear in mind the project is a datalogger for use in an industrial environment.
Your comments would be most helpful....
thank you
arunb |
I have done a lot of work in this area. Yes you do need a level shifter from the D0 out of the card to the SDI in of the PIC. This is because, in SPI mode, the PIC uses a Schmidt trigger input stage and the voltage thresholds are outside to worst case scenario voltage levels for an SD/MMC card output.
Going the other way, form the PIC to the SD/MMC card, the resistor divider and the level converter via a xx08 are both viable options. Microchip's SD/MMC PICTail uses one variant of the xx08 as the level converter but some version of the boards do not work correctly. The 74LCX125M does work correctly.
Here is a link to an implementation using the 74LCX125M http://www.ljcv.net/picnet1/picnet1-ds0.pdf
Here is a link to an implementation using resistor dividers from PIC to the SD card: http://www.brushelectronics.com/download/BE_Reference_Design_PIC18F4620_ENC28J60.zip
All other considerations aside, the 74LCX125M approach is "cleaner". _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Mon May 05, 2008 12:41 pm |
|
|
I found this Microchip booklet very useful:
3V Tips 'n Tricks |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 05, 2008 2:14 pm |
|
|
Why not use an PIC18LF4550 at 3.3V?
Makes things a lot easier and you will save some power too (cheaper power supply). Only limitation is a maximum clock frequency of 18.7MHz at 3.3V. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Mon May 05, 2008 2:42 pm |
|
|
If you're set on using a 5V PIC, I can recommend the MAX3371 level shifter IC. |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Tue May 06, 2008 11:49 am |
|
|
As a makeshift solution you can also improve the voltage levels of your normal PIC (i.e. if you don't have the LF version) to lower threshold levels by lowering the supply voltage to 4.2 Volts (which still fits the specification according to the datasheet), this will give you much better aquisition margin to properly interpret the 3.3 V signals usually without any level shifting in the upward direction. |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Wed May 07, 2008 9:48 pm |
|
|
Thank you all for the help.
I think the level shifter idea is better.
arunb |
|
|
foodwatch
Joined: 18 Apr 2006 Posts: 66
|
|
Posted: Fri May 09, 2008 2:37 pm |
|
|
A simple level shift method is to take the 5v data out, go through the cathode of a diode, tie the anode to 3v through a 10k resistor and bring the anode to the desired 3v input of the connected line. When the source goes high to 5v it is blocked by the diode and the 10k resistor acts as a 3v pull up. When the source goes low, it pulls the anode of the diode low and provides a safe low for your 3v source. This is cheaper and easier that a level shifter unless you have many i/o pins to deal with. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Fri May 09, 2008 4:18 pm |
|
|
This idea may work when you are going from the output of a 5v device to the input of a 3.3v device but, without a shifter, how do you get the 3.2v coming out of your 3.3v device to reach the 4.0v required by the input of the 5v device?
Ronald |
|
|
foodwatch
Joined: 18 Apr 2006 Posts: 66
|
|
Posted: Fri May 09, 2008 4:32 pm |
|
|
This can be done as follows: Take the 3v output line and connect it thru a 10k resistor to the base of an NPN transistor (ie 2n2222). Tie the emitter to ground. Take the collector through another 10k resistor to 5v supply. Take the output to your 5v device from the junction of the the 10k and the collector. You will need to invert your logic... ie a 1 at 3v = 0 at 5v, or if you like lotsa parts add another transistor configured the same way to get the logic back to 1 in = 1 out. |
|
|
|