Raspberry Pi GPIO 3.3V <-> 5V - Page 1
Forum section: electronics / beginners

author: itvend
author_rank: Contributor
timestamp: July 02, 2013, 05:04:59 pm
content: Hello everybody.So i have atmega32 and raspberry pi and i wish to connect them with SPI. Is it good idea to convert SPI 3.3V signals to 5V for atmega using transistor based buffer like on schematic ( attachment )

author: warrmr
author_rank: Newbie
timestamp: July 02, 2013, 07:09:03 pm
content: Try something like thishttp://www.adafruit.com/products/757Its similar to your design.

author: itvend
author_rank: Contributor
timestamp: July 02, 2013, 07:16:08 pm
content: cant buy this module but it was one of ideas , DIP IC would be great, any suggestions ?

author: tld
author_rank: Regular Contributor
timestamp: July 02, 2013, 07:51:38 pm
content: Any reason you can't use an atmega32L, and run it off of 3.3V as well?

author: itvend
author_rank: Contributor
timestamp: July 02, 2013, 08:10:08 pm
content: buy new uC , i thought about it. but what about schematic would it work for SPI

author: warrmr
author_rank: Newbie
timestamp: July 02, 2013, 09:09:22 pm
content: Have a look at one of the TXB0108 chips, its an 8 channel converter, if you look around I'm sure you can get one cheaper with less channels.Otherwise take a look at the schematics for the spark fun level converter, and modify the schematic so that it is bi-directional on both channels as in this current form only the tx lines are bi-directional.https://www.sparkfun.com/datasheets/BreakoutBoards/Level-Converter-v10.pdfhttp://www.adafruit.com/datasheets/txb0108.pdfhttp://www.adafruit.com/datasheets/txb0108appnote.pdf

author: Ziltoid
author_rank: Contributor
timestamp: July 02, 2013, 09:22:44 pm
content: Maybe you can get around it with a simple Voltage divider from 5 to 3.3V, and check how the other device interprets the 3.3V. If it reads the 3.3V as high you just need some resistors!

author: itvend
author_rank: Contributor
timestamp: July 02, 2013, 09:26:40 pm
content: That i know and was my plan , but problem is 3.3V to 5V

author: millerb
author_rank: Regular Contributor
timestamp: July 02, 2013, 09:26:52 pm
content: Is there a compelling reason to be running your microcontroller at 5V? If not, supply with 3.3V and move on. I pretty much treat 5V as legacy these days and would only use level shifters if I needed to talk to a 5V part, which is almost never.

author: Ziltoid
author_rank: Contributor
timestamp: July 02, 2013, 09:58:43 pm
content: Your Rasp is runnig at 3.3V and the Atmel at 5V right? Check if the Atmel is taking the 3.3V as a Digital High!

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 10:20:56 pm
content: Quote from: millerb on July 02, 2013, 09:26:52 pmThis. Why would you run the chip at 5V?

author: itvend
author_rank: Contributor
timestamp: July 02, 2013, 10:52:21 pm
content: Why? because it run on 5V and 5V is everywhere , now i feel its just simpler to buy 3.3 uC atmega32l for example

author: Stonent
author_rank: Super Contributor
timestamp: July 02, 2013, 11:40:21 pm
content: On this site, the guy turned his Pi into an Atmel programmer, he kept everything at 3.3 powered from the Pi and it worked fine.http://kevincuzner.com/2013/05/27/raspberry-pi-as-an-avr-programmer/I checked Mouser and filtered by just DIPs, and only the "ATmega32-16PU" is not 3.3 capable, but all other ATmega32 chips are.So that's the 32A, 32L, 324PA, 324P, 324PV10

author: RoadRunner
author_rank: Frequent Contributor
timestamp: July 03, 2013, 12:11:25 am
content: may be these chips are helpfulhttp://www.ti.com/product/sn74lvc1g125they take 3.3V input and can work 5V level.

author: itvend
author_rank: Contributor
timestamp: July 03, 2013, 12:43:54 am
content: Quote from: Gaurav on July 03, 2013, 12:11:25 amsn74lvc1g125 sucks little, i hate smd parts, but what you gonna do i probably go with sn74lvc1g125 or 3.3V uC, thaks all for generating ideas , but i didnt get answer for my question, does transistor buffer works for spi or not?

author: Psi
author_rank: Super Contributor
timestamp: July 03, 2013, 03:15:01 am
content: If it's just for a hobby project just connect the 3.3V directly to the 5V input, it will work fine even though it's outside spec.From memory the pins change to logic high somewhere between 1V -> 2V

author: brainwash
author_rank: Frequent Contributor
timestamp: July 03, 2013, 05:02:39 pm
content: Or you can take an 3.3V supply from the rPI and provide that to the microcontroller.If not possible, read everything here:http://www.newark.com/pdfs/techarticles/microchip/3_3vto5vAnalogTipsnTricksBrchr.pdf

author: ptricks
author_rank: Frequent Contributor
timestamp: July 03, 2013, 09:52:47 pm
content: Lots of ways, but here are some easy ones:https://www.sparkfun.com/tutorials/65

author: tld
author_rank: Regular Contributor
timestamp: July 03, 2013, 10:05:08 pm
content: Quote from: itvend on July 03, 2013, 12:43:54 amIf I understand you correctly, you're not just looking to solve an actual problem, but also curious if your thinking and possible solution is correct.I think part of the reason that you haven't gotten a really good answer to that might be that there's a lot of variables at play, and hard to give an answer that's correct for all of them.As a general answer, yes, it should be a workable to use a transistor-buffer for SPI, as long as you keep an eye on not getting an inverted signal etc.There is however a lot of factors to consider. Take speed for example. How fast will the SPI-bus be? Will bandwidth/rise-time be fast enough?Figuring out if everything will always behave the right way - with margins - is quite a bit of work, and virtually impossible without diving into details.Depending on specific, it's quite possible that a 3.3V signal can register correctly as HIGH on a 5V micro.For the other direction, you might be able to simply cut down the 5V signal to 3.3V-safe levels using a resistor divider.