5V into non-5V compliant pin - Page 1
Forum section: electronics / projects

author: djacobow
author_rank: Super Contributor
timestamp: September 10, 2018, 05:06:25 pm
content: So, I've got a design that connects an AVR as a SPI slave to a Raspberry Pi as a SPI master. GPIO on the Pi are all 3v3 and the AVR is on 5V. For the MISO signal, I use a voltage divider to get 3V compatible signal and everything is hunky dory.Except it would be really convenient to be able to update the AVR firmware from the Pi. This requires just one more pin: reset, which the PI must be able to pull down. AVR reset is connected to 5V through a 10k resistor and also connected to the Pi GPIO. Flashing the AVR from the Pi works and I have to say, it's incredibly satisfying to not have to pull out a programmer to zap my device.But it's irking me, because though that 10k resistor is limiting the current into the Pi pin through the ESD diodes to something on the order of (5V-3.3V-0.7V)/10k = ~100uA, I know that I am abusing this pin with 5V.So, the question is:- what are the odds that I kill this pin and when should I expect it to happen? I can use a 100k pullup on reset, in which case the current through the ESD protection would be that much less. Or, is there something else I'm missing that could cause damage. Like, it issue is not just blowing up diodes, but something that truly has to do with voltage?Of course, I could fix this by using an NPN pulldown to control the AVR reset line and drive the base through from the RPi GPIO and inverting the GPIO signal. But it's one more part. Worth doing?

author: HB9EVI
author_rank: Frequent Contributor
timestamp: September 10, 2018, 05:11:00 pm
content: If you don't want to jeopardize your Pi, use the transistor; it's one lousy cent article which makes nothing really more complicated.For sure I'm not going to try it on my Pi to give you a fitting anwser

author: RoGeorge
author_rank: Super Contributor
timestamp: September 10, 2018, 05:33:13 pm
content: Just to be sure, use a level shifter.This an example of a bidirectional level shifter implemented with bipolar transistors:http://www.hagtech.com/pdf/iic.pdf

author: djacobow
author_rank: Super Contributor
timestamp: September 10, 2018, 05:46:47 pm
content: Quote from: RoGeorge on September 10, 2018, 05:33:13 pmWell, I definitely do not need bidirectional on this signal. But I think I probably will put in a pulldown transistor. There is space on the board --barely. In addition to the tranny, I'll need a couple resistors.I have seen a few diagrams describing what the input pin of RPi's look like, and my gut from that diagram is that my existing arrangement is probably OK, but it does not hurt to play it safe. And I guess, in theory, Broadcom could change the pin circuit at any time.

author: georges80
author_rank: Frequent Contributor
timestamp: September 10, 2018, 05:48:15 pm
content: Do note that the RESET pin on AVR devices that support high voltage programming (+12V to the RESET) do not have an ESD diode clamping RESET to the VCCpin since RESET must be allowed to go up to +12V. It is a very different pin to the others...cheers,george.

author: djacobow
author_rank: Super Contributor
timestamp: September 10, 2018, 05:52:40 pm
content: Quote from: georges80 on September 10, 2018, 05:48:15 pmDefinitely not doing high voltage programming; there's no 12V on my board at all. :-)I've never really looked at how the AVRs do in-system programming much before, but on looking at the source code for avrdude, it looks like reset is held down the entire time and than magic stuff is shifted in over "SPI", and that's about all she wrote.

author: georges80
author_rank: Frequent Contributor
timestamp: September 10, 2018, 06:05:05 pm
content: ^ My point is that the RESET pin has different ESD/diode clamping on the pin - not that you will be doing HV programming. So, it is nominally 5V tolerant (as an input) even if AVR VCC is 3.3V...Just something to be aware of in terms of series diodes for current limiting into (presumed) ESD diodes etc.cheers,george.

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 10, 2018, 06:23:10 pm
content: You could use a 2N7000 MOSFET so you don't need an extra resistor.

author: djacobow
author_rank: Super Contributor
timestamp: September 10, 2018, 06:34:49 pm
content: Quote from: georges80 on September 10, 2018, 06:05:05 pmI get it, but the ESD concern is not on the AVR pin, but on the RPi (Broadcom 283x) chip.

author: djacobow
author_rank: Super Contributor
timestamp: September 12, 2018, 05:08:27 pm
content: I fixed my circuit to use a pulldown transistor, but before I did, I made a bit of a deep dive into the issue of these pins and found the waters surprisingly muddy.For one, there is no proper non-NDA datasheet for the Broadcom part used in RPi's, so few people really know what the true electrical specs of the pins are.First, this site, where I copied the diagram from tows the standard line that the pins are not 5V tolerant and the clamping diodes are just parasitic diodes and if you forward bias them you risk latchup or raising the voltage on the 3V3 rail on the chip, leading to any kind of damage.http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications.I think when that 5V is thread through a high impedance (100k) or so, that story gets weak, but ok.At least one person (https://www.tansi.org/rp/interfacing5v.html) has made measurements of RPi pins and come to the conclusion that the pads may have been designed for 5V tolerance, even if they are not advertised or tested for such. This is on the basis of feeding higher voltage into an RPi pin and not actually seeing any clamping of voltage until the pin gets over 6V. His recommendation is to use a current limiting resistor and your own external clamping diode to 3V3. He dismisses the idea that you could raise the 3V rail this way, because at worst, injecting your 100uA or whatever into the pin is only going to cause the regulator feeding the chip to provide that much less. I think he's right about that.There had been a somewhat heated discussion on the RPi forums about this at some time:http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=63362Not to belabor this topic much further, but I think it is an interesting illustration of the situation where something is "probably" "fine" if you are "careful" and "think" about what you are doing and "nothing else changes", but you can also do the recommended thing and not worry about it. The latter is probably the right course if you are manufacturing something but it does lack a certain intellectual satisfaction.