Here is a short description of how to configure the IPC@CHIP® PPP server. The PPP client and server API calls are part of the TCP/IP API. Only the configuration of the PPP server is described here.
PPP (the Point to Point Protocol) is a mechanism for creating and running TCP/IP over a serial link - be that a direct serial connection (using a null-modem cable), or a link made using a modem.
Other computers can dial into the IPC@CHIP® PPP server and communicate via the TCP/IP link using FTP, Telnet, Web, etc. in the same manner as with an Ethernet TCP/IP link. One major difference between a PPP and an Ethernet connection is of course the speed. A standard Ethernet connection operates at 10 Mbs maximum theoretical throughput, whereas an modem operates at speeds up to 56 kbps.
PPP is strictly a peer to peer protocol; there is no difference between the machine that dials in and the machine that is dialed into. However, it is still useful to think in terms of servers and clients. When you dial into a site to establish a PPP connection, you are a considered the client. The machine to which you connect (e.g. the IPC@CHIP®) is considered the server.
PPP on the IPC@CHIP® includes the subprotocols LCP and NCP(IPCP). Supported authentication protocols are PAP and CHAP.
Configuring the PPP Server
The PPP server must be configured using the CHIP.INI file sections [PPPSERVER] and [SERIAL].
Here is an outline of the steps required to configure the PPP server.
- Enable PPP server. Set ENABLE=1. By default, PPP server is disabled.
- Select a serial port for the PPP server with the COMPORT entry.
Important: The serial ports of the IPC@CHIP® do not have a DTR signal. So you have to configure your modem with DTR always on. (e.g. AT command for a ZyXEL modem: AT&D0)
- Increase the send queue and receive queue sizes of the chosen serial port. Recommended size is 4096 Bytes.
- Select the flow control mode for the PPP server serial port.
- Set the baud rate of PPP server's serial port, e.g.
BAUD=19200 (default is 38400).
- Select usage of an modem, e.g.
MODEM=1. The default is 0 (null modem cable).
- Set the IP address of the PPP server interface, e.g.
- Set the remote IP address for the PPP peer. There are three different possibilities for configuring the PPP server IP addresses on the IPC@CHIP®:
- a) If valid addresses for IP Address and remote IP address are declared in CHIP.INI, the PPP server wants to use this configured IP for its own and wants to configure the remote peer with the defined remote address.
- b) If only the IP Address is declared in CHIP.INI and the remote IP address is set to 0.0.0.0, the PPP server wants to use this configured IP address and expects the client to use his own address.
- c) If both entries IP address and remote IP address are set to 0.0.0.0, the PPP server expects an IP address from the peer.
- Define network mask and router default gateway.
Note about IP forwarding: The TCP/IP stack of the @CHIP-RTOS-PPC supports different network interfaces, Ethernet and PPP, so the IPC@CHIP® can forward IP packets between these interfaces. If you define a gateway in the PPPSERVER section of the CHIP.INI for the PPP server interface, it becomes the default gateway for all interfaces when a PPP link to the server is established. During a PPP server connection the command ipcfg indicates this default gateway. After the PPP session, the old gateway (if any) for the Ethernet interface will be restored. The @CHIP-RTOS-PPC TCP/IP API supports adding and deleting a default gateway.
- Choose the authentication mode.
- Initialize the modem. You can define three sets of modem initialization parameters. These parameters are used to initialize the modem at the start of the IPC@CHIP® @CHIP-RTOS-PPC and after a modem hang-up following a PPP session.
Each of the three parameter sets consists of the following four parameters:
- INICMDx string - Command sent to the modem to initialize it.
- INITANSWERx string - Expected modem response to initialization command.
- INITTIMEOUTx integer - Number of seconds to wait on answer from modem.
- INITRETRIESx integer - Number of times to repeat modem initialization sequence if a previous attempt fails.
INITRETRIES2=2 A timeout value 0 means wait forever for the modem's answer. If you enter the string NULL at an INITANSWERx (e.g.
INITANSWER0=NULL), the IPC@CHIP® PPP server will not wait for an answer from the modem.
- Define a maximum of three modem commands for getting connected to the remote peer.
CONNECTTIMEOUT1=60 These are the default values for modem connect commands. In this example the PPP server waits forever for the RING message and sends an ATA to the modem if it responds to the RING. After that the server waits a maximum of 60 seconds for a response to the CONNECT message. The modem link is established. The server now establishes the PPP connection to the remote client.
Note: Do not use the AT command ATS0=1. This will cause the modem to automatically answer the call without waiting for the PPP server. This is too fast for the PPP server.
- Hang-up the connection. The PPP server will attempt to hang-up the modem when either a connection is closed by a remote peer, or if the modem initialization failed during the IPC@CHIP® boot process.
- Control the "carrier" state of the modem during an established PPP session by activation of the DCD signal check with the CHIP.INI setting MODEMCTRL=3. The PPP server closes the current established PPP session, if it detects a "carrier loss" signaled by the connected modem with the serial port signal DCD=low. This setting is only valid, if the CHIP.INI entry COMPORT is set to UART1, UART2 or UART3 and MODEM=1.
- Control the "carrier" state of the modem during an established PPP session by execution of predefined modem commands at a specified interval of time. You also have to define three sets of modem control parameters. These parameters are used to check the online ("carrier") state of the modem during an established PPP connection.
- a) Enable online ("carrier") control sequence MODEMCTRL=1 or MODEMCTRL=2.
MODEMCTRL=1: After each (configured) time interval during which the PPP server receives no data, the server executes the configured modem commands (see example below).
MODEMCTRL=2: After each (configured) time interval the server executes the configured modem commands.
In both cases the server closes the connection, if one of the expected answers timed out. In this mode the configured modem commands are not printed via STDOUT at execution time, even if MODEMTRACE is enabled.
- b)Specify the required modem control command parameters:
- Define the time interval with CTRLTIME, e.g.
CTRLTIME=120, default is 60 seconds.
Define up to three modem control command parameters. Each of the three parameter sets consists of the following four parameters:
- CTRLCMDx string - Command sent to the modem to initialize it.
- CTRLANSWERx string - Expected modem response to control command.
- CTRLTIMEOUTx integer - Number of seconds to wait on answer from modem.
- CTRLRETRIESx integer - Number of times to repeat modem control sequence if a previous attempt fails.
CTRLRETRIES1=0 If you enter the string NULL at an CTRLANSWERx (e.g. CTRLANSWER0=NULL), the IPC@CHIP® PPP server will not wait for an answer from the modem.
Instead of MODEMCTRL =1 or =2, we recommended the "carrier loss" detection by DCD, provided by the CHIP.INI setting MODEMCTRL =3.
- Define a timeout value in seconds after which the PPP server hangs up the connection if no data comes in from client during this timeout period, e.g.
IDLETIME=160, default is 120 seconds.
IPv6 configuration of the PPP Server
PPP supports IPv6 with an additional Network control protocol (IPV6CP). IPv6 address configuration is done by a auto negotiation process. At connection time the peers negotiate an Interface-ID for the PPP device and auto configure their link-local scope addresses. The address configuration and other configuration data are retrievable by calling PPP_Server_Get_Cfg_IPv6().