Subject: Re: Serial setup.
To: netbsd-help <netbsd-help@NetBSD.ORG>
From: John Maier <JohnAM@datastorm.com>
List: netbsd-help
Date: 03/02/1995 10:47:00
>Huh? All the >=9600 bps modems I've seen either provide DTE rate locking
>or allow you to achieve effectively the same thing.  I've got some
>Supras (both v.32bis and v.FC models) and two USR DSTs set up this way,
>on two different types of systems.  In particular my news/mail system
>(Sun3, SunOS 4.1) is set up this way with a Supra v.32bis modem, and
>it's no big deal.  In fact, I think I'm using nearly the default (PC)
>settings for this.  DTE stays at 19200 regardless of the rate of the
>incoming connection.

>> Yes I realize this, and should have mentioned this.  However, most modems 

>> will pulse CD low when carrier is lost and then go high again.  In my 
case,
>> long enough for BSD to terminate the session.   On a few modems, CD wont
>> even go back high, which in this case would be nice!  If security is an 
big
>> issue, this should be tested.


I don't know how many times I've gotten into this when I was in tech. 
support.

Serial 101:
I.   DTE (Data Terminal Equipment) is a PC, VT100, etc.

II.  DCE (Data Communication Equipment) modem.
     A) A PC, mainframe, etc. hooked to a terminal via a null modem, that
        port on the PC becomes a DCE port, the terminal is still DTE.
     B) BTW we've all been using DTE improperly, but I'm not one to nit-pick 
:-)

III. DTE-DCE speed is the maximum BPS (Bits Per Second) that can move 
between
     the modem (DCE) and the PC (DTE).

IV.  On a PC, the port speed (UART) is set via software (99.99% of the 
time).

V.   There are two basic types of modems.
     A) Fixed speed.
        1.  300 baud modem with a port speed of 300 bps.
     2.  Some modems (Telbits, Motorola Codex) that allow you to preset the
            DCE rate via AT commands or panel controls.  Typically this 
option
            can be turn off if needed.
     B) Auto Baud.
        2.  The modem detects the DTE rate of the PC and sets it's DCE rate
            accordingly. (real magic)
            a)  On power up, many modems defaults 300 bps or nothing until a 

                few characters come in the port.
                (some modems may require at least 'AT')
            b)  There are a few modems (Zypcom) that stores the DCE rate. 
 So
                at the next power up, the DCE rate will be preset.

So what does baud rate have to do with DTE-DCE speed? Nothing!(typically)

Example:
     Joe has a new 38.8 modem.  He tells his comm program to set the DTE 
rate to 2400,because the BBS he is calling has only got a 2400 baud modem. 
 Everything worked but did he need to set his comm program to 2400?  No. 
 28.8, 14.4, and some 9600 baud modems support a feature called 
split-baud(data buffering).  If Joe had left the DTE rate at 57,600, the 
modem would have received the date from the BBS at 2400 baud but sent the 
data to the PC at a paced 2400 bps but still a signaling of 57,600 bps. 
 This feature was made necessary with the advent of on the fly data 
compression (V.42bis) because the bps varies so wildly due to data 
compressions and the compressibility of the data.

     Back in the 300, 1200, 2400, 4800(rare), and 9600 days, there was no 
data buffering in the modem, so if you made a connection at 2400 baud, your 
DTE-DCE rate had to be 2400 bps.

     So what if Joe makes a connection to a BBS sporting 14.4 and he for 
gets to change his DTE speed?  No problem, the modem has a buffer, he will 
get data at a pegged 2400 bps.  The modems, connected at 14,400, will just 
pace themselves to accommodate the slow DTE-DCE speed.

Now, in most modems there is a register for setting the desired line speed.
Quote from Supera manual:

S37  Desired Line Speed
     (range=0-7; default=0)

0  Rate of the last AT command issued, or 14,400 bps if last command speed 
was
   greater than 14.400 bps (default).
1  300
5  1200
6  2400
8  4800
9  9600
10 12000
11 14,400
12 7200

At first glance you think, great, I can set my modems DCE rate... read on...

This refers to the highest rate at which your modem attempts to connect to 
the remote modem.

There is another setting N0 and N1.  This determines the connection rate.

NO  Connect(to the remote host) only at the rate specified in S37, or if 
S37=0, connect at the rate at which the last AT command was issued.

i.e. ATNOS37=6 forces the modem to only negotiate with another modem at 
2400.
The only time you would need to do this is if you only people to connect 
with a 14,400 (you've taken a Microsoft stance of, if people with 9600 and 
below  want to connect, they need to buy a 14,400) or your having trouble 
connect to a non 2400 modem with a 14,400 (I've seen this a lot, Zooms are 
the worst!).

N1  Connect at the highest rate support by both modems (best and most 
desirable).

>Supras allow this (&C1), as do most others, I think.

No, What I mean is, if you were to send 'AT&C0' (carrier goes high). 
 Someone dials in, hangs up, some modems pulse CD low then go back high. 
 But there are some rare cases where the modems keep CD low, after hang-up, 
without you sending an 'AT&C1' to the modem.  The later behavior, typically, 
depends upon the &D setting.  Typically most people set &D to 2 (AT&D2) but 
factory defaults, and other factors don't always dictate this (when in 
doubt, consult the documentation).

(these commands are not guaranteed to work with all modems!  But the feature 
should at least be available is needed)

In setup terms, if you have a =<14400 modem, a DTE rate of 19,200 (maybe 
38,400) if you have a 16450 UART, 38400-57600 if you have a 16550 UART. 
 I've seen 115200 work with a 16550 UART, but no guarantees, I don't even 
know if NetBSD support such a rate.

jam

**********************************************************************
*       John A. Maier          * Research Assistant For Datastorm    *
* E-mail: johnam@datastorm.com * Technologies Inc. (Procomm Plus)    *
**********************************************************************