1 / 53

Serial Ports

Serial Ports. Chapter 9. Understand serial port terminology. Understand serial port capabilities. Understand serial port signals. Understand serial port configuration Understand serial port management. Understand modem connections and setup. Disabling serial port services.

gilles
Télécharger la présentation

Serial Ports

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Serial Ports Chapter 9

  2. Understand serial port terminology. • Understand serial port capabilities. • Understand serial port signals. • Understand serial port configuration • Understand serial port management. • Understand modem connections and setup. • Disabling serial port services. • Understand new-technology serial ports. Chapter Goals

  3. Serial Ports • Serial ports are universal I/O ports. They are available on almost every computer. • Serial ports are slow, but they are flexible. • Serial ports can be used for terminal connections, printer connections, network connections, modem connections, keyboards, mice, and other input/output devices. Serial Ports

  4. Serial Ports • Serial ports use standard pin-outs for the connectors. The most common of these standard is known as RS-232. • Proposed by the Electronic Industries Association (EIA). • RS stands for Recommended Standard. • RS-232 defines the pin-outs of the connectors and the voltage levels allowed on each pin of a serial port connection. RS-232 is functionally identical to the CCITT V.24/V.28 standards. • RS-232 defines two types of signals; Data signals, and flow-control signals. Serial Ports

  5. Serial Ports • The RS-232 standard defines how the flow control signals interact to manage the flow of data across a connection. • The full functionality of the RS-232 standard is rarely supported, as several of the signals are not required for simple communications connections. • Traditional RS-232 uses 22 gauge stranded, twisted-pair cable. • RS-232 signal voltages are defined to be +/- 12 volts DC. • RS-232 connections terminate in a 25 pin D-connector (also known as a DB-25). The computer has the receptacle, while the cable has a plug. • According to the standard, RS-232 will drive a 50 foot cable at 9600 baud. Serial Ports

  6. Newer standards have emerged since RS-232 became the standard. • RS-422/RS-423 use lower signaling voltages (+/- 5 volts DC) , and can drive longer lines. • RS-422 is electrically compatible with CCITT recommendation V.11. • RS-423 is electrically compatible with CCITT recommendation V.10. • RS-449 is the standard which defines the pin-outs and connector characteristics for the RS-422/RS-423 standards. • MOST RS-422/RS-423 implementations will connect directly to RS-232 devices and function properly. Serial Ports

  7. RS-422 uses differential line drivers, and can drive several kilometers of cable. • RS-423 uses single-ended line drivers and can drive up to a kilometer of cable. • All of these standards use the same signals, so we will focus most of our discussion on the RS-232 standards. Serial Ports

  8. RS-232 defines two cabling configurations: DTE (Data Terminal Equipment) and DCE (Data Communications Equipment). • These cabling configurations determine which signals a device expects on what pins. • Most computers, printers, and terminals are DTE equipment. • Modems are DCE equipment. • Cables for terminals connections are different from the cables used for modem connections! Serial Ports

  9. Serial Ports

  10. Although 25 pins are defined, many devices only use a small subset (4 to 9 pins). These devices require a software generated carrier signal. Serial Ports

  11. Devices which provide for limited modem control use 9 pin connections. Serial Ports

  12. Hardwired connections generally use a straight-through connection. Serial Ports

  13. Some devices require a null-modem cable. This cable fools the device at each end on the link into thinking it is receiving the proper modem control signals, while in fact each device is generating it’s own modem control signals. Serial Ports

  14. Some manufacturers have come out with alternate connectors for use with RS-232 connections: Apple uses a Mini-Din 8 connector, PC’s use DB-9 connectors, and some patch panels and other serial equipment use telephone style RJ-45 connectors. Serial Ports

  15. Working With Serial Devices • When dealing with serial devices there are several complicating factors: • You must set the communication speed (baud rate) of the device and the serial port. • You must set the correct form of parity checking on the device and the serial port. • You must set the number of stop bits to be used on the device and the serial port. • You must set the word length on the device and the serial port. Serial Ports

  16. Terminal Setup (Software) • The built-in terminal devices on a UNIX workstation are usually /dev/ttya (/dev/term/a) and /dev/ttyb (/dev/term/b). • The modem control equivalents of ttya and ttyb are /dev/cua0 /dev/cua1. • For any serial connection you must set up certain system parameters: • You must tell the system to listen for logins on a terminal port. • Dial-up modems listen for logins, but they must also monitor modem control signals to control the status of the link. • Dial-out modems require setup information in /etc/remote so the tip and cu commands know how to talk to the modem. Serial Ports

  17. Serial Ports • Most terminals are used as login devices by the users. The sequence of events to start up a login session are: • User enters login name at the getty prompt. • Getty executes login • login requests a password, and confirms it against /etc/passwd. • login prints the message of the day from /etc/motd. • login runs a shell and sets the TERM variable. • The shell executes the appropriate startup files for the user. • The shell prints the UNIX prompt and waits for input. Serial Ports

  18. Managing Terminals • When the user logs out, init takes over and starts a new getty process. • Getty reads configuration information from /etc/ttytab (BSD) or /etc/inittab (ATT) • /etc/ttytab contains entries which specify the terminal port, the program to run on that port, the terminal type connected to the port, {on|off} and possibly [secure]. • ttya “/usr/etc/getty std.9600” wyse50 on • The getty program checks /etc/gettytab to determine what the “std.9600” entry means, and sets the line disciplines appropriately. • 2|std.9600|9600-baud::sp#9600: Serial Ports

  19. Managing Terminals • In the ATT model, getty uses the /etc/inittab file to determine how to set the serial port. • The /etc/inittab file consists of entries with the format id:run-levels:action:process. • A typical entry might be: • 11:234:respawn:/etc/getty tty11 9600 • The getty program consults the /etc/gettydefs file to determine how to set the port disciplines: • 9600# B9600 HUPCL # B9600 SANE IXANY HUPCL #login: #4800 • The format of the entries is: label#initflags#finalflags#prompt#next Serial Ports

  20. Managing Terminals • The Service Access Facility (SAF) - is one method for managing serial devices under Solaris. It is a suite of commands which interacts with the serial device driver to allow the system administrator to configure the port hardware, and the port monitor software. • The SAF allows you to • Manage and troubleshoot TTY devices • Manage and troubleshoot network print service requests. • Manage and troubleshoot the Service Access Controller. • Add and manage “listen” port monitor services. • Add and manage ttymon port monitor services. Serial Ports

  21. Managing Terminals • The SAF is not a single program; it is a suite of programs and background processes which control other programs which do all of the work. • The top-level SAF program is the Service Access Controller (SAC). • The SAC is initialized at system boot. It is started by the scripts in the directory /etc/init.d. • The SAC initializes the system environment by interpreting the /etc/saf/_safconfig script. This script allows the system administrator to customize the serial port parameters for the machine. Serial Ports

  22. Managing Terminals • After the environment is set up, the SAC interprets the /etc/saf/_sactab file to start and customize the port monitors. • Each port monitor is spawned as a new process. The SAC maintains control of these processes, and is therefore the parent process. • Each child process started by the SAC invokes the appropriate /etc/saf/port_monitor/_config script to customize it’s own environment and start any processes required to enable the login process. Serial Ports

  23. Managing Terminals • Solaris implements two port monitors; ttymon, and listen. • ttymon is the program which monitors the serial ports, and directs data to/from the ports to the correct destination. • The ttymon command uses the definitions in the /etc/ttydefs file to set line disciplines and baud rate for each port. • Once the line disciplines are set, the ttymon hands control of the port over to the login process. Serial Ports

  24. Serial Ports

  25. Managing Terminals • The sacadm command is used to administer the SAC. • sacadm allows the system administrator to add/remove port monitors, start/stop port monitors, enable/disable port monitors, install/replace configuration scripts, install/replace port monitor configuration scripts, and print port monitor information. • sacadm accepts input from stdin, and uses this input to control the SAC. • Non-privileged users may use sacadm to request the status of print jobs, port monitors, and system configuration scripts. Serial Ports

  26. Serial Ports

  27. Managing Terminals • The ttyadm command is used to format ttymon administrative information for interpretation by the sacadm and pmadm commands. • The ttyadm command does not work with listen monitors. Serial Ports

  28. Managing Terminals • Listen is the port monitor program which monitors the network for service requests from other hosts. • Listen monitors may also manage some network services which are not controlled by the inet facility. • For example the network printer services are controlled by the listen port monitor. • The sacadm, pmadm, and nlsadmin commands are used to configure/administer the listen port monitor. • We will discuss the listen port monitor in more detail in the section on printers, and again in the networking section. Serial Ports

  29. The Service Access Controller

  30. Managing Terminals • Admintool is another method for managing serial devices. It is a point and click GUI which interfaces to the SAF commands for you. • Because admintool relies on the command line form of the commands, and sometimes you want to do non-standard things, it is best to discuss how to use the command line commands. Once we understand them, we may never use them again...but understanding them is important! Serial Ports

  31. Managing Terminals • In order to connect a hardwired terminal to the system we must first: • Set up the port monitor software. • As root, use the sacadm command to enable login services on the port. • NOTE: You must use the bourne shell to execute the sacadm commands, or they may fail or provide unexpected results. • Configure the terminal. • Test the setup to determine if the setup is correct. Serial Ports

  32. Managing Terminals • To configure the software, first we check to see if a ttymon is already running on the port: • sacadm -l -t ttymon • If no ttymon is running, set one up: • sacadm -a -p zsmon -t ttymon -c /usr/lib/saf/ttymon -v ‘ttyadm -V’ • NOTE: The string zsmon is known as the Port Monitor Tag (PMTAG) Serial Ports

  33. Managing Terminals • Check to see if a service running on the zsmon port monitor: • pmadm -l • If a service is running, remove it (Note, the SVCTAG is generally the port name such as ttya. The preceding command will tell which SVCTAG to use here). • pmadm -r -p (PMTAG) -s (SVCTAG) • Set the port line disciplines and start login for the terminal: • pmadm -a -p zsmon -s (SVCTAG) -i root -fu -v \ ‘/usr/sbin/ttyadmin -V’ -m “‘/usr/sbin/ttyadm -l BAUDRATE \ -p “MESSAGE” -d /dev/term/(PORT) -T vt100 -i \ ‘terminal disabled’ -s /usr/bin/login -S -y’” Serial Ports

  34. The stty command is a utility that allows the user, or administrator, to set specific terminal port characteristics. • Typical uses of the stty command include setting the baud rate, size of the display, parity, and special characters (erase character, interrupt character, redraw character, and so on). • stty also allows the user to view the current settings of these (and other) parameters. • Viewing Port Settings Using stty • The invocation of stty that allows the user to view port settings ison of: stty a or stty all or stty everything • The second command lists several variants, because each version of UNIX seems to have its own flag to cause stty to display this information. Serial Ports

  35. Terminal Problems and Solutions • Most terminal problems are caused by one of: • You forgot to make init re-read the configuration files. Typing kill -1 1 (as root) will cause this to happen. • Forgot to set soft carrier mode on 3 wire connections. • Forgot to use the cu device for modem control connections. • Wrong type of cable (wrong pinout, null-modem instead of straight through, bad cable) • Port Monitor incorrectly configured. • Wrong line discipline information at one end of the link (parity, baud rate, stop bits). • Bad port/terminal Serial Ports

  36. Terminal Problems and Solutions • Sometimes a program will wedge a terminal. Vi, and any other screen oriented software can exit non-gracefully and cause the terminal to be left in a strange state. Many times you can recover from this. • On BSD systems, type reset • On ATT systems, type stty sane • Sometimes the terminal will not accept a <CR>, so you have to use <LF> or CTRL-J after the commands to get any action from the system. Serial Ports

  37. Modem Control Signals • Hard and Soft carrier • UNIX systems expect to see the Data Carrier Detect signal (pin 8) active (+5VDC) when a device is connected and ready to communicate. • If the hardware actually expects pin 8 to be active, then the device is said to be using “hard carrier”. • Many systems employ software which pretends that the DCD signal is active. These systems are using “soft carrier”. • Soft carrier simplifies the wiring, and is often adequate for terminal connections. • Soft carrier is not adequate for modem connections, or for many printer connections. Modems

  38. Modem Control Signals • The CTS/RTS signals are used to control data-flow between the devices. • Flow control is essential for modems, and is also very useful for many printers. • Many printers have limited data buffers. These printers have to tell the computer to stop sending data while they drain their buffers. • Some printers use X-ON/X-OFF (Control-S, Control-Q) to signal the computer when to stop/start sending data. This method is not always reliable. • Most printers prefer to use use the modem-control signals to control data-flow. Modems

  39. Modem Control • When a device is wired for modem control operation, the CTS/RTS signals define when each device may send data to the other. If DCD is true, and: • a device sets it’s Clear-To-Send signal to true, then it is signaling the other end of the connection that it is ready to receive data. • a device sets it’s Request-To-Send signal to true, it is telling the device at the other end of the connection that it is ready to send data. • If the Data Carrier Detect signal transitions to false, the carrier has been lost, so the system should log the user out, and the connection should be terminated. Modems

  40. Managing Modems • Modems take a little more setup information in the way of configuration files. • The /etc/remote file contains information used for dial-out connections by the tip and cu programs. A typical entry might be: • dial9600|9600 Baud \ Hayes:dv=/dev/cul0:br#9600:cu=/dev/cul0:at=hayes:du: • systema:pn=5551212:tc=dial9600 • monet:pn=@:tc=dial9600 • The /etc/phones file contains entries of the form: • monet 8,,510,555-4567,,,,xxxx-xxx • cc 5552530 Modems

  41. Managing Modems • In order to connect a bi-directional modem to the system we must first: • Set the PROM monitor to enable modem control signals. • eeprom ttya-ignore-cd=true • eeprom ttya-rts-dtr-off=true • Connect the modem to the port with a straight through cable. DO NOT use a null-modem cable, nor should you cross any of the pins in the modem cable. Modems

  42. Managing Modems • Set up the port monitor software. • As root, use the sacadm command to enable login services on the port. • NOTE: You must use the bourne shell to execute the sacadm commands, or they may fail or provide unexpected results. • To configure the software, first we check to see if a ttymon is already running on the port: • sacadm -l -t ttymon • If no ttymon is running, set one up: Modems

  43. Managing Modems • sacadm -a -p zsmon -t ttymon -c /usr/lib/saf/ttymon -v ‘ttyadm -V’ • NOTE: The string zsmon is known as the Port Monitor Tag (PMTAG) • Check to see if a service running on the zsmon port monitor: • pmadm -l • If a service is running, remove it (Note, the SVCTAG is generally the port name such as ttya. The preceding command will tell which SVCTAG to use here). • pmadm -r -p (PMTAG) -s (SVCTAG) • Set the port line disciplines and start login for the modem: Modems

  44. Managing Modems • pmadm -a -p zsmon -s (SVCTAG) -i root -v \ ‘/usr/sbin/ttyadmin -V’ -fu -m “‘/usr/sbin/ttyadm -p \ “MESSAGE” -d /dev/term/(PORT) -s /usr/bin/login -l \ BAUDRATE -b -S n -m ldterm,ttcompat’” -y “dial-in/out \ on serial port” • Configure the modem. • Test the setup to determine if the setup is correct. Modems

  45. Using Dial-in Passwords • Some versions of UNIX provide a dial-in password, an additional aid for defending dial-in terminal access. The dial-in password is controlled by two files, /etc/dialups and /etc/d_passwd. • 1. Create /etc/dialups. This file contains a single entry per line with the path of each dial-in modem line (e.g., /dev/term/a). • 2. Create /etc/d_passwd. This file contains a single entry for each possible shell a dial-in modem user might use. The following is a sample d_passwd file. /usr/lib/uucp/uucico: passwd-goes-here: /usr/bin/csh: passwd-goes-here: /usr/bin/ksh: passwd-goes-here: /usr/bin/sh: passwd-goes-here: • 3. Insert an encrypted password for each shell in place of the passwd-goes-here strings shown previously. Modems

  46. A host can be a PPP client or a PPP server. • If your host is dialing out to another server, your host is a PPP client. • If other hosts are dialing in to your system, your host is a PPP server. • Most operating systems provide tools for implementing both client and server sides of PPP. • The process a user goes through to establish a PPP link to a typical PPP server includes the following steps. • Dial into the server’s modem. • Log in using a valid user name and password pair. • At the shell prompt, issue the command ppp to start PPP on the server. • Start PPP on the user’s system. PPP

  47. Windows Point-to-Point Protocol (PPP) • The Microsoft PPP protocol is the Windows PPP client. • The PPP protocol setup is part of the Network and Dialup connections control panel. • The selections under this wizard are somewhat limited; the dial-up line can be a terminal-style dial-up, a PPP dial-up, or a SLIP dial-up line. • The NETWORK tab of the dial-up control panel allows you to select between the PPP and SLIP connections. PPP

  48. Linux includes the following utilities, used to configure the client end of the PPP link. • Kppp: The kppp utility is a PPP setup and dialer tool used under the KDE desktop manager. • WvDial: A PPP driver for Linux. This driver was designed with an emphasis on simplicity. • RP3: Short for RedHat PPP. RP3 includes a “wizard” interface to guide the user through the setup/configuration of the PPP link. • Linuxconf: A generalized tool for configuring and managing your Linux machine. Linuxconf includes a utility to help configure PPP. PPP

  49. Two new serial bus technologies have recently joined the mainstream offerings on computer systems: • the Universal Serial Bus (USB) and • FireWire interfaces. • These two interfaces are high-speed system interconnects that support devices beyond modems and terminals. • Both interfaces allow you to add disks, tapes, and network adapters to the system via the USB/FireWire ports. New Serial Ports

  50. USB Interface • The intent of the USB architecture is to provide a replacement for the aging serial and parallel ports on existing computers. • The traditional serial bus requires an IRQ, I/O space, and memory space for each port, and only one device can plug into each port. USB uses one IRQ no matter how many devices are in use. • USB cables consist of four wires. • Two of the wires supply voltage and two are data signal wires. • The bus operates at either 12 megabits per second or 1.5 megabits per second, depending on the attached device. • The devices tell the bus what their speed is through the voltage cables. High-speed devices shift the positive voltage lead while slow-speed devices shift the negative voltage. New Serial Ports

More Related