Previous Next Table of Contents

4. Modem

You are going to connect to the internet with your modem - yes?

So you want to be sure that your modem works, and that it is working correctly. What can go wrong?

4.1 Modem on wrong irq

The jumpers on the card, tells the card the irq it should use. setserial /dev/modem tells you the irq that the driver is using. These must be the same.

        setserial /dev/modem irq 5
Tells the driver where the modem really is.

I don't understand how, but with the wrong irq, the serial driver manged to send small pieces of data (hint<20 bytes) to and from the modem But it was extremely slow, with 7 seconds delay.

4.2 irq conflict

You cannot have two different ISA cards, on the same irq. One of them must either be disabled, or moved to a different irq.

4.3 Modem not spd_vhi

The old POSIX, can't nominate BAUD rates above 38400. This is because of the bits in the termios structure, and the stty documentation.

To get round this, Linux has a hack, where the driver UART runs at 115200 BAUD, but the kernel reports 38400 with spd_vhi set. If you set spd_hi and 38400, you get 57600 BAUD.

        setserial /dev/modem spd_vhi
        stty 38400 < /dev/modem
To get around this, newer releases of DIP and PPPD have extra Linux intelligence, that does the setserial spd_vhi for you. IE you request 115200 in the pppd options, and it makes sure that you get it. But if you asked for 38400, should it ... ?

Beware! If you have an old minicom, dip or pppd this might not be true. If in doubt check!

4.4 Modem at wrong BAUD rate

Well it would run at 115200 if you selected 38400, but you didn't. Not asking, gives you the "default", or "as currently found" which may be 9600.

4.5 Modem reports CONNECT 115200 - not CONNECT 28800

This is how you know that the (virtual) serial cable is running at spd_vhi.

The AT S95=47 (on my modem) tells it to display CONNECT 115200, S95=46 tells it to display CONNECT 28800 (or whatever the line quality is).

You should run it once, to confirm 115200. Normally, you want it to report the actual connect speed (28800), since that can vary.

4.6 Modem prefers rtscts

There isn't much in it, especially with control-character escaping, but RTS/CTS is preferred over XON/XOFF.

Of course, you have to make sure that it is switched on! With pppd you simply add rtscts to the options list, with slip you can set it in the calling shell script, and with minicom it is set in a menu somewhere.

Since I like RTS/CTS so much, I try to have it set as soon as the system boots, and set it at the start of every script!

        stty crtscts < /dev/modem

4.7 Sharing the modem with a getty

Both programs (pppd and getty) must agree on the locking mechanism and name of the lock file. Note that /dev/modem and /dev/ttyS2 will create two different LOCK files! So be consistent.

/var/lock/LCK..modem

The getty might want to initialise the modem, after pppd has finished, to reset options like auto-answer and number of rings.

4.8 Other possible problems

Most modems have intelligent defaults, but yours might do something strange that needs attention. It may need some AT flags to make it behave. If you have a relevent URL that explains what needed to be done for your favourite modem (that I don't have), send it every month until I cross-reference it!

Remember, that the people with the REAL answers (that's not me), are too busy solving problems to write docs. Linux is a user supported OS, so if you had problems with your particular situation, create a WEB page.

4.9 Query UART during session

You can run these whilst a session is active. As long as you read the settings and don't attempt to change them.

        setserial /dev/modem
        stty < /dev/modem

        stty -a < /dev/modem    # shows rtscts NOT -rtscts

4.10 Test with minicom

Without dialing out, you can look at the modem, and see that it is alive and well.

Minicom will run the setserial option, when it opens the device. It will also send it's configuration AT command to the modem, which the modem should echo along with OK.

You should then dial out, to a plain old BBS, to see that it works. My ISP provides a BBS on the same number. Just login as guest or whatever it says on the login prompt. This also tests the phone line.

4.11 Dead modem card

Sometimes, my modem card doesn't work, (immediately after boot), but a power off, wait 10 secs, power on, works just fine!

This is probably a hardware or intermittent design fault, but it is very irritating, especially after starting X11, and several logins.

Now, I make a point of running dial_ppp test, as soon as the machine is booted. This just sends ATZ to the modem, which (hopefully) replies with OK. Then I know it's working.

4.12 Modem card not jumpered to defaults

This is the same, cheap card that doesn;t like being jumpered to anything other than COM3, IRQ 5. I suspect that that is all it was ever tested at in the factory.

A lot of problems went away when I put it back on the defaults, but it may be the OTHER card, that it swapped places with. Either way, it used to fail BADLY on time in four (as in complete machine lockups), now it fails once a week (not locking the machine up).

4.13 Screen Capture with minicom

To write you chat script, or dip script, you need to know what key prompts are displayed by the remote system (is it Login or login?)

In particular, my account gets a "Protocol:" prompt, where I type "ppp" or "slip". In both cases, sucessfully getting past that point gives me "Packet Mode Enabled", but that is just a string that came into their script writer's head.

To get and keep this, you can either use a pencil, or minicoms capture facility. Save the text to a file, use cut+paste, and re-use the exact same original bytes.

4.14 Reset Defaults with minicom

Default pppd scripts tend to simply accept the modem in the state they found it. Ususally, this is OK, but you may prefer to reset the modem to a known state.

ATZ returns the modem to it's remembered default state. Most modems have two of these, and they are programmable. IE they get remembered after power off.

You can go through your modems code book, and try out options.

4.15 dial_ppp

dial_ppp is an extra that you will install later, so that you don't have to be root, when running pppd (or dip). However it is an option, and before getting confused with one more thing to be wrong, get the basic scripts running as root, then add dial_ppp. Read it now, as it helps you set up the basic ppp_script. In particular, the diap_ppp.sh script and chat_tdc file, may help you get PPP running.

IE if running the shell script as root works, running the binary as another user should work or fail.

4.16 /etc/ppp/chat_isp

This is the script that initialises the modem, dials the number, logs in with your password, and answers the protocol question.

At every step it has a magic substring, such as "OK", "login:", "Password:". Before sending the next line (word), it checks the return string from the previous action. It is also good practise to get and check for the final message that says "everything ok from now on it's ppp". This is just to confirm that everything is ok. eg "Packet mode enabled"

You will have to re-write this for your site.

        ABORT BUSY
        ABORT 'NO CARRIER'
        ABORT 'NO DIAL TONE'
        REPORT CONNECT
        '' ATZ
        TIMEOUT 5
        OK 'AT Q0 V1 E1 X4 L0 W1 S95=47 M1 I4'
        OK 'ATDT 0181 265 2211'
        TIMEOUT 45
        CONNECT ''
        TIMEOUT 10
        login: trix
        Password: PASSWORD
        Protocol: ppp


Previous Next Table of Contents