Next Previous Contents

7. Modem Configuration (excluding serial port)

7.1 Finding Your Modem

Before spending a lot of time configuring your modem, you need to make sure it can be found and that AT commands and the like can be sent to it. So I suggest you first give it a very simple configuration using the communication program you will be using on the port and see it it works. If so, then it's been found. If not then see My Modem is Physically There but Can't be Found. A winmodem may be hard to find and will not work under Linux.

7.2 AT Commands

While the serial port on which a modem resides requires configuring, so does the modem itself. The modem is configured by sending AT commands (or the like) to it on the same serial line that is used to send data.

Most modems use an AT command set. These are cryptic and short ASCII commands where all command strings are prefaced by the letters AT. For example: ATZ&K3<return> There are two commands here: Z and &K3. Z is short for Z0 and some modems require that you use Z0 instead of just Z. Similarly for all commands ending in 0. The command string is terminated by a return character (use the <enter> key if you are manually typing it). Unfortunately there are many different variations of the AT command set so that what works for one modem may or may not work for another modem. Thus there is no guarantee that the AT commands given in this section will work on your modem.

Such command strings are either automatically sent to the modem by communication programs or are manually typed in by you. Most communication programs provide a screen where you may type such commands. You may type in some commands to create the configuration you want and then save this this configuration (profile) for later use. It gets saved inside the modem itself.

If you have a manual for your modem you can likely look up the AT command set. Otherwise, you may try to find it on the Internet. One may use a search engine and include some actual commands in the search terms to avoid finding sites that just talk about such commands but fail to list them. You might also try a few of the sites listed in the subsection Web Sites

7.3 Init Strings: Saving and Recalling

The examples given in this subsection are from the Hayes AT modem command set. All command strings must be prefaced by the two letters AT. For example: AT&C1&D3^M (^M is the return character). When a modem is powered on, it automatically configures itself with one of the configurations it has stored in its non-volatile memory. If this configuration is satisfactory there is nothing further to do.

If it's not satisfactory, then one may either alter the stored configuration or configure the modem each time you use it by sending it a string of commands known as an "init string" (= initialization string). Normally, a communication program does this. What it sends will depend on how you configured the communications program. Your communication program should allow you to edit the init string and change it to whatever you want. Sometimes the communications program will let you select the model of your modem and then it will use an init string that it thinks is best for that modem.

The configuration of the modem when it's first powered on may be expressed by an init string. You might think of this as the default "string" (called a profile). If your communications program sends the modem another string (the init string), then this string will modify the default configuration. For example, if the init string only contains two commands, then only those two items will be changed. However, some commands will recall a stored profile from inside the modem so a single such command in the init string can thereby change everything in the configuration.

Modern modems have a few different stored profiles to choose from that are stored in the modem's non-volatile memory (it's still there when you turn it off). In my modem there are two factory profiles (0 and 1, neither of which you can change) and two user defined profiles (0 and 1) that the user may set and store. Your modem may have more. To view some of these profiles send the command &V. At power-up one of the user-defined profiles is loaded. For example, if you type the command &Y0 then in the future profile 0 will be used at power-on.

There are also commands to load (activate) any of the stored profiles. Such a load command may be put in an init string. Of course if it loads the same profile that was automatically loaded at power-up, nothing is changed (unless the active profile has been modified since power-up). Since it could have been modified it's a good idea to use some kind of an init string even if it does nothing more than load a stored profile.

Examples of loading saved profiles:
Z0 loads user-defined profile 0 and resets (hangs up, etc.)
&F1 loads factory profile 1

Once you have sent commands to the modem to configure it the way you want (such as loading a factory profile and modifying it a little) you may save this as a user-defined profile:
&W0 saves the current configuration to user-profile 0

Many people don't bother saving a good configuration in their modem, but instead, send the modem a longer init string each time the modem is used. Another method is to restore the factory default by &F1 at the start of the init string and then modify it a little by adding a few other commands to the end of the init string. By doing it this way no one can cause problems by modifying (and saving) the user-defined profile which is loaded at power-on.

You may choose an init string supplied by someone else that they think is right for your modem. Some communication programs have a library of init strings to select from. The most difficult method (and one which will teach you the most about modems) is to study the modem manual and write one yourself. You could save this configuration inside the modem so that you don't need an init string. A third alternative is to start with an init string that someone else wrote, but modify it to suit your purposes.

If you look at init strings used by communication programs you may see symbols which are not valid modem commands. These symbols are commands to the communication program itself and will not be sent to the modem. For example,   means to pause briefly.

Where is my "init string" so I can modify it ?

This depends on your communication program (often a PPP program). If this is the latest version of Modem-HOWTO send me info for other cases.

7.4 Other Modem Commands

Future editions of Modem-HOWTO may contain more AT commands but the rest of this section is mostly what was in the old Serial-HOWTO. All strings must start with AT. Here's a few Hayes AT codes that should be in the string (if they are not set by using a factory default or by a saved configuration).

E1       command echo ON
Q0       result codes are reported
V1       result codes are verbose
S0=0     never answer (uugetty does this with the WAITFOR option) 

Here's some more codes:

What DTR does may also be set up but it's more complicated since it depends on both the &D and &Q commands.

Greg Hankins had a collection of setups for different types of modems. It's not currently maintained and covers modems prior to 1998. ftp://ftp.cc.gatech.edu/pub/people/gregh/modem-configs.

Note: to get his USR Courier V.34 modem to reset correctly when DTR drops, Greg Hankins had to set &D2 and S13=1 (this sets bit 0 of register S13). This has been confirmed to work on USR Sportster V.34 modems as well.

Note: some Supra modems treat DCD differently than other modems. If you are using a Supra, try setting &C0 and not &C1. You must also set &D2 to handle DTR correctly.


Next Previous Contents