April 24, 2019

New HOWTO: Modem-HOWTO - page 15

Table of Contents

  • April 12, 2001
  14.  What Speed Should I Use with My Modem?

  By "speed" we really mean the "data flow rate" but almost everybody
  incorrectly calls it speed.  For all modern modems you have no choice
  of the speed that the modem uses on the telephone line since it will
  automatically choose the highest possible speed that is feasible under
  the circumstances.  If one modem is slower than the other, then the
  faster modem will operate at the slower ones speed.  On a noisy line,
  this speed will drop still lower.

  While the above speeds are selected automatically by the modems you do
  have a choice as to what speed will be used between your modem and
  your computer (PC-to-modem speed).  This is sometimes called "DTE
  speed" where "DTE" stands for Data Terminal Equipment (Your computer
  is a DTE.)  You need to set this speed high enough so this part of the
  signal path will not be a bottleneck.  The setting for the DTE speed
  is the maximum speed of this link.  Most of the time it should operate
  at lower speeds.

  For an external modem, DTE speed is the speed (in bits/sec) of the
  flow over the cable between you modem and PC.  For an internal modem,
  it's the same idea since the modem also emulates a serial port.  It
  may seem ridiculous having a speed limit on communication between a
  computer and a modem card that is directly connected inside the
  computer to a much higher speed bus.  But it's that way since the
  modem card probably includes a dedicated serial port which does have
  speed limits (and settable speeds).

  14.1.  Speed and Data Compression

  What speed do you choose?  If it were not for "data compression" one
  might try to choose a DTE speed exactly the same as the modem speed.
  Data compression takes the bytes sent to the modem from your computer
  and encodes them into a fewer number of bytes.  For example, if the
  flow (speed) from the PC to the modem was 20,000 bytes/sec (bps) and
  the compression ratio was 2 to 1, then only 10,000 bytes/sec would
  flow over the telephone line.  Thus for a 2:1 compression ratio you
  need to set the DTE speed to double the maximum modem speed on the
  phone line.  If the compression ratio were 3 to 1 you need to set it 3
  times faster, etc.

  14.2.  Where do I Set Speed ?

  This DTE (PC-to-modem) speed is normally set by a menu in your
  communications program or by an option given to the getty command if
  someone is dialing in.  You can't set the DCE modem-to-modem speed.

  14.3.  Can't Set a High Enough Speed

  You need to find out the highest speed supported by your hardware.  As
  of late 1998 (and late 2000) most serial ports only supported speeds
  up to 115.2k bps.  Some 56k internal modems support 230.4k bps (but it
  may be hard to find out which ones do).  Recent Linux kernels support
  high speeds (over 115.2k) but you might have some problems using it
  because of one or both of the following reasons:

  1. Older versions of an application program (or stty) may not accept
     the high speed.

  2. Setserial may show the wrong speed unless you use the baud_base
     option.  In any case the high speed will work OK.

  14.3.1.  How speed is set in hardware: the divisor and baud_base

  Here's a list of commonly used divisors and their corresponding speeds
  (assuming a maximum speed of 115,200): 1 (115.2k), 2 (57.6k), 3
  (38.4k), 6 (19.2k), 12 (9.6k), 24 (4.8k), 48 (2.4k), 96 (1.2k), etc.
  The serial driver sets the speed in the hardware by sending the
  hardware only a "divisor" (a positive integer).  This "divisor"
  divides the maximum speed of the hardware resulting in a slower speed
  (except a divisor of 1 obviously tells the hardware to run at maximum

  Normally, if you specify a speed of 115.2k (in your communication
  program or by stty) then the serial driver sets the port hardware to
  divisor 1 which obviously sets the highest speed.  If you happen to
  have hardware with a maximum speed of say 230.4k, then specifying
  115.2k will result in divisor 1 and will actually give you 230.4k.
  This is double the speed that you set.  In fact, for any speed you
  set, the actual speed will be double.  If you had hardware that could
  run at 460.8k then the actual speed would be quadruple what you set.

  14.3.2.  Work-arounds for setting speed

  To correct this accounting (but not always fix the problem) you may
  use "setserial" to change the baud_base to the actual maximal speed of
  your port such as 230.4k.  Then if you set the speed (by your
  application or by stty) to 230.4k, a divisor of 1 will be used and
  you'll get the same speed as you set.  PROBLEM: stty and many
  communication programs (as of mid 1999) still have 115.2k as their
  maximum speed setting and will not let you set 230.4k, etc.  So in
  these cases one solution is not to change anything with setserial but
  mentally keep in mind that the actual speed is always double what you

  There's another work-around which is not much better.  To use it you
  set the baud_base (with setserial) to the maximal speed of your
  hardware.  This corrects the accounting so that if you set say 115.2k
  you actually get 115.2k.  Now you still have to figure out how to set
  the highest speed if your communication program (or the like) will not
  let you do it.  Fortunately, setserial has a way to do this: use the
  "spd_cust" parameter with "divisor 1".  Then when you set the speed to
  38400 in a communication program, the divisor will be set to 1 in the
  port and it will operate at maximum speed.  For example:
  setserial /dev/ttyS2 spd_cust baud_base 230400 divisor 1
  Don't try using "divisor" for any other purpose other than the special
  use illustrated above (with spd_cust).

  If there are two or more high speeds that you want to use that your
  communication program can't set, then it's not quite as easy as above.
  But the same principles apply.   You could just keep the default
  baud_base and understand that when you set a speed you are really only
  setting a divisor.  So your actual speed will always be your maximum
  speed divided by whatever divisor is set by the serial driver.  See
  ``How speed is set in hardware: the divisor and baud_base''

  14.3.3.  Crystal frequency is not baud_base

  Note that the baud_base setting is usually much lower than the
  frequency of the crystal oscillator in the hardware since the crystal
  frequency is often divided by 16 in the hardware to get the actual top
  speed.  The reason the crystal frequency needs to be higher is so that
  this high crystal speed can be used to take a number of samples of
  each  bit to determine if it's a 1 or a 0.

  14.4.  Speed Table

  It's best to have at least a 16650 UART for a 56k modem but few modems
  or serial ports provide it.  Second best is a 16550 that has been
  tweaked to give 230,400 bps (230.4 kbps).  Most people still use a
  16550 that is only 115.2 kbps but it's claimed to only slow down
  thruput by a few percent (on average).  This is because a typical
  compression ratio is 2 to 1 and for downloading compressed files
  (packages) it's 1 to 1.  There's no degradation for these cases.  Here
  are some suggested speeds to set your serial line if your modem speed

  �  56k (v.90): use 115.2 kbps or 230.4 kbps (best)

  �  33.6k (v.34bis): use 115.2 kbps

  �  28.8k (v.34): use 115.2 kbps

  �  14.4k (v.32bis): use 57600 bps

  �  9.6k (v.32): use 38400 bps

  �  slower than a 9600 bps (v.32) modem: Set the speed to the same
     speed as the modem.

  All the above speeds may use v.42bis data compression and v.42 error
  correction.  If data compression is not used then the speed may be set
  lower so long as it's above the modem speed.

Most Popular LinuxPlanet Stories