provission
Posts: 4
Joined: Sat Dec 14, 2013 5:51 pm

Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 6:06 pm

I'm trying to replace my Arduino by a Raspberry, so I can drive a 7-segment LED driver a little easier.
When I connect the RPi pins directly to the CLK,DAT,DIM pins, it's not working. It's showing "random" ouput. I read that it needs 5V, so I'm now using a logic level converter.

When I wire it the way it should be wired, it's still showing random numbers on the display, but voltage is 4.96v instead of 3.3, so I think the logic level converter does what it should do.

Only if I wire it like this, then everything works perfect, but I can't understand how that's possible. I guess almost everything is wrong in the images below.
Image
Image
Image
Image

Will it damage my RPi?
Can someone explain why it's working this way?

If I remove the logic level converter, and keep only the pi's 5V & 3V connected, it's not working.
I really don't understand what the logic level converter adds, in the (working) situation (see pictures).

(i'm a total beginner!)
Last edited by provission on Sat Dec 14, 2013 8:58 pm, edited 1 time in total.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9606
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Why is this circuit working?

Sat Dec 14, 2013 8:56 pm

Will it damage my RPi? The 5V and 3V are connected to each other.
YES IT WILL!

it will put 5V at all the logic designed for 3V3 only, which will sooner or later burn out!

many logic devices need high input levels that are at least 70% of their power. So if you power them with 5V then the logic high levels they need for a "1" become 0.7 * 5V = 3.5V at MINIMUM! but the PI only creates logic highs of at most 3.3V (and probably a few tenths of of volt lower, like 3.15V. so the external devices do not see logic highs reliably! Also make sure all the GND's of the systems are connected together (the level converters no to need GND, unless you also use the resistor dividers though).


Normally this can be solved by a logic level converter, which is simply a FET and a few pullups, one connected to the "lower voltage" (3V3) and one connected to the higher voltage (5V) if you reverse these two then the level converter won't work.


Another solution is, if possible, to lower the working voltage of the external device, if it runs on 3V3 the problem is solved!
But if lowering the voltage to as low as 3V3 isn't possible, then lowering the voltage only a little bit can still help. For example if the voltage can be lowered from 5V to 4.5V the minimal ViH (input high voltage) becomes 0.7 * 4.5V = 3,15V and so a 3V3 level signal will work!. That means that using the 0.5V forward drop of a single diode may be enough to provide 4.5V to the LED driver, so try putting an 1N4001 diode is series with the "5V" supply of the LED drivers, and see if that works (but check the data sheet to see how low the LED drivers power voltage can go!).

By forcing the PI's SoC to run on 5V you also made it output levels go up, and that is why it worked. But it will also distort your PI, if it hasn't done so by now.

provission
Posts: 4
Joined: Sat Dec 14, 2013 5:51 pm

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 9:10 pm

Thanks for a quick reply. Ok, then I'll stop using it that way. Maybe the RPi is already damaged, and is that the reason it doesn't work anymore like this:
Image
(5V to HV and 3.3V to LV)
3 RPi pins to 3 TXI-pins on the converter,
3 TXO on the converter to the led-display driver (CLK,DAT,DIM)
GND to RPi
(and of course the converter centered on the board)
When I wire it like that, it doesn't show the right numbers on the screen, but my voltmeter gives 4.96v on every TXO pin.
Is it possible it's already damaged?

I'm controlling a Sure-Electronics 7-segment LED DE-DP005
http://www.sure-electronics.net/mcu,dis ... -DP005.pdf
I'm afraid I can't change the voltage on the panel.

provission
Posts: 4
Joined: Sat Dec 14, 2013 5:51 pm

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 9:44 pm

There's a chance I'm missing something. Some cites from the datasheet:

Interface Voltage Level: VDD*0.8-VDD+0.5V, standard CMOS level.
Power Supply: DC4V-5.5V 0.2A/pcs (Maximum), for each additional panel, add another 0.2A, if voltage is less than 4V, the brightness would not be enough.
If over 4 boards connected together, you must add additional power supply to some of those boards, or the current may be lacking. Just apply +12V to some boards on the AUX power port. And be sure the polarity is correct.

I'm only powering the displays via the 12V DC AUX port, since there are more than 4 displays. I'm not powering the display via the IDC-cable.
This way it always worked perfect via the Arduino. (and this week via the described --working-- but completely wrong RPi wiring).

What does this mean, for the RPi? VDD*0.8-VDD+0.5V, standard CMOS level.

Dilligaf
Posts: 283
Joined: Wed May 23, 2012 6:48 pm

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 10:20 pm

In your picture it looks like you're bypassing the board completely the way it's situated on the breadboard, I think you need the inputs and outputs to bridge the center of the board. Note that I'm not an electronics expert and may be wrong.

gordon77
Posts: 3002
Joined: Sun Aug 05, 2012 3:12 pm

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 10:26 pm

Dilligaf wrote:In your picture it looks like you're bypassing the board completely the way it's situated on the breadboard, I think you need the inputs and outputs to bridge the center of the board. Note that I'm not an electronics expert and may be wrong.
I thought that as well but wasn't sure if the wires had pins on them going right through the small pcbs

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9606
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 10:42 pm

What does this mean, for the RPi? VDD*0.8-VDD+0.5V, standard CMOS level.
Its complete gibberish, unless its actually VDD*0.8 - VSS+0.5V, standard CMOS level. With VDD being the most positive voltage used (VCC), and VSS the most negative (0V that is GND), then it means that the level should be above 0.8 * 5V = 4V or below 0.5V, but seems a "Chinese" Datasheet with errors in it if it real reads "VDD*0.8-VDD+0.5V, standard CMOS level."
Also they are not really "standard C-MOS levels".
Also this picture
Image
depict the use of two channels of conversion, two conversions from 3V3 to 5V, using the FET and the pull-up on the 5V side, and two conversions from 5V to 3V3, using a resistor divider. But a resistor divider (unlike the FET circuit) does need a GND signal! But I assume that no signal conversion from 5V to 3V3 is actually needed, as the LED drivers don't need to send anything back to the PI.

The schematic of the converter is here: https://www.sparkfun.com/datasheets/Bre ... er-v10.pdf
an explanation on how it works can be found here. https://learn.sparkfun.com/tutorials/us ... et-the-llc

Actually the FET circuit is primarily used for I2C level conversion, and as such has no direction, I2C signals can send data both ways with this buffer. However it IS necessary to connect 3V3 and 5V to the level converter, simply don't use the
resistor divider (green and purple arrows).

an obvious error I see in the picture is that you entered the converter at one end of the breadboard, meaning you are bypassing the converter completely, as inputs and outputs are shorted together!
The tiny board should be mounted in the center of the breadboard, with pins on both sides of the separation in the middle, like this:
Image
Also as I said before it seems the GND of the PI isn't connected with the GND of the peripheral, which is always a requirement, unless you are using opto-isolators. Electric currents need a loop to circle around.

provission
Posts: 4
Joined: Sat Dec 14, 2013 5:51 pm

Re: Logic Level Converter: Why is this circuit working?

Sat Dec 14, 2013 11:20 pm

Thank you all.

I'm completely aware of the fact that I'm bypassing the converter by putting it on the left side of the breadboard.

The main question remains:
How is it possible that, when I remove the converter, so the pins/wires are all exactly at the same location as in the pictures, but then without the converter on that place,
5v attached to 3v;
3pins to CLK/DAT/DIM
.. the screen does NOT work,
and when I leave it the way as described in the pictures, bypassing the converter, but included, it actually works great?
(In both situations 3v and 5v are tied together)

I can't understand that.

I just read this:
http://tansi.info/rp/interfacing5v.html
Image
.. can that be a solution for me as well?

Thanks for all help.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9606
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 12:17 am

How is it possible that, when I remove the converter, so the pins/wires are all exactly at the same location as in the pictures, but then without the converter on that place,
5v attached to 3v;
3pins to CLK/DAT/DIM
.. the screen does NOT work,
and when I leave it the way as described in the pictures, bypassing the converter, but included, it actually works great?
(In both situations 3v and 5v are tied together)
I don't know, and don't want to know, (perhaps the resistors on the board influence the actual levels, who cares)!
I don't care because you should not tie the 3V3 and 5V lines together and then put 5V on them! no matter that it "seems to work", If you do this, you clearly do not know what you are doing, and are "just doing things in the blind". This is a guaranteed receipt for disaster!
So first order of things is that you should immediately disconnect the 5V and 3V3 power connections!
Then I suggest before you do something, you try to understand what you are doing, ask questions if you don't know, and read the instructions (data sheets) of the things you are knitting together, to understand how it works. Don't try to run before you can walk!

The drawing (1K.GIF) shows how to safely (more or less safely) connect a 5V signal source to a GPIO without blowing the GPIO pin up. That works, but is irrelevant as it doesn't address your problem at all!
the problem isn't "converting a 5V signal for a GPIO" , It is "correctly connecting several 3V3 logic level output signals to a device that normally expect at least 4V levels". Its a solution for a problem you do not have!

For this the correct use of logic level shifters to lift the 3.3V levels above 4V is the conventional solution, and lowering the required logic level of the device by lowering its power voltage so that 0.8 times that voltage is <3.3V is another, although unconventional, solution.

The correct use of the logic level converters obviously requires that the pins of them are not shorted together, and that you connect the signals in the right way, that is connecting the TX_LV for CLK (and TX2_LV for DAT) from the two (3V3) GPIO Lines used for the CLK and DAT GPIO outputs, and tie 3V3 to the adapters LV pin, and 5V to the HV pin, the converter 3V3 signals then come out of the TX_HV (5V-CLK) and TX2_HV (5V-DAT) outputs, to be connected to the LED module, a second board can be used in the same way to convert the DIM signal to 5V levels.

User avatar
aTao
Posts: 1072
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 12:54 am

Excuse me if I say this loud but.... GND

All voltages need a reference otherwise they are floating and meaningless.
I see from your first post that the level converter have neither a ground connection or any power connections. Later in this thread I see mention of connecting 3V3 and 5V0 to the relevant pins on the converter, but still no ground connection.

so, you...
1 take a OV, ground connection from the RPi and wire it to the converter GND next to LV,
2 take 3V3 from the RPI and wire to the converter LV,
3a take a 0V/ground connection from the LED circuit and wire it to the converter GND next to HV
or
3b connect RPi 0V to LED circuit 0V
take 5V0 from the LED circuit power supply and wire it to the converter HV


Never ever do 3a and 3b, bad things happen with audio and especially with video.
>)))'><'(((<

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 4:26 am

Hi,
provission wrote:Image
Author of this idea should be sued ! :x
EDIT: actually not... read below.

You should not use this circuit !!!
Let me write a general description why. (This text below is applicable to most chips -> read as: DO NOT use this "solution" also in any other circuit, with any processor/microcontroller/logic, etc.)

This is a large subject I'm diving in now, so I'm going to simplify it a bit and exclude several details to keep the explanation straight-forward.

Chips have some protection elements attached internally to each input pin. Let's suppose that these protection elements are simple diodes, one is connected to the internal positive supply rail (Vdd, Vcc, whatever you name it), and the other is connected to the chip ground (GND, Vss). Their purpose is to protect the chip against some shocks (eg. static electricity). This "resistance to shocks" is also listed in datasheet for each chip, one of the measuring method is with so-called Human-Body Model (representing a person touching the chip pin)...
Ok, so, these protection elements are not needed for normal operation (the reason that there is not much discussion about them in general discussions), but are crucial in several other occasions that might quickly occur.

We know that diodes have some voltage drop when they are conducting (read as: they are burning some energy, so they are heating more or less; depending on their construction and current,... and also some other parameters).
(By the way: If you ever wondered why chips' maximum allowed voltages range is slightly above Vcc and slightly below GND, you've just got the answer. ;-) )

Ok, let's take a look what is going on when you connect 5V to 3.3V input:
Since the voltage diff is 1.7V, the internal protection diode between input pin and Vcc internal rail starts to conduct (diode's anode is connected to input pin and its cathode to Vcc). As a result:
- complete chip is now supplied with 5V (slightly less due to diode voltage drop) and
- path for complete chip's supply current is established to flow through this protection diode.
Since this current is usually quite significant (according to diode's structure), it starts to overheat, the rest of the chip is also not very glad to have higher voltage then it should be.
Most likely, the protection diode will blow quickly. It can blow into two forms, either to conducted ("wire") or to disconnected state (like blown fuse).
In first case, you got input pin permanently connected to a Vcc (so the complete chip voltage got increased since there is no drop on a diode anymore).
In second case, you "just" lost proper protection (but fatal when you next time grab the circuit with your hands, for example) - remaining part of the chip might remain alive... until other elements on the input (transistors) don't start to slowly gave up due to permanent overvoltage.

Going back to this particular circuit - the resistor DOES NOT decrease voltage to 3.3V, but limits the current through the protection diode mentioned above. In other words, this resistor might save protection diode not to blow, but DOES NOT prevent chip core to be stressed with 5V as long as you provide logic "1" on the input.


Simple solution: If you add one resistor, you can get proper voltage converter. Connect additional resistor between input pin and ground. This is called "voltage divider" (resistive version, to be precise). Check Google for further details.
For digital circuits we're dealing with here, values of these resistors should be few kilo ohms (but keep their ratio, of course).


Best wishes, Ivan Zilic.
Last edited by FLYFISH TECHNOLOGIES on Wed Dec 18, 2013 12:37 pm, edited 1 time in total.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 8:22 am

Impressive. Most clueless posting I have read all week.

Have you even bothered to read the analysis that lead me to the conclusion that for the I/O pins specifically on the PI this circuit is fine? No, you apparently have not! :x :x :x

Your generic "explanation" is not only factually wrong, IT DOES NOT APPLY! The Pi does not have the customary simple protection circuit were there is a diode to Vcc and one from GND. It does have the diode from GND, but otherwise it has a limiter that kicks in at around 6.5V. That is called a "5V tolerant logic input" and the resistor is not even needed. It is there because I am careful and I cannot be user all Pi I/O circuits are the same.

Go to my page and read! http://www.tansi.org/rp/interfacing5v.html
If you then still think I am completely wrong, post an explanation about this that makes sense. And, BTW, of course I did not only theorize this, I tested it and I am using it.

As to your "explanation" of protection diodes, even if it were the classical diode to Vcc, the circuit would work. The current into Vcc would be around 1mA (1.7V, - 0.7V for diode, divided by 1kR). Protection diodes can take much more than that permanently. No protection diode will have trouble with the 0.7mW of heat it dissipates here. And no, that will not increase the Pi's supply voltage. It will replace some of the around 500mA flowing into it from the 3V3 voltage regulator, but unless you have more than these 500mA or so going into input pins, the Pis supply voltage will _not_ increase. This is EE 101 and you really do not understand what you are talking about. Instead you insult me.

So to reiterate my analysis: The circuit works. There is a detailed explanation of why on my web-page. If the Pi designers had not messed up by selecting a chip where they could not publish the data-sheet, it would very likely show 5V tolerant I/O, but they did and so measurements is all we have. But the measurements I did are more than suggestive.

BTW, as to the person connecting 5V and 3V3 together, that supplies the complete electronics of the Pi with 5V, which it is _not_ designed to take. As semiconductors are pretty rugged, this usually does not result in an instant puff of smoke, but it can and in some instances will. Doing this for any length of time or at all is strongly discouraged as it has a good chance of killing you Pi.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4212
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 8:57 am

I've allowed a right of reply following an ad hominem, but I don't want to see any more name calling. Let's calm it down now and discuss the topic.

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 9:31 am

I was just replying in kind, deducing this was the normal style here. I see I deduced wrongly. Hence to I apologize for my tone and thanks to the moderator for allowing my reply anyways.

In case anybody wonders about why this circuit works, _after_ reading the explanation on http://www.tansi.org/rp/interfacing5v.html and the additional ones on http://www.tansi.org/rp/gpio_startup.html, I will be happy to explain. I can also explain with a picture if needed why even a diode to Vcc (which the Pi does not have) does _not_ increase Vcc or destroy the Pi if used with my circuit.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 11:07 am

Hi,

Ok, let's go step by step...
There are several messages, also in this forum (wrote by moderators, which should be close to the proper data source), that GPIO is NOT 5V-tolerant... So, you're saying that they mislead ?


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4212
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 11:23 am

There are very few people, including moderators, who can answer the questions raised. The rest of us are going by the redacted datasheets and rule-of-thumb. awagner is saying that those are misleading. About the only person qualified to agree or disagree is gert.

There are two things though that I think we can all agree on:
1. Do not connect the 3.3V power to the 5V power.
2. You need a common ground connection.

As to the original question -- why the screen works one way and not the other -- I'd say that there is so much wrong with that circuitry that I would not be surprised if you said it turned the sky green. Just connecting the two power pins together is enough to ensure indeterminate behaviour, maybe permanently, let alone the rest of the issues.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9606
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 12:21 pm

If there is an 1K resistor between a 5V source and the GPIO there will be 5-3.3 = 1.7 V minus the forward voltage drop of the ESD protection diode (yes the PI has them, its not a 5V tolerant input, it simply has the two ESD diodes) so if we estimate the forward voltage as 0.5V (they are not schottky diodes) then across the resistor there will be 1.7 - 0.5 = about 1.2V, meaning 1.2mA will run through the resistor into the GPIO, and into the 3V3. Obviously this 1.2mA does not "Lift the 3V3 supply to 5V", it simply means that the 3V3 regulator has to supply 1.2mA less! and the 3V3 supply will still be 3V3. Obviously its an ESD diode, and its unknown how much current it will withstand permanently, but 1.2mA should be possible, that why I said the solution is "working", it isn't optimal in the sense that 1.2mA may still be a bit much, if you do this trick for multiple GPIO, that is why its better to increase the resistance to say 5 times that, or 4K7, which will decrease the current to one fifth, or 0.24mA.
Obviously if you divide the 5V to less than 3.3V that is an even better solution, as no voltage will flow into the 3V3 supply at all, but one resistor is better than none at all.

In this example no conversion from 5V to 3V3 needs to take place at all, as all GPIO's only act as outputs.

As for connecting all the GNDs together, that was one of the first remarks I made, and I repeated it several times.

I agree, lets keep this discussion civil!

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 2:51 pm

@mahjongg:
I completely agree to your analysis for the case that there is an upper protection diode. (Except that 1.2mA is not something that will overload a protection diode. They are also protection against crosstalk and typically can tolerate 10-20mA permanently.) I included the 1K resistor precisely for the case that the Pis have different input protection circuit and to make sure it works for the 5V tolerant case and the upper protection diode case. (It is also included to protect the pin if it is an output and accidentally connected to 3.3V. 5V or GND which is just far too easy to do.)

But the fact of the matter is that _my_ Pi does not have an upper protection diode. I tried to verify that it has (very easy test for presence of a diode) and failed. What _my_ Pi has is a clamping circuit that clamps at around 6.5...7V (100uA input current at 6.5V, as detailed on http://www.tansi.org/rp/interfacing5v.html), regardless of whether the Pi is powered or not. That is consistent with the standard protection on a 5V tolerant 3.3V logic input, implemented, e.g. by a 7V Z-diode.

It should be stressed though that 5V tolerance as _input_ does not imply 5V tolerance as _output_! That is a whole different question, and a very good reason to not omit the resistor.

Now, it may be the there are several different Pi versions with different input protection circuits out there. Therefore I would ask you to verify the presence of an upper protection diode on yours, and if it indeed has one, we can try to find out what is going on here.

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 4:33 pm

As to the question why the FET-based level-shifter work: That is a bit advanced. I suggest reading the original application note by Phillips (now NPX), mirrored here: http://www.adafruit.com/datasheets/an97055.pdf

After that, run through all 4 cases in your mind, with the other side just having the pull-up active. For example, side A powered by 5V, side B is powered by 3.3V and then
  • * A is L
    * A is H
    * B is L
    * B is H
Do not forget that the FETs have bypass-diodes between S and D for reverse voltage!

You will find that each case works as expected, even if the "why" is a bit convoluted. Or to put it differently, having this idea is on genius-level and I bow to the engineer that came up with it!

User avatar
jojopi
Posts: 3000
Joined: Tue Oct 11, 2011 8:38 pm

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 5:43 pm

awagner wrote:I completely agree to your analysis for the case that there is an upper protection diode. (Except that 1.2mA is not something that will overload a protection diode. They are also protection against crosstalk and typically can tolerate 10-20mA permanently.)
Gert has said that the ESD protection on the BCM2835 is not rated for any continuous current: http://www.raspberrypi.org/phpBB3/viewt ... 47#p126547

(I do not accept his calculations in that post, however. ½CV² is 0.11mJ, not mW, and 0.7mA at 0.3V is 0.21mJ/s. So I would calculate that the diode should handle 0.7mA for 0.5s. After that you would need to consider the thermal characteristics.)
Now, it may be the there are several different Pi versions with different input protection circuits out there. Therefore I would ask you to verify the presence of an upper protection diode on yours, and if it indeed has one, we can try to find out what is going on here.
It seems unlikely that Broadcom will have re-spun the chip unless they absolutely had to. At modern feature sizes, masks are very expensive.

When I pull an input GPIO to 5V with a 10M resistor it clamps at ~3.43V. Are you sure you have not vaporised your protection diodes?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9606
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 6:21 pm

awagner wrote: But the fact of the matter is that _my_ Pi does not have an upper protection diode. I tried to verify that it has (very easy test for presence of a diode) and failed. What _my_ Pi has is a clamping circuit that clamps at around 6.5...7V (100uA input current at 6.5V, as detailed on http://www.tansi.org/rp/interfacing5v.html), regardless of whether the Pi is powered or not. That is consistent with the standard protection on a 5V tolerant 3.3V logic input, implemented, e.g. by a 7V Z-diode.
No, according to Gert van Loo, all GPIO's have upper and lower protection diodes, the only exception being the the GPIO's dedicated to the I2C bus of the HDMI port, which are special, see http://www.raspberrypi.org/phpBB3/viewt ... 47#p126547

gert is the only one here who has the definite answer.

User avatar
jojopi
Posts: 3000
Joined: Tue Oct 11, 2011 8:38 pm

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 10:14 pm

awagner wrote:and the additional ones on http://www.tansi.org/rp/gpio_startup.html
There is a misunderstanding here as well. The weak pulls are retained over a reset, and while the core is asleep. They are not retained when all power is absent.

You can easily test this by setting a pattern of pulls and then disconnecting the power. While the power is off, remove the SD card to eliminate any software. When power is reconnected, all the pulls are in the power-on states given in Table 6-31 of the datasheet. (Note that GPIO28/29 are the only two with pulls disabled, so it is quite correct that they are floating, or may appear to have a very high impedance pull to centre.)

Conclusion: the pull states are held in static but volatile latches, not E²PROM, and there is no concern about changing them too often.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Logic Level Converter: Why is this circuit working?

Mon Dec 16, 2013 10:31 pm

@jojopi & @mahjongg
Thanks for very valuable responses in this thread (if there is anything else related to be said, I'd be glad to read additional information) ;-)

Best wishes, Ivan.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Tue Dec 17, 2013 8:46 am

@jojopi:
Several points.

1) I assume you connected your digital multimeter between 5V and a Pi output. That is not a test for a protection diode. 10M is far to high, that could be any kind of leakage. Repeat with 10k or 3K3 and you get a real test. (No, you will not blow the diodes. They are an integrated part of the output MOSFET and can typically stand the same current as that FET.) Just to be sure, here is a result for a test on a _bottom_ protection diode (I still do not find any upper ones with the Pi unpowered, and they need to protect the inputs against ESD when there is no power as well, of course. I will do more tests later, no time now.):
- Diode test voltage after 1s at 1mA: 0.571V
- Diode test voltage after 60s at 1mA: 0.571V
- Diode test voltage after 10min at 1mA: 0.571V
=> There is no thermal run-away or change at all! Diodes change their conducting voltage at around 2mV/C (well established fact that is frequently used to employ them as thermal sensor). This diode is not heating up at all at 1mA! As expected.

2) And now it gets heretical: Is this Gert person maybe a physicist? A physicist with little clue about electronics may assume the protection diodes are only for ESD (They are not. They are also for crosstalk.) and are thermally isolated. A physicist would then come up with said calculation for the energy they could stand in a non-repetitive fashion from the ESD rating. While the physics is correct, the assumptions are completely disconnected from reality. Of course, protection diodes are not thermally isolated, that would cost extra effort and would be exceedingly stupid design. For outputs, protection diodes are an integrated feature of the output driver FETs and share their cooling. Hence they are routinely rated at the same or more continuous current than the outputs. (Example: http://www.nxp.com/documents/data_sheet/74HC_HCT00.pdf , Table 4, I_IK, I_OK and remark [1]). For inputs, you use the same circuit and just leave the gates of the driver transistors isolated. It saves design effort. For bi-directional pins (like the Pi uses), the output protection diodes just serve as input protection diodes as well. If they are present.

3) Now it gets even more heretical: The redacting of the data-sheets and the fact that really critical information is missing, such as the description of the protection circuit and the number of times you can change the pull-up settings (see http://www.tansi.org/rp/gpio_startup.html) indicated to me that whoever redacted these data-sheets does not understand what they are doing. I/O macro-cell characteristics are not any special Intellectual Property. The design of these things is _old_. I can only assume the person doing the redacting did not ask to be allowed to release that info. Now, if the person doing the redacting is Gert, I have to assume selective incompetence, in line with what I describe in 2) above. Also in line with somebody that does not really understand Electronics, but does understand Physics.

Seriously, I/O characteristics are both critical for designing with a circuit and are not a trade-secret, as you can just measure them. As I did. Only the absolute maximum ratings are difficult to measure, but a competitor would be equipped to do so and would (unlike me) have no qualms doing destructive tests.

Edit: I take it back about Gert possibly being a physicist. His calculation is totally borked. Also, his statement "I think we tested the device up to 1500V" is likely nonsense, as ESD testing requires very specific equipment and expertise (You shock the circuit and then you measure its characteristics extremely carefully in comparison to before and look at it with an electron-microscope to see whether anything blew. In addition you may want to do accelerated aging for a few months and then measure again. ESD damage can be very tricky to detect.) likely not available to the Pi foundation. ESD testing is done by the manufacturer and it is done for the I/O macro-cell in the specific manufacturing process, not usually for a specific circuit. That is another reason why I/O macro-cells are pretty much standardized.

Edit2: Here is a reference as to how the diode gets into the MOSFET: http://en.wikipedia.org/wiki/Power_MOSFET#Body_diode
These are (mis-) used as protection diodes in digital CMOS output driver stages and can take the same current as the output driver transistor.
Last edited by awagner on Tue Dec 17, 2013 10:36 am, edited 2 times in total.

awagner
Posts: 14
Joined: Mon Dec 16, 2013 7:55 am

Re: Logic Level Converter: Why is this circuit working?

Tue Dec 17, 2013 10:14 am

As to pullup-state:

This is not a "misunderstanding", it is a measurement. i.e., an observation. I did remove the power for the tests. It is possible these are indeed latches and that the latches have a very low holding voltage or are powered for some additional time by some internal capacitor. Will run tests again with the power off for a day instead of just briefly.

Return to “Troubleshooting”

Who is online

Users browsing this forum: No registered users and 45 guests