Discussion:
what is a serial BREAK ?
Manuel Bouyer
2005-06-02 09:51:52 UTC
Permalink
Hi,
not strictly NetBSD-related (although my primary concern is to be able
to enter NetBSD's ddb from the system I'm designing :) but I know there are
some knowlegeable peoples here.

What is, from an electrical POW, a BREAK on a serial line ?
A long period at high voltage level, a long period at the low voltage
level, or a long period at ground ?

I plan to use a MAX232 to convert the TTL signal to RS232 levels,
and I don't know if I can generate a BREAK by driving the
MAX232 input, or if I need some extra circuitery.
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
Jukka Marin
2005-06-02 10:26:40 UTC
Permalink
Post by Manuel Bouyer
What is, from an electrical POW, a BREAK on a serial line ?
A long period at high voltage level, a long period at the low voltage
level, or a long period at ground ?
It depends where you look. At the UART pin, BREAK is a low-level pulse
that lasts as long as or longer than one full character time including
start and stop bits. In normal 8N1 communication you have one start
bit, 8 data bits, and one stop bit - so BREAK is a low-level condition
lasting 10 or more bit times.

The RS232 drivers and receivers are inverting, so a low level at the
UART output is seen as +12 V on the serial cable. When the data signal
is idle, it is at -12 V. (These levels vary - with the drivers used
today, the levels are more like +/- 6 volts or so.)
Post by Manuel Bouyer
I plan to use a MAX232 to convert the TTL signal to RS232 levels,
and I don't know if I can generate a BREAK by driving the
MAX232 input, or if I need some extra circuitery.
Yes you can..

-jm
Johnny Billquist
2005-06-02 10:54:38 UTC
Permalink
Post by Manuel Bouyer
Hi,
not strictly NetBSD-related (although my primary concern is to be able
to enter NetBSD's ddb from the system I'm designing :) but I know there are
some knowlegeable peoples here.
What is, from an electrical POW, a BREAK on a serial line ?
A long period at high voltage level, a long period at the low voltage
level, or a long period at ground ?
I plan to use a MAX232 to convert the TTL signal to RS232 levels,
and I don't know if I can generate a BREAK by driving the
MAX232 input, or if I need some extra circuitery.
I assume you know how normal asynch characters look on the line.
You don't need any extra circutry. It's a long logical zero. It's like if
you were to send a nul character, but instead of getting the stop bit at
the end (which always is a 1) you continue to transmit 0.

So electrically, nothing different from normal levels. Protocol wise, it's
a framing error. A break can be as long as you care to. Once you get a
framing error, and the data is all zeroes, you have detected a break.

Strictly electrical, it's a positive signal. The exact level is rather
free in RS-232 (I think the spec says something like 5-15V. Positive for a
zero, and negative for a one)

Johnny

Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: ***@update.uu.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
Robert Elz
2005-06-02 13:28:32 UTC
Permalink
Date: Thu, 2 Jun 2005 12:54:38 +0200 (CEST)
From: Johnny Billquist <***@Update.UU.SE>
Message-ID: <***@Psilocybe.Update.UU.SE>

| Once you get a
| framing error, and the data is all zeroes, you have detected a break.

That's a risky assumption - some detection hardware/software distinguishes
between a framing error that just happens to occur on a nul character,
and a true break, which is generally required to be a lot longer (perhaps
100ms or so).

As others said though, for Manuel, any RS232/RS422 line driver chip
can generate breaks, it is just a long continuous sequence of 0 "bits"
(with no 1's at all).

Most uarts have a "send break" or "send long space" command that generates
a long sequence of 0's, so if you have a uart connected to the line driver,
it should just be programming. Even if the uart is lacking this trivial
feature, the normal technique to simulate it is to switch to an absurdly
slow bit rate (50bps, maybe 110bps) and send a 0 character. At the receiver,
still running at a rational rate, that usually looks just like a break
condition (even though 50bps is still only 20ms).

kre
Johnny Billquist
2005-06-02 18:53:14 UTC
Permalink
Post by Robert Elz
Date: Thu, 2 Jun 2005 12:54:38 +0200 (CEST)
| Once you get a
| framing error, and the data is all zeroes, you have detected a break.
That's a risky assumption - some detection hardware/software distinguishes
between a framing error that just happens to occur on a nul character,
and a true break, which is generally required to be a lot longer (perhaps
100ms or so).
I don't think there is a specified time for a break character. And older
hardware have no way to differ between a NUL with framing error, and a
break.

But these are nitpicks. If your uart have a special break detection signal
(or status bit), then you probably would use it. If not, then check the
framing error combined with a NUL.

Johnny

Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: ***@update.uu.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
John Clark
2005-06-02 19:31:46 UTC
Permalink
Post by Johnny Billquist
Post by Robert Elz
Date: Thu, 2 Jun 2005 12:54:38 +0200 (CEST)
| Once you get a
| framing error, and the data is all zeroes, you have detected a break.
That's a risky assumption - some detection hardware/software distinguishes
between a framing error that just happens to occur on a nul character,
and a true break, which is generally required to be a lot longer (perhaps
100ms or so).
I don't think there is a specified time for a break character. And older
hardware have no way to differ between a NUL with framing error, and a
break.
I was not able to find a spec on how long break signal was on a Teletype
33 or similar. But one
number I saw for a different system, gave 500ms as the time for a 'break
signal'. The origin of
the break dates to the use of the telegraph, and detecting a 'broken
wire' condition, or a 'break
in messages'.

A quick check on the ubiquitous 16450 serial chip used everywhere seems
to indicate that
one of the control bits generates a 'break signal', and as long as that
bit is asserted, a break
will be asserted on the serial line. A complementary status/interrupt
bit is assocated with
detecting a break signal, which should be longer than a 'NULL' character
at 110 Baud.

The more 'recent' use of 'break' has been used to synchronize modem
speeds on ancient
modems, where the protocol was, 'hit the break key, until a reasonable
message appears'...
Steven M. Bellovin
2005-06-02 20:49:47 UTC
Permalink
Post by John Clark
Post by Johnny Billquist
Post by Robert Elz
Date: Thu, 2 Jun 2005 12:54:38 +0200 (CEST)
| Once you get a
| framing error, and the data is all zeroes, you have detected a break.
That's a risky assumption - some detection hardware/software distinguishes
between a framing error that just happens to occur on a nul character,
and a true break, which is generally required to be a lot longer (perhaps
100ms or so).
I don't think there is a specified time for a break character. And older
hardware have no way to differ between a NUL with framing error, and a
break.
I was not able to find a spec on how long break signal was on a Teletype
33 or similar. But one
number I saw for a different system, gave 500ms as the time for a 'break
signal'. The origin of
the break dates to the use of the telegraph, and detecting a 'broken
wire' condition, or a 'break
in messages'.
A quick check on the ubiquitous 16450 serial chip used everywhere seems
to indicate that
one of the control bits generates a 'break signal', and as long as that
bit is asserted, a break
will be asserted on the serial line. A complementary status/interrupt
bit is assocated with
detecting a break signal, which should be longer than a 'NULL' character
at 110 Baud.
Right. At 110 bps, each byte is 11 bits long (a start bit, 8 data
bits, and two stop bits), so there are 10 chars/sec, which means that a
break signal has to be at least .1 seconds long. I seem to recall
seeing that about .25 seconds was normal.

However, it should not be too long; a break signal of several seconds
is interpreted by at least some modems as a signal to disconnect.
Post by John Clark
The more 'recent' use of 'break' has been used to synchronize modem
speeds on ancient
modems, where the protocol was, 'hit the break key, until a reasonable
message appears'...
Actually, that's more of an artifact: if your speed was wrong, you were
likely to generate framing errors, so it was a natural way to use break.

--Steven M. Bellovin, http://www.cs.columbia.edu/~smb
Dan LaBell
2005-06-02 22:52:28 UTC
Permalink
Post by Johnny Billquist
Post by Robert Elz
Date: Thu, 2 Jun 2005 12:54:38 +0200 (CEST)
| Once you get a
| framing error, and the data is all zeroes, you have detected a break.
That's a risky assumption - some detection hardware/software
distinguishes
between a framing error that just happens to occur on a nul character,
and a true break, which is generally required to be a lot longer (perhaps
100ms or so).
I don't think there is a specified time for a break character. And older
hardware have no way to differ between a NUL with framing error, and a
break.
There was a post from '97 in alt.folklore.computers that described
historical use
of ASCII codes for teletypes, says 'NULL 00 ^@ is always ignored...' (
Subject was: OLD ASCII - FS GS RC etc? , is googlable ) so if a break
is passed up to software as NULL it should be dropped.

HMM, then again, isn't the signal inverted on Rs232, +V is 0, -V is 1 ?
It supposed to look like a cable break isn't? (historical telegraph
antecedent )
Post by Johnny Billquist
"8250 trick", from
all the PCs that couldn't send break. Set baud rate to 34 baud, length
to 10 bits, send a 0xff (or was it a null), set baudrate back
Manuel Bouyer
2005-06-03 10:51:39 UTC
Permalink
Hi,
thanks to all who replied. So a serial break is just a long logical '0'.
I wasn't sure because sun serial console gets a break when disconnected
from the terminal or when the terminal is powered off, which lead me to
think is was related to ground.

I havn't problems applying a long '0', as the RS232 line driver will be
connected to a microcontroller. The microcontroller's pin can be
configured either as UART TX or general I/O from software.

For the curious: I'm building a (small and low-cost) management board similar
to what can be found in some servers (e.g. Sun's ALOM) for ATX power supply,
which will allow, from the serial console, to control power and drive
a logical reset switch. I'll make the schematic available once tested :)
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
Johnny Billquist
2005-06-03 10:57:35 UTC
Permalink
Post by Manuel Bouyer
Hi,
thanks to all who replied. So a serial break is just a long logical '0'.
I wasn't sure because sun serial console gets a break when disconnected
from the terminal or when the terminal is powered off, which lead me to
think is was related to ground.
Well, when you disconnect the terminal, the signal is actually free
floating. Power off (usually) leads to ground. Neither is actually a valid
voltage on the RS-232. The problem is that all RS-232 converters just
have a TTL interface on the other side, so ground have to be mapped to
'0' or '1'. If you map it to '0', you will get something that looks like
an infinite break.
Post by Manuel Bouyer
I havn't problems applying a long '0', as the RS232 line driver will be
connected to a microcontroller. The microcontroller's pin can be
configured either as UART TX or general I/O from software.
For the curious: I'm building a (small and low-cost) management board similar
to what can be found in some servers (e.g. Sun's ALOM) for ATX power supply,
which will allow, from the serial console, to control power and drive
a logical reset switch. I'll make the schematic available once tested :)
Fun. Shouldn't be that complicated, I guess.

Johnny

Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: ***@update.uu.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
Manuel Bouyer
2005-06-06 21:22:55 UTC
Permalink
Post by Johnny Billquist
Post by Manuel Bouyer
For the curious: I'm building a (small and low-cost) management board similar
to what can be found in some servers (e.g. Sun's ALOM) for ATX power supply,
which will allow, from the serial console, to control power and drive
a logical reset switch. I'll make the schematic available once tested :)
Fun. Shouldn't be that complicated, I guess.
No. The most interesting part will be writing the firmware for the
microcontroller :)
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
Steven M. Bellovin
2005-06-03 12:30:20 UTC
Permalink
Post by Manuel Bouyer
Hi,
thanks to all who replied. So a serial break is just a long logical '0'.
I wasn't sure because sun serial console gets a break when disconnected
from the terminal or when the terminal is powered off, which lead me to
think is was related to ground.
This actually goes back to where the word "break" comes from -- a line
break on a teletype line.... As Johnny Billquist noted, it's somewhat
arbitrary -- teletypes used a 20 milliamp "current loop", rather than
RS-232 -- but it was certainly convenient to mimic the old behavior.

--Steven M. Bellovin, http://www.cs.columbia.edu/~smb
Jukka Marin
2005-06-03 13:47:34 UTC
Permalink
Post by Steven M. Bellovin
Post by Manuel Bouyer
thanks to all who replied. So a serial break is just a long logical '0'.
I wasn't sure because sun serial console gets a break when disconnected
from the terminal or when the terminal is powered off, which lead me to
think is was related to ground.
This actually goes back to where the word "break" comes from -- a line
break on a teletype line.... As Johnny Billquist noted, it's somewhat
arbitrary -- teletypes used a 20 milliamp "current loop", rather than
RS-232 -- but it was certainly convenient to mimic the old behavior.
Many RS232 receivers have a threshold level of +0.3 V or so and so
0 V is interpreted the same as -12 V, which the UART sees as a logical
one - so power off / broken cable is NOT seen as a break condition.

But it depends on the receiver chip, so you can't rely on this, unless
you are making the hardware.

-jm
Loading...