PDA

View Full Version : Question on 3v to 5v SPI



BertMan
- 9th October 2005, 05:14
What is the best way to interface a 5v spi interface with a 3v interface? Is there a way to use an opamp for this? The 3v device will only tolerate up to 4.1v so I need to drop the voltage while preserving the digital signal.

mister_e
- 9th October 2005, 20:50
voltage divider with few cents resistor... not much, Let's say a 3.9K from the PIC to the SPI device pin and a 1K resistor between this last pin and GND.

BertMan
- 10th October 2005, 06:01
I found a good combination (1500 and 1000 ohms) that would produce 3.0 volts at 2mA. Now how about the step up from 3 to 5v? If I could come up with the correct bias, I could use a standard transistor because I have a 5v tap in my circuit. But would it switch fast enough in this application?

sean-h
- 10th October 2005, 17:16
Why not just run the Pic at 3Volts I have done this with a few different Pics that needed to talk to 3.3V memory chips.
In the spec sheets it does show that you should run at a lower Osc speed at 3.3v but I have always got away with still using a 20mhz Xtal.

Regards

Sean.

BertMan
- 10th October 2005, 17:34
Yes the pic will run at 3v but I have a math coprocessor that simply refuses to work at any voltage below 5v. The easiest thing is to keep the 5v logic for the pic and the cocpu and convert to 3v for the 3v device compass. I am going to try voltage dividers for the step down (output, and clock) and a standard NPN transistor with the base connected to the output of the compass(with bias resistor), the emitter connected to the pic, and the collector connected to +5V for the step up input. In case you cant tell, I am new to digital circuits, but do I have some experience with analog designs. Would this setup allow 5v to 3v communications?

sean-h
- 10th October 2005, 18:29
Ah I see what you mean, so the Pic must be at 5volts.

What about a buffer chip such as 74LVC07A running at 3volts?

http://www.semiconductors.philips.com/pip/74LVC07A.html

Dunno if this will be fast enough depending what speed you are clocking the data in and out at.

Should think the Pic will be happy with 3volts as a input to show a high and your concern is just isolating the 5volts going back to 3v part.

Regards

Sean.

BertMan
- 10th October 2005, 18:37
Thanks Sean. I will look into the 74LVC07A. If the Pic will accept a 3v input as a high, then half my battle is over! But here is what I was originally suggesting.... Does this look correct?

sean-h
- 10th October 2005, 19:09
Not sure if that looks correct with the tranny, would pop a resistor in on the base to start with and is the emitter going to gnd on the chip and your 5v is the load output coming off it?

Heres a good link to help you choose the config if using a tranny you need but remember that using a tranny will invert the signal and to allow this in your code.

http://www.kpsec.freeuk.com/trancirc.htm

Regards

Sean.

BertMan
- 10th October 2005, 19:42
Actually I am using a transistor basically as a 3v switch in this schematic. When the compass sends a 3v signal to the base, the 5v on the collector would flow to emitter, thus sending a 5v pulse through the emitter to the 5v input on the pic. Er, in theory.

BertMan
- 11th October 2005, 02:17
I found an excellent pdf that expains different ways to mix 3v and 5v logic and gives part #'s too. Just in case someone else is trying this... http://www.freescale.com/files/microcontrollers/doc/app_note/AN2433.pdf