Team LiB
Previous Section Next Section

Setting up Your Modem with minicom

The protocol that a computer uses to communicate with standard Hayes-compatible modems is referred to as the AT command set. The AT command set lets you communicate directly to the modem for troubleshooting. If you were not able to get a dial-out connection going as described earlier with the wvdial command or Network Configuration window, you can try using minicom.

The minicom command provides an interface for communicating with devices that are connected to serial ports. Minicom is a Linux-equivalent to the HyperTerminal utility that you may be familiar with in Microsoft operating systems.

With minicom, you can send AT commands directly to your modem to get information about its features and current state. You can also dial out directly, test communications, and change settings.

The procedure in the following section illustrates a session where we use minicom to communicate directly to the modem. Using minicom, you can display and change settings on the modem by issuing commands. For the most part, we are interested in working with:

At this point, I assume that you have installed and configured a modem as described in the Choosing a Modem section earlier in this chapter and that you know the serial device (such as /dev/ttyS0) used to communicate with that modem. Refer to Table 13-1 for other minicom functions you can use.

Table 13-1: Using minicom Commands to Test Your Modem

General Functions

Letter

Description

C

Clears the screen

M

Initializes the modem

L

Captures your minicom session to a file. Type a file name to save it to, when prompted. Repeat Ctrl+A+L to close the capture session

J

Jumps to a command shell (then type fg to return to minicom)

P

Displays communications parameters (speed, parity, data, and stopbits)

Z

Shows the help screen

O

Configures settings for minicom (filenames and paths; file transfer protocols; serial port setup; modem and dialing; screen and keyboard; and save setup)

B

Scrolls the screen back

X

Exits and resets the modem

Q

Quits without resetting the modem

Dialing Functions

D

Accesses a dialing directory, where you can save a list of numbers to dial out

H

Hangs up the phone

F

Sends the modem a break signal

I

Initializes the modem

To begin a function in minicom, press Ctrl+A, and then type the appropriate letter.

Starting minicom

Use the following procedure to start minicom.

  1. Start Minicom-From any Terminal window, type the following as root user:

    # minicom -s
    

    The minicom interface opens to the [configuration] menu.

    Note 

    By default, all users have access to run minicom, based on the permission set in the /etc/minicom.users file. If, however, users are unable to access a modem through minicom, they should check the permissions of the modem's serial device. (For example, typing chmod 755/dev/ttyS0 as the root user gives everyone access to the modem on the COM1 port.)

  2. Choose port settings-Use the down arrow key to highlight Serial Port Setup, and then press Enter. At the top of the box that appears, you should see Serial Device, followed by the name of the serial device (such as /dev/ttyS1), and other information as shown below:

    A -    Serial Device         : /dev/ttyS0
    B - Lockfile Location        : /var/lock
    C -   Callin Program         :
    D -  Callout Program         :
    F -    Bps/Par/Bits          : 38400 8N1
    F - Hardware Flow Control    : Yes
    G - Software Flow Control    : No
        Change which settings?
    
  3. Set serial device-If the serial device listed does not represent the one connected to your modem, press A and type the name of your serial device. Examples of device names include:

    • /dev/ttyS0-For the first serial port (also called COM1).

    • /dev/ttyS1-For the second serial port (also called COM2)

    • /dev/ttyACM0-For the first serial interface to a USB modem.

      After typing the device name, press Enter.

  4. Change line speed-Change the Bps/Par/Bits lines to read 115200 8N1, if it doesn't already say that. (Press E, and then press I to select 115200 BPS as the speed at which your computer communicates to the modem. Then press Enter to return.) Press Enter to return to the [configuration] menu.

  5. Save settings-Highlight Save setup as dfl and press Enter. A message will say Configuration Saved. This saves configuration settings to the /etc/minirc.dfl file.

  6. Exit-Highlight Exit and Press Enter. (You may need to restart minicom for the new settings to take effect. Press Ctrl+A, and then X to quit minicom. Then type minicom to restart it.)

Displaying and Changing Modem Settings

With minicom running and communicating with your modem, you should see something like the following:

Welcome to minicom 2.00.0
OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Sep 12 2003, 17:27:02
Press CTRL-A Z For help on special keys
AT S7=45 S0=0 L1 V1 X4 &cl E1 00
OK

This shows that minicom started successfully, and when it sent an AT command to initialize the modem, the modem received it and responded with OK. If you don't see OK, you are not communicating to the modem. In this example, several items were set during initialization:

  • The number of seconds to wait for a carrier is set to 45 (S7 = 45)

  • Auto-answering is disabled (SO = 0)

  • Speaker is set to low volume (L1)

  • Result codes are in long form (V1)

  • All messages are sent (X4)

  • Receive line signal detect is set to follow the carrier's state (&c1)

  • Command echo is enabled (E1)

  • Result codes are sent to the DTE (Q0)

At this point, try some AT commands to get to know your modem better. The letters and numbers that follow the AT change or display the selected values.

  1. Show profiles-To show the settings on the modem, type the following:

    AT&V
    

    The information you see will be specific to your modem. It is possible that you will see an active profile and one or more other stored profiles. With different profiles, you can have groups of settings for different situations.

    Refer to any of the AT command set links shown in Table 13-2 for information on what any of the AT commands means.

  2. Load profile-Use the ATZ command to load a profile.

    ATZ     Load the default profile
    ATZn    Replace n with 0, 1, 2 to load the selected profile
    
  3. Change settings-Type AT, followed by any number of commands or register settings. Refer to Table 13-2 for links to sites that contain descriptions of the AT command set. Remember, you can add multiple commands and registers on the same line. Here are a few examples:

    ATL3       Sets speaker volume to high
    ATM2       Sets speaker to always on
    AT&D2      Sets modem to hang up if the computer drops DTR
    AT&DOS12=5 Sets maximum time between the end of the
               escape sequence and sending OK (in 1/50th second)
    ATS6=10    Sets time to wait for a dial tone to 10 seconds.
    
  4. Save the settings-To save settings to the current profile, type AT&W.

  5. Try dialing out-You can use the DT command to try dial out from within minicom. Here is an example:

    ATDT5551212
    

    If you get a dial tone, or are not able to dial out and connect to the remote modem, you may find that you need to pause or wait for secondary tones during the dial-up procedure. Here are characters you can add after the DT (for tone dialing) or DP (for pulse dialing):

    • W-Wait for a dial tone. You could use this, for example, if you need to dial 9 to get an outside line before dialing (ATDT9W5551212).

    • -Wait for 5 seconds of silence.

    • ,-Wait for 2 seconds before proceeding (you can add multiple commas to add multiple 2-second pauses).

    • Sn-Replace n with an entry number of a phone number stored in the dial directory.

    • L-Redial the previous number dialed.

Once you have gotten working settings and the ability to dial-up and connect to the remote modem, be sure to pass those settings back to the Network Configuration window (or /etc/wvdial.conf file) so they are set each time you dial out. The next section describes how to add the settings you come up with for your modem so that they are made permanent and used each time your modem connection starts up.

Making Modem Settings Permanent

Once you know the settings you like, you can add them to the Init3 line in the wvdial.conf file, as described earlier. For example, here's how the Init lines might look in the wvdial.conf file:

   Init1 = ATZ
   Init3 = ATM1L2S11=50

After the Init1 line loads the default profile (ATZ), I change the Init3 line. These values set the speaker to be on until a carrier is detected (M1), set the speaker volume to medium (L2), and also set the dialing tones to go as fast as possible to speed up dialing (set the S11 register to 50 milliseconds). (To add the options in the Network Configuration window, I edited the ppp0 interface name, chose the Advanced tab, and added ATM1L2S11=50 to the Modem Initialization String box.)


Team LiB
Previous Section Next Section