Subject: Re: Serial breaks
To: None <port-vax@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-vax
Date: 04/07/2006 12:20:11
> The problem is what befalls the VAX whenever the PC on the other end
> of the cable is rebooted (or powered on). As part of its
> initialisation procedures, the PC BIOS appears to send "break"
> characters/sequences (what exactly is it?) down the serial cable,
A break condition is not a character. (It also may not be what's
happening here - see below.)
To understand what a break condition actually is, you need to
understand how characters are represented on a serial line. You may
already know some of this; to avoid back-and-forth explanations, I'll
assume you know just about nothing.
Serial lines such as your VAX's console are, electrically, RS-232.
(They often do not follow the other parts of RS-232; for example, some
(all?) VAX consoles use a DE9 connector instead of a DB25.) RS-232 (an
EIA standard, EIA RS-232-C I think it is in full) is a voltage-based
spec, specifying two states for data transmission: two different
voltages on the data line (referenced to the signal ground line).
There are a bunch of other lines as well, carrying non-data information
such as "ring indicator" - the standard was designed for use with
modems and the like. (These voltages are something like, +3 to +15
volts is one state and -3 to -15 volts is the other. ±12V is perhaps
most commonly used.) You may sometimes see these two states called
"mark" and "space", largely for historical reasons.
When idling (ie, no data being sent), the line is in one of these two
voltage states. Since it is the one corresponding to a 1 data bit, it
is usually taken as "high" when drawing graphs. When a character
starts, the line is driven to the other state ("0") for a particular
time, a time which depends on the speed of the line. This time
interval is often called a "bit time", and is directly derived from the
speed: if the line is running at 9600 baud, for example, a bit time is
1/9600 of a second. Then the data bits are sent, however many of them
there are - this is why the two ends of a serial line need to agree on
the bits-per-character setting (these days there are invariably 8 data
bits, except for very special purposes such as talking to antique
equipment). Each data bit is sent by simply driving the line to the
voltage corresponding to that bit, for that same amount of time (this
is why it's called a bit time: it's the time taken to send one bit).
After the last data bit, the line is driven back to 1 for a bit time,
or sometimes (rarely nowadays) for 1.5 or 2 bit times. Then the next
character's start bit can begin - or, if no character is available, the
line idles in the 1 state until one is.
The initial 0 is called the start bit and the trailing 1 is the stop
bit (or stop bits, if more than one bit time).
A break condition is simply the line driven to the 0 state for more
than one entire character time (start plus data plus stop). Usually,
much more than one character time - at 9600 baud, for example, a
character takes 1/960 of a second, but a break typically lasts for
something like .25 second, or 240 character times.
Now, what you're seeing may not be a true break condition. There is
something called a framing error, which a break is a special case of.
A framing error is a sequence of line states which includes a start bit
but which does not have a stop bit at the correct time relative to that
start bit. Some serial line receivers that do special things on break
actually do their special thing on any framing error, so it's possible
that you're getting some other framing error. (Not that this makes
much difference to you in practice.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B