Body diode conduction insanity

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Body diode conduction insanity

RussellMc
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.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Byron Jeff-2
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:

> 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.
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist

--
Byron A. Jeff
Department Chair: IT/CS/CNET
College of Information and Mathematical Sciences
Clayton State University
http://cims.clayton.edu/bjeff
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

RE: Body diode conduction insanity

Alan Pearce - UKRI STFC
> 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.

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Byron Jeff-2

On Thu, Jan 26, 2012 at 04:53:45PM +0000, [hidden email] 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.
>
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist

--
Byron A. Jeff
Department Chair: IT/CS/CNET
College of Information and Mathematical Sciences
Clayton State University
http://cims.clayton.edu/bjeff
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Dave Tweed
In reply to this post by Byron Jeff-2
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 Tweed
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

RE: Body diode conduction insanity

Michael Rigby-Jones-2
In reply to this post by Alan Pearce - UKRI STFC


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of [hidden email]
> Sent: 26 January 2012 16:54
> To: [hidden email]
> Subject: RE: [EE]:: Body diode conduction insanity
>
> > 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
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.
=======================================================================
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

transistor_clamp2.png (40K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

CDB-3
In reply to this post by RussellMc
::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, [hidden email] on 27/01/2012
 
Web presence: www.btech-online.co.uk  
 
Hosted by:  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.
 
 
 

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Byron Jeff-2
In reply to this post by Dave Tweed
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
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist

--
Byron A. Jeff
Department Chair: IT/CS/CNET
College of Information and Mathematical Sciences
Clayton State University
http://cims.clayton.edu/bjeff
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Peter P.
In reply to this post by Byron Jeff-2
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

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Peter P.
In reply to this post by Byron Jeff-2
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

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

Peter P.
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


--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: Body diode conduction insanity

RussellMc
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

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

Peter_P_Clamp_75.jpg (24K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[EE]:: Body diode conduction insanity

RussellMc
In reply to this post by RussellMc
Repost of a 2012 rant re not using body diodes as "protection" against
overvoltage on device pins.
Seems as worth reading now as it was then.
How worthwhile that is I leave to the individual (except those who argue
strenuously against the argument).

 Russell

From: RussellMc <[hidden email]>
Date: Fri, 27 Jan 2012 at 02:40
Subject: [EE]:: Body diode conduction insanity
To: Microcontroller discussion list - Public. <[hidden email]>




*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 "in 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
inject currents into floating nodes that have no formal output path.
These may act as gates for FETs - formal or accidental ones, that turn
on or off semi-random 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. Or not.
Atmel's 1 megohm off mains is an accident waiting to happen.
Suit yourself.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [EE]:: Body diode conduction insanity

madscientistatlarge
One of the things I wish I'd known long ago, application notes are sometimes insane, and frequently just wrong.  Turns out you can not take spec sheets or application notes as absolutely correct.  Humans make mistakes, and it turns out that technical writers and engineers are human, in good ways and bad ways.  There are a lot of bad practices, some of them common, that may work fine (or appear to work fine, at least initially) some of the time, more or less.

The problem is that you have to read a lot (and experiment a lot), and think a lot to spot them, and realize that no human source is definitively accurate all of the time.  As you learn more, you also have to revisit your' own assumptions and mistakes, and you have to admit them to yourself to learn.  Especially when it makes you realize what dumb things you did before you knew better.  You also have to realize that things are always more complicated than the "ideal" case.  You have to realize that no design is perfect.  You have to realize that those simplifying assumptions of how things work only go so far.  It's like when you start learning about higher frequencies and realizing that there really are no true, perfect "lumped" parts.  It's part of why DSP can do things analog signal processing can't, because it puts things in the abstract and perfect world of mathematics as opposed to the realities of the physical world.

I've learned a lot by revisiting old decisions that were wrong when I later learned more or just reexamined why a solution didn't work or work well.

The other thing to know is a lot of smart people are not great communicators.  I've read several technical books by people who clearly knew what they were doing but were terrible at transferring that knowledge or explaining.  The problem being that you have to try and figure out what the author meant, and how it should have been phrased.  Of course you also have to dig sometimes to see if you or the author got it wrong, and you have to be able to blame yourself when you are wrong.  Many people are not good at admitting even to themselves when they've made mistakes.  Often we fail to consider all the implications of a design decision, and time pressure aggravates this.  First approximation is just that, i.e. a rough idea.  Often failing to look at all the details initially leads to huge errors.  Learn from the mistakes of others, and your' own, and know you will make more.  It's better to look in depth at a solution before you make the product than after you've alienated customers and possibly made yourself look foolish.  We are all fools, at least some of the time.  Having someone else look at your' design briefly can be priceless.

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, February 26, 2020 4:56 PM, RussellMc <[hidden email]> wrote:

> Repost of a 2012 rant re not using body diodes as "protection" against
> overvoltage on device pins.
> Seems as worth reading now as it was then.
> How worthwhile that is I leave to the individual (except those who argue
> strenuously against the argument).
>
> Russell
>
> From: RussellMc [hidden email]
> Date: Fri, 27 Jan 2012 at 02:40
> Subject: [EE]:: Body diode conduction insanity
> To: Microcontroller discussion list - Public. [hidden email]
>
> 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 8.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 "in 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
> inject currents into floating nodes that have no formal output path.
> These may act as gates for FETs - formal or accidental ones, that turn
> on or off semi-random 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. Or not.
> Atmel's 1 megohm off mains is an accident waiting to happen.
> Suit yourself.
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist



--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [EE]:: Body diode conduction insanity

madscientistatlarge
In reply to this post by RussellMc

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, February 26, 2020 4:56 PM, RussellMc <[hidden email]> wrote:

> Repost of a 2012 rant re not using body diodes as "protection" against
> overvoltage on device pins.
> Seems as worth reading now as it was then.
> How worthwhile that is I leave to the individual (except those who argue
> strenuously against the argument).
>
> Russell
>
> From: RussellMc [hidden email]
> Date: Fri, 27 Jan 2012 at 02:40
> Subject: [EE]:: Body diode conduction insanity
> To: Microcontroller discussion list - Public. [hidden email]
>
> 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 8.pdf
-------------------------------

<http://www.atmel.com/dyn/resources/prod_documents/doc2508.pdf> is a broken link, hopefully they deliberately removed the bad application note.

For <http://ww1.microchip.com/downloads/en/DeviceDoc/chapter 8.pdf>, Could you tell us the major bad ideas, for our education?

It's also important to read and think about all of the specs, in some detail.  For instance, something I've seen is the use of a fast op amp in a fairly low frequency circuit.  Often in this case people fail to realize that they still have to consider higher frequency effects even when the circuit in question doesn't see higher frequency signals (or shouldn't).  You still have to consider the parasitics and oscillation, and noise issues produced by the high frequency response that you don't need, including power supply decoupling.  In other words, think about what the parts can do beyond what you need them to do.  That's what hacking is about, considering non-ideal performance, and the things others didn't work out.  It's also what makes list like this so useful.  It's also why it's important to study and understand circuits that don't work, and why.  I love it when a book etc. shows you bad ideas and explains why they are bad, and why they may not work at all.  The classic is failing to provide a dc current path to an opamp input.  I.E., if you capacitively couple the inputs on an op amp, there are still bias currents that have to go somewhere, and you'd better provide a path for them.

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

RE: [EE]:: Body diode conduction insanity

David Van Horn
In reply to this post by RussellMc
Yes, that app note was horrible.

I've seen similar with Astron power supplies that are basically straight out of the NS linear data book.  Not bad, but they have issues with RF where the crowbar can get triggered.  They are very popular with hams.

A friend of mine used an Astron in parallel with a deep cycle battery on field day, and was very surprised when the wires between the battery and the power supply ignited.
He had tweaked the output to 13.8 or 14V, I forget exactly, to charge the battery, but the crowbar was still at 15.  The Astron has an input fuse, but nothing on the output side.

When the RF from the transmitter pushed the crowbar into trip, everything got exciting.


--
David VanHorn
Lead Hardware Engineer

Backcountry Access, Inc.
2820 Wilderness Pl, Unit H
Boulder, CO  80301 USA
phone: 303-417-1345  x110
email: [hidden email] 


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