The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

12.3. Configure modem with AT commands

Most modems today are smart modems based upon the Hayes modems and their command sets. But as discussed above, the Linux serial console is designed to operate with a dumb modem.

Thus the smart modem is dumbed-down until it resembles a dumb modem. Some expensive modems will have a DIP switch or board jumper to put them into dumb mode.

It is essential to have a manual for the modem which describes that modem's AT commands. Although most modems agree on the more popular AT commands, they differ in the more technical commands.

12.3.1. Configure port speed

Hayes AT-style modems can maintain a static speed between the computer and the modem, no matter what speed the dialing modem uses.

For most modems this is set automatically based upon the speed of the first characters sent after power-on.

Power cycle the modem and connect to it with the command minicom -o console. Press Enter a few times. The modem should now be running at the same bit rate used by Minicom, which we set to the speed of the serial console in Section 12.1.

You can check the port speed by asking the modem to generate some output.

Figure 12-2. Testing the modem's port speed

bash# minicom -o console
Welcome to minicom
Press CTRL-A Z for help on special keys

Enter Enter Enter

ATI Enter
56k V.90 Series 3 External V2.20

Ctrl-A Q
Leave without reset? Yes

Some modems have an AT command to re-establish the port speed, look in your modem's manual for the AT&B1 command. Some modems have a command to explicitly set the port speed, look in you modem's manual for the ATB command.

12.3.2. Configure answer mode

The modem will answer an incoming call on the second ring using the command ATS0=2.

Don't answer the phone on the first ring as this may invalidate the certification of the modem in some telephony jurisdictions.

12.3.3. Configure CTS/RTS handshaking

CTS/RTS handshaking prevents lost characters.

The AT command is AT&K3.

12.3.4. Configure Data Carrier Detect

Data Carrier Detect should follow the presence or absence of a calling modem.

The AT command is AT&C1.

12.3.5. Configure Data Terminal Ready

Data Terminal Ready should control the modem. If DTR is high the modem is ready to receive calls. If DTR is low the modem should not receive any more calls and should hang up any existing call.

The AT command is AT&D2.

12.3.6. Configure no CONNECT messages

A Hayes AT-style modem usually outputs a message when a call is received. For example:

CONNECT 9600

The modem has a "quiet mode" that disables these messages.

The AT command is ATQ1. There will be no OK printed in response to this command.

12.3.7. Configure no echo of commands

Echoing commands can confuse the console, so turn off command echoing.

The AT command is ATE0.

12.3.8. Optionally, configure silent connection

Most modems have a speaker. By default this is connected whilst a modem is connecting and negotiating a common protocol and speed. This is very useful for a dialing modem, as it prevents a human being accidentally repeatedly called. The speaker can be annoying on answering modems.

If a quieter computer room is desirable, use the ATM0 command to turn off the speaker.

12.3.9. Optionally, configure DTR delay

Data Terminal Ready drops when the semiconductor that supports the RS-232 link is reset. This then hangs up the modem. This can be annoying. If the getty supports a parameter similar to mgetty's toggle-dtr-waittime then it is possible to extend the time that the modem will ignore DTR. The time that getty holds DTR low to force a hang up is extended beyond the modem's setting. The result is that resetting the semiconductor does not hang up the modem, but getty can still hang up the modem at the end of a login session.

Check your modem's documentation. Our example modem uses S-register 25 to contain the threshold for noticing a change in DTR. The value is in one-hundreds of a second. By setting the modem with ATS25=150 (1.5 seconds) and setting mgetty with toggle-dtr-waittime 2000 (2 seconds) we ignore small blips in DTR.

12.3.10. Configure no attention sequence

Once the modem is correctly configured and works well, disable the +++ sequence that gives access to the modem's command mode.

The AT command is ATS2=255.

If this command is accidentally given see Section 12.3.12 to reset the modem to its factory default parameters and start again.

12.3.11. Configuration example

Figure 12-3. Configure modem using AT commands

bash# minicom -o console
Welcome to minicom
Press CTRL-A Z for help on special keys

AT &F Enter
OK

AT Z Enter
OK

AT &C1 &D2 &K3 S0=2 M0 Enter
OK

AT E0 Q1 S2=255 &W Enter

Alt-A Q
Leave without reset? Yes

12.3.12. Resetting the modem

If you need to issue more AT commands to the modem then power cycle the modem. This should place the modem into command mode.

Now issue the following commands to restore the modem's factory configuration.

Figure 12-4. Resetting a Hayes AT-style modem

bash# minicom -o console
Welcome to minicom
Press CTRL-A Z for help on special keys

AT &F &Y0 &W &W1 Enter
OK
AT Z Enter
OK

Alt-A Q
Leave without reset? Yes

If this fails then you will need to clear the modem's configuration memory. The procedure for this varies by manufacturer, and probably requires the disassembly of the modem.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру