ENGLISH 简体中文 日本語 한국어  


APPLICATION NOTE 702

Using TINI Point-to-Point Protocol (PPP)

Abstract: This application note shows how to use Point-to-Point Protocol (PPP) networking with the Tiny InterNet Interfaces (TINI®) runtime environment for dial-up networking. Includes detailed configuration of Windows® 2000 dial-up client software.

Introduction

The Point-to-Point Protocol (PPP) provides IP packet transport over a serial link. The serial link can be a direct serial connection using a serial cable, a connection using a modem and telephone lines, or a cellular handset using wireless technologies.

Being a point-to-point protocol, PPP does not distinguish between client and server operations. For the purposes of this application note, a peer that requires a remote peer to provide authentication and provides an IP address to the remote peer is known as a server. Whereas, a peer that does not require a remote peer to authenticate and accepts an IP address is known as a client.

On TINI, the PPP physical interface is a serial port, which can be connected to a modem and allows the use of the Public Switched Telephone Network (PSTN) for global access to the TINI. However, the use of a modem is not required. Devices such as cellular phones and PDAs with PPP support can be connected to a TINI with the proper serial cable.

System Description

The TINI system referenced in this application note is composed of a TINIm390 Verification Module (DS-TINI-1) and TINI E10 Sockets board. The TINI E10 Sockets board provides physical connectors to the various ports available on the TINI module. Connectors J3 and J6 provide DTE and DCE interfaces to TINI serial port0. Being a DTE interface, J3 can easily be connected to a DCE port with a straight through serial cable. A standard PC provides DTE serial ports. Whereas J6 is a DCE interface and can easily be connected to a DTE port with a straight through serial cable. A standard modem implements a DCE interface. Connectors J3 and J6 are mutually exclusive and should not be used at the same time.

Examples

This application note provides two PPP connection examples. The first example shows the steps required to establish a PPP connection between TINI and a Windows 2000 host using a serial cable. The second example shows the steps required to establish a connection between TINI and an Internet Service Provider (ISP) using a modem.

The TINI software referenced in this application note is specific to TINI 1.0x releases. With these releases a PPP example is provided as an optional Slush command and the PPP firmware is part of the TINI runtime environment. Starting with TINI 1.1x, PPP examples are provided as TINI applications. The server and client functionality have been separated and the PPP firmware is implemented as a native library. The PPP applications can be found in the examples directory included in the TINI distribution.

The Java™ source code, PPPCommand.java, referenced herein is provided with the standard TINI software distribution. The source file PPPCommand.java complies with the Slush shell command interface and is intended to be compiled into Slush. Once part of the Slush binary, the PPP command is available from the Slush command line. The PPP command implements both a PPP client and server. Only one mode of operation, client or server is allowed at any one time. The PPP command is setup to control a modem connected to the serial port and as such issues some basic modem configuration commands. These commands may not be appropriate or necessary for all modems or other devices and should be verified against the documentation of the modem or device in use.

Example 1: Direct Serial Connection

This example demonstrates the capability of a TINI system to use a serial cable to establish a PPP link with a Windows 2000 host. In this example, TINI is the PPP server and the Windows host is the client. Before a PPP link can be established, the Windows host must be configured to use a direct serial device for dial-up network connections. The PPP command source must also be modified to operate with the Windows direct serial driver. Figure 1 provides an overview of the system.

Figure 1. Direct connection system.
Figure 1. Direct connection system.

A new Windows direct serial dial-up connection is configured in two steps. The first step is to add a direct serial connection device and the second step adds a new Internet connection that uses the direct serial device.

Adding Direct Serial Link Device

To add the direct serial device, open the Phone and Modem Options applet found in the control panel. Select Add from the Modems tab of the Phone and Modem Options applet. The Add/Remove Hardware Wizard dialog should now be shown (Figure 2). Check the Don't detect my modem... check box and click Next.

Figure 2. Phone and modem options/install new modem (1).
Figure 2. Phone and modem options/install new modem (1).

From the next dialog (Figure 3) select (Standard Modem Types) in the left column and Communications cable between two computers from the right column and click Next.

Figure 3. Install new modem (2).
Figure 3. Install new modem (2).

From the next dialog (Figure 4) select the appropriate communications port and click Next.

Figure 4. Install new modem (3).
Figure 4. Install new modem (3).

From the next dialog click Finish to complete the installation of the Direct Serial Link device. After the new device is installed, click OK to dismiss the Phone and Modem Options applet.

Adding a New Dial-Up Connection

To add a new dial-up connection, open the Network and Dial-Up Connections applet located in the control panel. Open Make New Connection to start the Network connection Wizard (Figure 5), and click Next.

Figure 5. Network and dial-up connections.
Figure 5. Network and dial-up connections.

From the connection wizard dialog, select Connect directly to another computer (Figure 6), and click Next.

Figure 6. Connect directly to another computer.
Figure 6. Connect directly to another computer.

From the connection wizard dialog, select Guest (Figure 7) and click Next.

Figure 7. Host or guest.
Figure 7. Host or guest

From the connection wizard dialog (Figure 8), select the Communication cable between two computers...device that was installed in the previous step then click Next.

Figure 8. Communication device.
Figure 8. Communication device.

From the current Connection Wizard dialog click Next to allow all users to use this connection. From the next dialog name the new connection and click Finish.

The new dial-up connection dialog should now be displayed (Figure 9). Before the new dial-up connection can be used, the serial port speed must be verified. To verify the serial port speed click Properties from the dial-up connection dialog (Figure 9).

Figure 9. Connect tini direct connection.
Figure 9. Connect tini direct connection.

With the General tab selected, click Configure (Figure 10).

Figure 10. TINI direct connection.
Figure 10. TINI direct connection.

Ensure that the Maximum speed is set properly and click OK. The default TINI speed is 19200 (Figure 11).

Figure 11. Modem configuration.
Figure 11. Modem configuration.

Click OK to dismiss the options dialog. The new dial-up connection is now ready for use.

Configuring the PPP Command

Windows Direct Serial Link requires the exchange of string tokens before the PPP link can be negotiated. As a client, Windows issues the string "CLIENT" to which the TINI needs to issue the string "CLIENTSERVER." When operating as a server, TINI is required to issue the string "CLIENT," to which Windows responds with the string "CLIENTSERVER." This string exchange must occur before Windows allows the PPP connection to proceed. This string exchange is peculiar to Windows and is not required by other hosts.

Looking at the PPP command source, the waitForCall method can be modified to handle the exchange of strings. Listing one shows the modified waitForCall method.

Listing 1: Modified waitForCall Method
private  boolean waitForCall()
{
    waitFor("CLIENT", "CLIENTSERVER", 0);

    return true;
}
The waitFor method takes three parameters—the string to wait for, a response string to send when the wait string is received, and the amount of time to wait for the expected string before returning false. A timeout value of zero blocks indefinitely.

After Slush has been recompiled and downloaded, the TINI PPP server can be started with the following command line.
ppp -s -x 0 -a 192.168.1.1 -r 192.168.1.2
Where -s indicates server operation, -x 0 specifies serial port zero, -a specifies the local IP address, and -r specifies the IP address given to the remote peer, Windows in this example.

Making the Connection

As stated earlier, connectors J3 and J6 of the TINI Sockets E10 board are both connected to serial zero of the TINIm390 module and cannot be used simultaneously. To use the TINI sockets E10 board with this example, the Slush serial server will need to be stopped from a telnet session over the Ethernet network. The command to stop the serial server is "stopserver -s". Once the serial server is stopped, move th eserial cable between the Slush serial port and J6 to the dial-up networking serial port and J3. From the Slush telnet prompt enter the command listed above to start the PPP server. From Windows start the new direct serial dial-up connection using the username root and password tini.

Example 2: Connecting to an ISP

This example demonstrates the capability of a TINI system to use a modem to connect to an ISP. In this example, TINI is the client and the ISP is the server. Figure 12 shows an overview of the system.

Figure 12. Modem connection system.
Figure 12. Modem connection system.

The PPP command includes rudimentary modem configuration commands. These commands may be modified or additional commands added to configure a specific modem. The source code should also be modified to include the appropriate phone number to dial when PPP is started. Listing 2 shows the static array used to initialize the modem.

Listing 2: Modem Initialization Array

private  ModemCommand[] dialSequence = { new ModemCommand("AT\r", "OK", 5),
                                         new ModemCommand("ATZ\r", "OK", 5),
                                         new ModemCommand("ATM1L0\r", "OK", 5),
                                         new ModemCommand("ATDT 1234567", "CONNECT", 45)
                                       };
The ModemCommand object is a structure to hold an AT command, an expected response, and a response timeout value. Elements of the dialSequence array are sent to the modem sequentially from zero to dialSequence.length-1. Any special modem commands should be added to this structure. The phone number in the last element should be changed to correspond with the ISP being called.

As stated earlier, connectors J3 and J6 of the TINI Sockets E10 board are both connected to serial zero of the TINI module and cannot be used simultaneously. To use the TINI sockets E10 board with this example the Slush serial server needs to be stopped from a telnet session over the Ethernet network. The command to stop the serial server is "stopserver -s." Once the serial server is stopped, remove the Slush serial cable from J6 and connect the modem to the J3 connector. From the Slush telnet prompt enter the command "ppp -d -x0 -u username -p password." After the entering the PPP command the modem should be initialized and the phone number should be dialed. To close the connection use the command "ppp -c."

Common Pitfalls

Listed here are some common problems while using TINI PPP:
  • Having two interfaces on the same network. Configuring the PPP interface to be on the same network as the Ethernet interface does not work. The network stack scans the networking interface list starting with the Ethernet, then loopback, then PPP. The first interface that matches an outgoing packet is selected. If the Ethernet and PPP interfaces are on the same network, the Ethernet interface receives all outgoing PPP traffic.
  • Versions of PPP prior to TINI 1.1 do not support CHAP authentication. Versions prior to TINI 1.1 only support PAP authentication. This is usually not a problem unless the ISP being called only supports CHAP authentication. If problems are encountered with Windows hosts, ensure that unsecured passwords are allowed.
  • Using serial zero DCE connector with a modem. The serial zero DCE (J6) connector on the TINI Sockets E10 board uses the DSR line as a reset. Some null modem cables connect the carrier detect signal of the modem to this line, causing the TINI to be reset when a connection is established.
  • Passive mode for direct serial connections. When TINI is configured as a server using a direct serial connection with a non-Windows host, set the passive option to true. This allows TINI to wait for a connection without timing out.

Java is a trademark of Sun Microsystems, Inc.
TINI is a registered trademark of Maxim Integrated Products, Inc.
Windows is a registered trademark of Microsoft Corp.

We Want Your Feedback!


Automatic Updates
Would you like to be automatically notified when new application notes are published in your areas of interest? Sign up for EE-Mail™.



More Information  APP 702: Jun 07, 2002
DS80C390 Dual CAN High-Speed Microprocessor Full Data Sheet
(PDF, 2MB)
Free Samples
DS80C400 Network Microcontroller Full Data Sheet
(PDF, 2.1MB)
Free Samples
DSTINIM400 Networked Microcontroller Evaluation Board Full Data Sheet
(PDF, 876kB)
 

Download, PDF FormatDownload, PDF Format (321kB)
 AN702, AN 702, APP702, Appnote702, Appnote 702


      Privacy Policy    Legal Notices

      Copyright © 2008 by Maxim Integrated Products, Dallas Semiconductor