Searching \ for '[EE]:: Body diode conduction insanity' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=body+diode+conduction
Search entire site for: ': Body diode conduction insanity'.

Exact match. Not showing close matches.
PICList Thread
'[EE]:: Body diode conduction insanity'
2012\01\26@084124 by RussellMc

face picon face
Evil AVR app note that uses microcontroller body diodes to zero cross
detect  mains.
Insanity writ large.

     http://www.atmel.com/dyn/resources/prod_documents/doc2508.pdf

The AVR IC designers must tear their hair out when their app note
writers commit such lunacy.
They effectively use 2 megohm input resistance (although they are not
obviously aware of this from in-text comments).
Diode currents of around +/- 240 x 1.414 / 2 m =~ 150 uA+ can be expected..
Well above the "microamp range" that Microchip recommend in their not
quite as bad but still stupid foray in figs 10-1 and 10-2 here.

     http://ww1.microchip.com/downloads/en/DeviceDoc/chapter%208.pdf


   Russell McMahon

_____________________

Copy and paste from my stack exchange rant here

 http://electronics.stackexchange.com/questions/25691/measuring-frequency-of-a-signal-above-5v-with-a-microcontroller

PROTECTION DIODES:

Many people are unaware of or just ignore the datasheet distinction
between "Absolute maximum" ratings and recommended operating
conditions.

Absolute maximum ratings are those which the device is guaranteed to
survive without damage. Correct operation is not guaranteed.

The PIC concerned allows Vdd + 0.3V on its pins as an absolute maximum
rating. Operation is not guaranteed during this condition.

Most data sheets clearly specify that during normal operation input
voltages should not exceed the ground to Vdd range. This datasheet may
or may not ro so in its several hundred pages. It is still wrong to do
so.

Many people have thought that concerns about protection diode currents
are baseless. Only some of them have rued the day they thought so and
most have probably lived to rue it or not :-).

Note that the (evil) Atmel application note here uses a 1 megohm
resistor (connected to AC mains ! ) and the Microchip app note here -
figs 10-1 10-2 at least has the grace to say " ... The current through
the clamp diodes should be kept small (in the micro amp range). If the
current through the clamping diodes gets too large, then you risk the
part latching up." Atmels hundreds of uA is NOT "inh the microamp
range".

BUT latch up is the least of your problems. IF you latchup the part
(SCR action triggered by currents into IC substrate) the IC often
turns into a smoking ruin and you realise that something may possibly
be wrong.

The problem with body diode currents is when you do NOT get an
immediate smoking ruin. What happens is that the IC was never designed
to accept current between input pin and substrate - the layer hat the
IC is laid down on. When you raise Vin > Vdd the current effectively
flows out of the ICV proper into a phantom fairyland that the iC is
unaware of and that the designer did not and usually cannot design
for. Once there you have small potential;s set up that are never
normally there and current can flow back into adjacent circuit modes,
of not quite adjacent nodes or even into locations some distance away
depending on how big the currents are and what voltages are set up.
The reason this is hard to describe and pin down is because it is
totally undesigned and essentially undesignable. One effect is to
iject currents into floating nodes that have no formal output path.
Thse may act as gates for FETs - formal or accidental ones, that tuirn
on or off semirandom parts of your circuit. Which parts ? When? How
often? How long? How hard? Answer - who can tell / nobody can tell -
its undesigned an undesignable.

Q: Does this actually happen? A: Oh yes! Q: Have I seen it happen? A: Yes.

I started what has now proved to be a 1+ decade crusade to make people
aware of this (even though I should have been well aware of it) after
being very badly bitten by it.
I had a relatively simple async serial circuit that caused me no end
of strife. Processor operation was intermittent or semi random. Code
faulted sometimes and not other times. Nothing was stable. The
problem? Body diode conduction, of course. I had copied a simple
circuit from an application note supplied with a product and away we
went.

If you do this without due care it WILL bite you.
If you do it with care and intelligence and design it may well not
bite you. But may.
This is akin to pulling over the centre line into ongoing traffic to
overtake - done with care and not too often and leaving what may be
good enough margins you will usually not die. If you do you will
probably not be surprised :-). So it is with body diode conduction.
Microchips 'microamp range" may be OK. Atmel's 1 megohm off mains is
an accident waiting to happen. Suit yourself

2012\01\26@110148 by Byron Jeff

flavicon
face
Russell,

We've had this discussion before and for two current projects (cheap serial
interface, mains frequency clock) it's back on plate. My question is there
any correct way to do this with junkbox parts?

After digging around a bit I had settled on Olin's suggestion in this
thread for a +/- 12V input:

http://www.microchip.com/forums/m154654-print.aspx

that consist of a 10k series resistor, two 1N4148 external clamping diodes,
followed by a 1K series resistor to the input. The 10K serves as a current
limiter to the two external diodes, while the 1K is added protection to
current limit the difference voltage between the external 1N4148's and the
internal protection diodes. In effect even if the internal diodes conduct
first with something like a 100 mV difference, that the maximum current
they would be exposed to is 100 uA through the 1K.

Short of using Schottky diodes for the external diode, in order to
guarantee they conduct first, what else can be done?

BAJ


On Fri, Jan 27, 2012 at 02:40:42AM +1300, RussellMc wrote:
{Quote hidden}

> -

2012\01\26@115355 by alan.b.pearce

face picon face
> Short of using Schottky diodes for the external diode, in order to guarantee they
> conduct first, what else can be done?

For the cost of another couple of diodes, a resistor, and slightly more current draw, the clamp diodes could have their own power supply, with the two diodes forward biased, and the resistor between them.

i.e.
Vcc
Forward biased diode
Clamp voltage going to top protection diode
Resistor (10k or so?)
Clamp voltage to bottom protection diode
Forward biased diode
GND


-- Scanned by iCritical.

2012\01\26@125002 by Byron Jeff

flavicon
face

On Thu, Jan 26, 2012 at 04:53:45PM +0000, spam_OUTalan.b.pearceTakeThisOuTspamstfc.ac.uk wrote:
> > Short of using Schottky diodes for the external diode, in order to guarantee they
> > conduct first, what else can be done?
>
> For the cost of another couple of diodes, a resistor, and slightly more current draw, the clamp diodes could have their own power supply, with the two diodes forward biased, and the resistor between them.
>
> i.e.
> Vcc
> Forward biased diode
> Clamp voltage going to top protection diode
> Resistor (10k or so?)
> Clamp voltage to bottom protection diode
> Forward biased diode
> GND

So by doubling the diodes, it guarantees conduction within the power supply
range instead of allowing the input voltage to wander outside the rails.

I take it the resistor is still a series resistor between the unknown
voltage and the doubled diode pairs?

Looks like a safe bet for a nickels more worth of diodes.

BAJ

>
>
> --
> Scanned by iCritical.
>
> -

2012\01\26@130218 by Dave Tweed

face
flavicon
face
Byron Jeff wrote:
> Short of using Schottky diodes for the external diode, in order to
> guarantee they conduct first, what else can be done?

Use a transistor already!

Take a jellybean NPN transistor, and connect a diode antiparallel across its
B-E junction (A to E, K to B). Connect the E to ground. Now B can't go more
than +/- 0.7V away from ground.

Connect as large a resistor as needed between the source voltage and B. For
example, suppose you want to allow a current of 1 mA at an input voltage of
+/- 300V, which would make the resistor 300k (make sure it can handle the
voltage and power). This still leaves plenty of current to drive the
transistor near the zero-crossing, i.e., 10 uA @ 3V.

Connect the C to the MCU input, using an external pullup if necessary.

-- Dave Twee

2012\01\26@133051 by Michael Rigby-Jones

flavicon
face
part 1 2615 bytes content-type:text/plain; charset="us-ascii" (decoded quoted-printable)



{Quote hidden}

This may not be a very "stiff" clamp though.  Normally biasing the upper protection diode will push current into the Vdd rail, and biasing the lower pushes current into the Vss rail.  With the above scheme, this can't happen, all the clamp current has to go to the opposite rail via the biasing resistor.  Once the clamp current exceeds the bias current through the resistor, your clamp isn't clamping anything.  Reducing the resistor value obviously helps, with the cost of increased quiescent current.

The scheme could be extended by adding a couple of bipolar transistors to make an active clamp.  This gives near enough perfect clamping but the parts count starts to increase pretty quickly.  Quiescent current may be a problem if the "diodes" (i.e. BE junction of the transistors Q3, Q4 in attached diagram) and pass transistors are not matched and in good thermal contact.
Daves suggestion is fine for a logic input, but very often you want to clamp an analog signal going into e.g. an ADC input.

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

part 2 30475 bytes content-type:image/png; name="transistor_clamp2.png" (decode)


part 3 181 bytes content-type:text/plain; name="ATT00001.txt"
(decoded base64)

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2012\01\26@151121 by cdb

flavicon
face
::Diode currents of around +/- 240 x 1.414 / 2 m =~ 150 uA+ can be ::expected.Well above the "microamp range"
Perhaps they were only considering US voltage levels of 110-120?

I haven't looked at the specs for an ATMEGA, but on page 7 of the referenced PDF they state the maximum current into a pin is 1mA. If that is the case, then technically they are correct in their assertion 85 - 160uA is in the microamp range.

Colin
--
cdb, colinspamspam_OUTbtech-online.co.uk on 27/01/2012
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 This email is to be considered private if addressed to a named  individual or Personnel Department, and public if addressed to a blog,  forum or news article.

2012\01\26@165505 by Byron Jeff

flavicon
face
On Thu, Jan 26, 2012 at 01:02:18PM -0500, Dave Tweed wrote:
> Byron Jeff wrote:
> > Short of using Schottky diodes for the external diode, in order to
> > guarantee they conduct first, what else can be done?
>
> Use a transistor already!
>
> Take a jellybean NPN transistor, and connect a diode antiparallel across its
> B-E junction (A to E, K to B). Connect the E to ground. Now B can't go more
> than +/- 0.7V away from ground.
>
> Connect as large a resistor as needed between the source voltage and B. For
> example, suppose you want to allow a current of 1 mA at an input voltage of
> +/- 300V, which would make the resistor 300k (make sure it can handle the
> voltage and power). This still leaves plenty of current to drive the
> transistor near the zero-crossing, i.e., 10 uA @ 3V.
>
> Connect the C to the MCU input, using an external pullup if necessary.

Actually I did that and it changed the timing on the pin. When I changed
out the signal diode with a zener, the timing reverted back to its normal
behavior.

BAJ

>
> -- Dave Tweed
> -

2012\01\31@141900 by Peter P.

picon face
Byron Jeff <byronjeff <at> mail.clayton.edu> writes:

> On Thu, Jan 26, 2012 at 04:53:45PM +0000, alan.b.pearce <at> stfc.ac.uk wrote:
> > > Short of using Schottky diodes for the external diode, in order to
guarantee they
> > > conduct first, what else can be done?

Please see the thread and 1st message therein:

http://thread.gmane.org/gmane.comp.hardware.microcontrollers.pic/114966/focus=114974

(paste all on one line - sorry I have no control over posting format)

-- Peter


'[EE]:: Body diode conduction insanity'
2012\02\02@024005 by Peter P.
picon face
Byron Jeff <byronjeff <at> mail.clayton.edu> writes:

> > Dave Tweed wrote:
> > Use a transistor already!
>
> Actually I did that and it changed the timing on the pin. When I changed
> out the signal diode with a zener, the timing reverted back to its normal
> behavior.

Miller effect says hello. The transistor used for this needs to be very small
Ccb, usually a rf type. The clamp I proposed (years ago) and linked in this
thread, does not have this problem as it is a common base circuit (very fast
too). TAINTSTAAFL. I wonder how long it will take for the semiconductor makers
to start implementing CMOS active clamps in the input pin internal silicon
structures proper. Microchip certainly has stringent body diode leakage
requirements which other makers (Atmel) do not have. Atmel mcu's have 10 bit
adcs and do not exhibit anything anywhere near the problems seen with Microchip
body diode currents. I admit to be a defector to the Atmel side for now :)

-- Peter

2012\02\11@154735 by Peter

picon face
Somehow a message linking to the solution disappeared from this thread. This is
the archived message which contains said solution, again. If admins wish to
remove this message too, please contact me privately by email.

http://article.gmane.org/gmane.comp.hardware.microcontrollers.pic/114966

The entire thread this is in, is germane to the discussion of clamp diodes on
pic and other microprocessors.

-- Peter

2012\02\11@214624 by RussellMc

face picon face
part 1 632 bytes content-type:text/plain; charset="iso-8859-1" (decoded quoted-printable)

Rushing ...

Your solution

   http://article.gmane.org/gmane.comp.hardware.microcontrollers.pic/114966

looks excellent functionally.

Higher parts count than desirable but that's life.

Admins have no ability whatsoever (as far as i know to influence posts
once ppsted AND Nabble will have posts which are beyond reach etc).

On past occasions when people have said that posts have vanished it
has usually proved to be Murphy pushing some form of complex
misunderstanding.

Slightly lower quality copy attached so people can see actual circuit
without following link.



   Russell


part 2 18404 bytes content-type:image/jpeg; name="Peter_P_Clamp_75.jpg" (decode)


part 3 181 bytes content-type:text/plain; name="ATT00001.txt"
(decoded base64)

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...