Searching \ for 'It's official: The Real-World Serial FAQ' 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/io/serials.htm?key=serial
Search entire site for: 'It's official: The Real-World Serial FAQ'.

Truncated match.
PICList Thread
'It's official: The Real-World Serial FAQ'
2002\10\10@162940 by Matt Heck

flavicon
face
Okay, I'll bite:

I've gotten more than enough help and feedback to start putting a document
together.  I'll start pasting everything we've got so far into some kind
of rough draft this weekend.  The working name so far is: "The Real-World
Serial FAQ", and I intend it to be something for people working on quick
or simple serial communications with a PC or similar device to use to help
them avoid mistakes.

When there is a differrence between the "classic specs" and the real
world, I will try to list both, but the real world will win.

I have a few details to clean up with my hosting company, so it will take
me a bit to get the draft up on the web, but I should have a spot for it.

So, if anybody has questions or suggestions, and they would rather send
them to me directly instead of clogging the PICList (though personally
I'll read both), you may mail me directly at:

m.heck @ crystalengineering.net

I'm scheduling the first "deliverable" draft for 01JAN2003; beta versions
to float around until then.

This should be interesting. =]

Cheers,
  Matt

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\10\10@205646 by Russell McMahon

face
flavicon
face
>> I've gotten more than enough help and feedback to start putting a
document
together.  ...........
/>>

Add  ***NEVER**** use direct RS232 input into a microprocessor pin via  a
resistor and assume that the processor protection diodes will clamp the
voltage swing adequately. In such cases you must ALWAYS ensure that the
voltage never swings outside the processor supply range (or, where
specified, the maximum limits specified by the manufacturer for NORMAL (not
absolute maximum) operation.).



       RM

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\10\10@210102 by Matt Heck

flavicon
face
Yup, we use a serial level converter chip to avoid this.
Helps with a couple of safety ratings, too, as I recall.
Optoisolators are nice, if you have a good way to power
both sides, especially if you want an intrinsic safety
rating.  Of course, if you try to power that optoisolator
off the flow-control lines, you can get OTHER problems...
such as finding devices that don't let you switch those
pins manually for power-sourcing purposes.  We get so
spoiled on these PCs. =]

  --Matt

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\10\11@051216 by mike

flavicon
face
On Thu, 10 Oct 2002 18:00:38 -0700, you wrote:

>Yup, we use a serial level converter chip to avoid this.
>Helps with a couple of safety ratings, too, as I recall.
>Optoisolators are nice, if you have a good way to power
>both sides, especially if you want an intrinsic safety
>rating.  Of course, if you try to power that optoisolator
>off the flow-control lines, you can get OTHER problems...
>such as finding devices that don't let you switch those
>pins manually for power-sourcing purposes.  We get so
>spoiled on these PCs. =]
>
>   --Matt
>
>> Add  ***NEVER**** use direct RS232 input into a
>> microprocessor pin via a resistor and assume that the
>> processor protection diodes will clamp the voltage
>> swing adequately. In such cases you must ALWAYS ensure
>> that the voltage never swings outside the processor
>> supply range (or, where specified, the maximum limits
>> specified by the manufacturer for NORMAL (not absolute
>> maximum) operation.).
Nonsense. The input clamp diodes ensure that the input voltage is not
exceeded, as long as the series resistor limits the current within
spec.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\11@055134 by Wouter van Ooijen

face picon face
> Add  ***NEVER**** use direct RS232 input into a
> microprocessor pin

Or rather (because otherwise the 'I have done this, it works' folks will
complain): when you do this be aware that you a in the wild wild
out-of-spec country where you can not assume that any of the Microchip
laws (as laid down in the datasheets) will hold.

And just to be complete: you are in the same wild wild country when you
violate any of the 'normal operating' specifications (including maximum
operating frequency!). And the 'abolsute maxima' sections are *not*
normal operating conditions!

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\11@085056 by Russell McMahon

face
flavicon
face
I affirm again -

>>  ......  ***NEVER**** use direct RS232 input into a
>> microprocessor pin via a resistor and assume that the
>> processor protection diodes will clamp the voltage
>> swing adequately. In such cases you must ALWAYS ensure
>> that the voltage never swings outside the processor
>> supply range (or, where specified, the maximum limits
>> specified by the manufacturer for NORMAL (not absolute
>> maximum) operation.).

> Nonsense. The input clamp diodes ensure that the input voltage is
> not exceeded, as long as the series resistor limits the current within
> spec.

Here we go again :-)
This is a regular topic and one debated with religious fervour.
Look in archive for why it is as I say above.
I assure you that I am correct and that great sorrow shall fall upon the
head of  those who disregard this warning.
Maybe something along these lines should also be in a FAQ ?

I have attached a long explanation that I recently sent to another list.
I will also give a short explanation here.
Ignore or disbelieve this at your peril:

- Microcontrollers have TWO sections in the spec sheets. "Absolute Maximum"
ratings and "typical operating conditions".
This also applies to essentially ALL other ICs you will ever see.

- The absolute maximum specs are those beyond which the device may be
destroyed or permanently damaged. Correct operation at these specs (or near
them) is NOT GUARANTEED - all that is guaranteed is non-destruction if you
don't exceed them.

- The typical specs are always contained within the range of the absolute
maximum specs.

- The specifications which cover operation of the clamping diodes and how
much current they can pass and the permissible voltage by which pins can
exceed Vcc with the clamping diodes conducting are **ALWAYS** in the
"absolute maximum" section of the spec sheet. Proper operation of the
processor is NOT guaranteed when the clamping diodes are conducting.
[[[It would in fact be possible for a manufacturer to provide input
protection diodes that could conduct safely during normal operation but
overwhelmingly this is not done. There may indeed be devices where this is
done but I am not personally aware of any]]].

- Typical; operation  conditions are set such that the clamping diodes NEVER
conduct (except, to quibble,  at essentially leakage current levels).

- The reason that clamping diodes must NEVER be allowed to conduct during
normal operation is that current which flows through them enters the IC at
points where such currents are not usually expected and can (and does) bias
on or off various parts of the IC in totally undefined ways. This can and
does happen but in any given situation you MAY get away with it. Something
which works on one occasion may misbehave on another. YMWV. Expect your
processor to possibly do anything it is capable of doing under these
conditions (and a few things it is incapable of as well).

*** Competent designers always ensure that during normal operation their
designs ALWAYS meet specifications in the typical operating conditions
section of the spec sheet. A design in which the body / protection diodes
conduct during normal operation is an incompetent design and bad engineering
and will bring sorrow upon the heads of its perpetrator.

Using protection diodes to clamp pin excursions under certain conditions can
be acceptable as long as abnormal circuit operation of any possible nature
is acceptable during these conditions. (eg a 1 megohm resistor of suitable
ratings between an input and a pin may allow full 230 VAC mains to be
temporarily applied to the input. Correct processor operation during such an
incident would not be guaranteed.

Now to spoil the warning:        Experience and a good understanding of
electronic principles MAY allow you to violate the above requirements in
marginally minor ways with a reasonable expectation of success. Proper
operation under such conditions is not guaranteed. (Example: split the input
resistor into 2 series resistors and clamp the middle to Vcc with a small si
gnal silicon diode such as 1N4148). This nominally violates many pin input
typical operation specs but  USUALLY works OK in practice. If you understand
why it usually does work and why it mightn't then you can decide whether
it's OK to do it in your application.

That wasn't that short, was it :-) ?


   regards

           Russell McMahon "M., for what it's worth, E. (elec)"
           (The N years experience is worth rather more :-) )

PS: Starting a reply with "Nonsense." is probably inadvisable (unless you
are Olin who is so competent that he can almost always get away with it
:-) )

___________

> I want to measure a 12 V pulse with the MSP430 direct. A simple way by
> other  Controllers  like  PIC's is to take only a resistor which limit
> the  current  to  the  protection  diodes inside the chip. But are the
> MSP320  Inputports protected against over voltage ? What is the maximum
> allowed current ? How I can find it in the datasheets ?

A better solution is to supply the input voltage via a resistor and clamp
the pin to ground with an a zener diode slightly less than Vdd (eg 4v7 when
using a 5v Vdd supply).
(cathode to pin, anode to ground)

OR

Again use a series resistor and clamp the pin to supply with a SCHOTTKY
diode eg BAT85.
(Anode to pin, Cathode to Vdd). This clamps the pin at a level below which
the protection diode starts to conduct (because the Schottky diode conducts
at a lower forward voltage than the internal silicon diode).

*** You should NOT use the internal diodes for pin clamping
*** during normal operation BECAUSE -

Using the input protection diodes to limit pin voltage during normal
operation is asking for major and ill defined problems.
This is certainly true for PICs and will also be true for almost all other
processors as well.

A *careful* reading of the PIC datasheets will reveal that the spec for pin
voltages outside supply rails is in the "absolute maximum ratings" section
and NOT in the "normal operation" section. ie the processor will survive but
is NOT guaranteed to operate properly. As noted in another reply, the
relevant data for the MSP430 is also in the "absolute maximum ratings"
section.

MANY people use the protection diodes in this manner and have (or appear to
have) no problems. But unpredictable operation can occur at any time and
sometimes does. I have personally seen semi-random processor glitching when
this is done with a PIC.

The problems occur because, unless specifically designed for this not to
happen, the current in the protection diodes flows in relatively arbitrary
parts of the IC and may bias junctions on or off in abnormal ways. When this
occurs, anything that can happen may happen and sometimes does.

Whenever this topic comes up on other lists people almost invariably
enthusiastically (attempt
to) rebut the above FACTS and claim that it is OK to use protection diodes
to limit pin voltages during normal operation. Before agreeing with them
respondents should carefully check the data sheets for their favourite
processor and see which section the "pin voltage outside supply voltage
range" spec occurs. It is possible for manufacturers to provide a system
whereby the clamp diodes did not reverse bias the intrinsic substrate diodes
in the IC or cause similar problems but few if any do this as it could incur
substantial extra cost and the requirement is better addressed by proper
circuit design.



           Russell McMahon

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\11@093334 by mike

flavicon
face
On Sat, 12 Oct 2002 02:50:02 +1300, you wrote:

{Quote hidden}

There is no 'Right' answer, only the most appropriate solution for a
given situation. Stating that you are 'correct' implies that this is
the case for absolutely all applications, which is clearly nonsense.
For example, in a product where absolute minimum cost and/or size,
inclusion of components which are not absolutely necessary (as shown
by past experience and testing) is 'incorrect'.

{Quote hidden}

The fact that at least one Microchip apnote shows the clamp diodes
being used in normal operation indicates that they are not actively
discouraging people from doing it - the implication is that they are
confirming that it  will not cause problems in practice.

>- The reason that clamping diodes must NEVER be allowed to conduct during
>normal operation is that current which flows through them enters the IC at
>points where such currents are not usually expected and can (and does) bias
>on or off various parts of the IC in totally undefined ways. Undefined, maybe, but almost always consistent and predictable.
>This can and
>does happen but in any given situation you MAY get away with it. Something
>which works on one occasion may misbehave on another. YMWV. Expect your
>processor to possibly do anything it is capable of doing under these
>conditions (and a few things it is incapable of as well).

Yes, there can be 'side-effects', e.g. drift on analogue inputs,
especially those on the same port. However thourough testing should
make all such effects quantifiable, and experience of devices in the
field will give you data on the probability of any ill-effects.

>*** Competent designers always ensure that during normal operation their
>designs ALWAYS meet specifications in the typical operating conditions
>section of the spec sheet. A design in which the body / protection diodes
>conduct during normal operation is an incompetent design and bad engineering
>and will bring sorrow upon the heads of its perpetrator.

I disagree - yes, in an ideal world, you always stay entirely within
all published specs, but all this means in practice is if it breaks
you can blame the manufacturer. Going outside the published spec does of course increase the risk of
problems, but much of this risk can be mitigated by testing. Of course
you are at risk of problems if the device characteristics change, but
again this is a calculated risk. Microchip's history of changing
revision letters on any die revision, and continuation of supply of
earlier revisions gives confidence that an assumption that device
characteristics will not change radically is a not unreasonable one.
>Using protection diodes to clamp pin excursions under certain conditions can
>be acceptable as long as abnormal circuit operation of any possible nature
>is acceptable during these conditions. (eg a 1 megohm resistor of suitable
>ratings between an input and a pin may allow full 230 VAC mains to be
>temporarily applied to the input. Correct processor operation during such an
>incident would not be guaranteed.
But testing could demonstrate that problems are highly unlikely in
practice.

Has anyone EVER seen PICs misbehave unpredictably when using input
diodes to clamp sensible currents ????

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\11@151529 by Dwayne Reid

flavicon
face
At 10:10 AM 10/11/02 +0100, Mike Harrison wrote:
> >
> >> Add  ***NEVER**** use direct RS232 input into a
> >> microprocessor pin via a resistor and assume that the
> >> processor protection diodes will clamp the voltage
> >> swing adequately. In such cases you must ALWAYS ensure
> >> that the voltage never swings outside the processor
> >> supply range (or, where specified, the maximum limits
> >> specified by the manufacturer for NORMAL (not absolute
> >> maximum) operation.).
>
>Nonsense. The input clamp diodes ensure that the input voltage is not
>exceeded, as long as the series resistor limits the current within
>spec.

Try it when you are using the a/d inputs on the PIC.  Be prepared to pull
your hair out.  Been there, done that, won't do it again.

I've been told that *any* current flowing through *any* protection diodes
*will* cause a/d errors.  My experience seems to back that up.

On the other hand, if you aren't using the a/d convertor, an RS-232 input
direct to an input pin via a suitable current limit resistor (I use 22k)
works just fine.

dwayne

--
Dwayne Reid   <spam_OUTdwaynerTakeThisOuTspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\11@222443 by Russell McMahon

face
flavicon
face
> On the other hand, if you aren't using the a/d convertor, an RS-232 input
> direct to an input pin via a suitable current limit resistor (I use 22k)
> works just fine.

This is completely true.
The minimum value of "a suitable ... resistor" is the question.
100 Mohm would quite possibly be suitable in most cases.
Higher may be in order on occasion :-)

Notwithstanding any number of good experiences to the contrary, RS232 plus
22k will absolutely definitely certainly catch you out *sometimes* YMWV. On
my very first RS232 plus PIC experience (but far far from my first
microprocessor experience) MyMdidV.

Any newbie, and anyone else who wants to spend their life working on
formally defined problems (such as may be found in true digital designs),
rather than non-deterministic ill defined & infinitely variable problems,
are advised to stick to the manufacturers spec sheets so that the processor
remains a true digital part in areas were it is intended to be so.

Ask me how I know :-(

More anon.

           RM

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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