1. IMPORTANT - 11/13/2015: In light of a possible breach we have scrubbed all passwords. You will need to request a password reset through the site. Click here for more information.

Linux+: Hardware Part 11 – Serial and Parallel Ports

Discussion in 'Linux Other' started by Jarret W. Buse, Feb 3, 2014.

  1. Jarret W. Buse

    Jarret W. Buse Well-Known Member Staff Writer

    Jul 3, 2013
    Likes Received:
    Linux+: Hardware Part 11 – Serial and Parallel Ports

    Before the introduction of the Universal Serial Bus (USB) and such, external devices were connected by either the Serial or Parallel Port. Serial Ports were mainly used for modems while Parallel Ports were usually used for printers.

    Serial Ports

    Serial Ports have two main connector types: 9 and 25 pin, as shown in Picture 1.

    Hardware 11 - Picture 1.JPG
    PICTURE 1​

    The Serial Port transfers data serially. Serial transfers are done one bit at a time. Between two devices, such as the Personal Computer (PC) and a modem, the signaling needs to be synchronized to accept proper communication. The synchronizing does not depend on the system clock, so it is termed asynchronous. Before each set string of data (specified by the Data Bits), a start bit is sent followed by the Data Bit length and then a stop bit to end the asynchronous transfer.

    There are a few settings for a serial port to aid in establishing asynchronous transfer. The first is speed. There are various speeds that can be used by the Serial Port and the device and both must be set to the same speed to allow communications. The serial speeds are 75, 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bits/second.

    Other than speed, there are three other main settings required to be the same between the port and device. The settings are: data bits, parity and stop bits.

    Data Bits signifies the number of bits in a character. The possible settings are 5 to 9 where 8 is the typical setting since it is a byte.

    Parity is used to allow for error detection. There are five settings for Parity.

    1. None (N)
    2. Odd (O)
    3. Even (E)
    4. Mark (M)
    5. Space (S)
    The ‘None’ setting disables the Parity, so there is no error detection. If Error Detection is needed, it can be done with the communication software.

    The ‘Odd’ and ‘Even’ settings work in a similar fashion. The bits which are set to ‘1’s are counted. In an ‘Odd’ setting, the parity bit is set to ‘1’ if the count is even which will make the total count ‘Odd’. For the ‘Even‘ setting, the parity bit is set to ‘1’ if the count is odd to make the total count ‘Even’.

    The ‘Mark’ setting will set the Parity bit to a ‘1’ at all times. This allows for very little error detection since only one bit is checked.

    The ‘Space’ setting will set the Parity bit to a space signal. Again, this does not allow for a great amount of error detection.

    The Stop Bits are another setting required to allow communications between the port and the device. The number of Stop Bits sets how many bits are sent after the number of specified Data Bits.

    NOTE: The conventional notation for the settings is Data/Parity/Stop (D/P/S). For example, a setting with 8 Data Bits, No Parity and 1 Stop Bit would be (8/N/1).

    Another setting for the Serial Port is Flow Control. Flow Control can be either Hardware Flow Control or Software Flow Control. Flow Control is used to pause and resume the transmissions when a device is getting full buffers. With Hardware Flow Control, the pause and resume signals are sent over two connections that are designed specifically for the purpose. The Software Flow Control sends the pause and resume signals over the same connections as the data which can sometimes cause problems.

    NOTE: For all the settings, check the device manual for proper settings.

    The devices in Linux are under the /dev/ directory. Each Serial Port has two device names; one name, /dev/ttyS# for dialing in and /dev/cua# for dialing out. The first Serial Port on a system is /dev/ttyS0 and /dev/cua0.

    Be aware of the settings for the Serial Ports, which are sometimes referred to as Communication Ports (COM). Serial Port 1 is referred to as COM1, Serial Port 2 is COM2, etc. The Serial Port Settings are as follows:

    • COM1 – IRQ 4 – I/O 0x3F8
    • COM2 – IRQ 3 – I/O 0x2F8
    • COM3 – IRQ 4 – I/O 0x3E8
    • COM4 – IRQ 4 – I/O 0x2E8
    Linux Settings for the devices are as follows:

    • Incoming COM1 - /dev/ttyS0
    • Outgoing COM1 – dev/cua0
    • Incoming COM2 - /dev/ttyS1
    • Outgoing COM2 – dev/cua1
    • Incoming COM3 - /dev/ttyS2
    • Outgoing COM3 – dev/cua2
    • Incoming COM4 - /dev/ttyS3
    • Outgoing COM4 – dev/cua3
    Parallel Ports

    Parallel Ports are sometimes referred to as Printer Ports since these ports are mainly used for printers. The Parallel Port comes in a 25 pin configuration as shown in Picture 2.

    Hardware 11 - Picture 2.JPG
    PICTURE 2​

    Unlike Serial Ports, Parallel Ports transmit data in parallel. This means that eight bits of data are sent on eight different lines at once. Since a Parallel Port can send one byte of data at a time, it is faster than Serial Ports.

    There are two standards which provide a faster throughput for the Parallel Port: Enhanced Parallel Port (EPP) and Extended Capabilities Port (ECP).

    EPP can achieve faster throughput since the communication setup is managed by the hardware and not the software.

    ECP uses Direct Memory Access (DMA) to move data to and from the Parallel Port.

    NOTE: Parallel Ports can be bi-directional. This means that data can move to and from the Parallel Port to the Parallel Device, such as a printer. This can allow software drivers to recognize when a printer is out of paper or not powered on by receiving information from the printer instead of just sending it.

    These devices in Linux are under the /dev/ directory. Each Parallel Port has a device name of /dev/lp#. The first Parallel Port on a system is /dev/lp0 and the second Parallel Port is /dev/lp1.

    Be aware of the settings for the Parallel Ports, which are sometimes referred to as Line Printer or Line Printer Terminal (LPT). Parallel Port 1 is referred to as LPT1, Parallel Port 2 is LPT2, etc. The Parallel Port Settings are as follows:

    • LPT1 – IRQ 7 – I/O 0x3BC - 0x3BF
    • LPT2 – IRQ 7 – I/O 0x378 - 0x37F
    • LPT 3 – IRQ 5 – I/O 0x278 - 0x27F
    NOTE: The Parallel Port settings are set in the BIOS on newer systems. For Add-in cards, the settings can be set with DIP switches.

    Attached Files:

    • slide.jpg
      File size:
      26.9 KB
    ZHANG/ZHIKUN and DevynCJohnson like this.

Share This Page