Question on 3v to 5v SPI


Closed Thread
Results 1 to 10 of 10
  1. #1
    BertMan's Avatar
    BertMan Guest

    Default Question on 3v to 5v SPI

    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.
    Last edited by BertMan; - 9th October 2005 at 05:37.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    BertMan's Avatar
    BertMan Guest


    Did you find this post helpful? Yes | No

    Default

    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?

  4. #4
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    BertMan's Avatar
    BertMan Guest


    Did you find this post helpful? Yes | No

    Default

    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?
    Last edited by BertMan; - 10th October 2005 at 17:38.

  6. #6
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    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.

  7. #7
    BertMan's Avatar
    BertMan Guest


    Did you find this post helpful? Yes | No

    Default

    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?
    Attached Images Attached Images  

  8. #8
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    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.

  9. #9
    BertMan's Avatar
    BertMan Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  10. #10
    BertMan's Avatar
    BertMan Guest


    Did you find this post helpful? Yes | No

    Default

    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/micro...ote/AN2433.pdf

Similar Threads

  1. Using SPI with External Interrupts
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th June 2008, 04:08
  2. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  3. 1.5 v to 3v and 5v? Really confused.
    By kevj in forum Schematics
    Replies: 6
    Last Post: - 17th October 2007, 14:16
  4. 5v and 7v on same board - question
    By mark.oswald in forum Schematics
    Replies: 1
    Last Post: - 28th July 2007, 23:03
  5. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts