NATIONAL INSTRUMENTS PCMCIA-485 Serial Interface Device User Guide

June 12, 2024
NATIONAL INSTRUMENTS

NATIONAL INSTRUMENTS PCMCIA-485 Serial Interface Device

USING PCMCIA SERIAL FOUR-PORT WITH LINUX
This document contains instructions to help you install and configure the National Instruments serial hardware for Linux. This document includes information about the PCMCIA-232/4 interface. This document assumes that you are already familiar with Linux.

Related Documentation

The following documents contain information that you might find helpful as you read this document.

Contributions
Thanks to Vern Howie for providing suggestions and examples from his serial suite. Also, thanks to David Hines, David Lawyer, Greg Hankins, and Peter Baumann for providing so much information in their HOWTOs.

Gather What You Need to Get Started

Before you install your PCMCIA serial card for Linux, make sure you have the following:

  • Linux kernel version 2.2.5 or later. The product has been thoroughly tested with kernel version 2.2.5; however, the product might work with earlier kernel versions. If you do not have kernel version 2.2.5 or later, or if you do not have the following options already compiled into your kernel, you need to recompile your kernel.
  • Include the following Character Devices options when you configure and recompile the kernel using make menuconfig:
    • Standard/generic dumb serial support
    • Extended dumb serial driver options
    • Support more than four serial ports
    • Support for sharing serial interrupts
  • Card Services (pcmcia-cs) 3.0.13 or later. To find the version of Card Services, enter the following: linux# cardctl -V The latest version of Card Services can be found at ftp://csb.stanford.edu/pub/pcmcia.
  • PCMCIA-SERIAL-4port.tar.gz. You can download this file from the National Instruments FTP site at ftp://ftp.natinst.com/ support/ind_comm/serial/Linux. After you have the file, extract and unzip it by entering the following:linux# tar zxvf PCMCIA-SERIAL-4port.tar.gz The tar command extracts and unzipsPCMCIA-SERIAL-4port.tar.gz and creates the subdirectory PCMCIA-SERIAL. Enter the following to make sure all necessary files are included: linux# cd PCMCIA-SERIAL linux PCMCIA-SERIAL# ls FIFO trigger serial test termios_program.c FIFOtrigger.c serial test.c
  • You need superuser privileges to do most of the steps and program segments in this document. You need to complete the first two steps in this section before you insure your PCMCIA serial card. You can use any text editor you are comfortable with.

Configure /etc/pcmcia/config to Recognize Your PCMCIA Card
Modify the serial_cs device so that the PCMCIA card manager knows what driver to link to the card.

  1. To modify the device in the /etc/pcmcia/config file, enter the following: linux# pico /etc/pcmcia/config
  2. In the file, edit the device “serial_cs” section to the following: device “serial_cs” class “serial” module “misc/serial”,”serial_cs”

Signal the Card Manager to Reload /etc/pcmcia/config
Enter the following. Notice that the “” is a forward single quote. linux# kill -HUPcat /var/run/cardmgr.pid`

Find out What Devices Were Assigned to Your Card
Insert your PCMCIA serial card. You should hear two consecutive high beeps. To see what serial device the card manager assigned to your card, enter the following:

  • linux# more /var/run/stab
  • Socket 0: National Instruments PCMCIA-485
    • serial serial_cs 0 ttyS2 4 66
    • serial serial_cs 1 ttyS3 4 67
    • Socket 1: empty
  • The devices listed as ttyS under National Instruments are your serial ports.

Configuration

View Your Hardware Resources

  • To see what system resources your serial card is using, use the setserial command, as follows: linux# setserial –gv /dev/ttyS
  • For example, to view the resources of /dev/ttyS2, you would enter: linux# setserial –gv /dev/ttyS2
  • Something similar to the following should appear: /dev/ttyS2, UART: 16550A, Port: 0x100, IRQ: 3

Enable FIFO Buffers
You can enable the transmit and receive FIFOs in the hardware andset the trigger levels of the FIFOs. Use FIFOtrigger (from yourPCMCIA-SERIAL directory) to enable the receive and transmit FIFOs andto set the trigger level of these FIFOs. FIFOtrigger enables the FIFOs ofonly one serial port. To enable the FIFO for your other serial ports, rerun FIFOtrigger with a different serial port specified in the command line.

Table 1. tx_trigger Values

Transmit FIFO Trigger Level tx_trigger
8 0x00
16 0x10

Table 1. tx_trigger Values (Continued)

Transmit FIFO Trigger Level tx_trigger
32 0x20
56 0x30

Table 2. rx_trigger Values

Receive FIFO Trigger Level rx_trigger
8 0x00
16 0x40
56 0x80
60 0xC0

Enter the following to use FIFOtrigger: linux PCMCIA-SERIAL#./FIFOtrigger

  The hardware issues a transmit empty interrupt when the number of characters in the transmit FIFO falls below the trigger level. Also, the hardware issues a receive full interrupt when the number of characters in the received FIFO rises above the trigger level. For more information on the FIFO buffers, refer to your PCMCIA serial getting started manually.If FIFOtrigger does not work immediately or if it causes a segmentation fault, enter the following to recompile FIFOtrigger.c and rerunFIFOtrigger. Also, the source code for FIFOtrigger is available for viewing and editing at FIFOtrigger.c, provided in the PCMCIA-SERIALdirectory.
  • Linux PCMCIA-SERIAL#gcc –O FIFO trigger.c –o FIFO trigger
  • Linux PCMCIA-SERIAL#./FIFOtrigger

FIFO Example
Enter the following to set the receive FIFO trigger level to 56 and the transmit level to 32 for /dev/ttyS5: Linux PCMCIA-SERIAL# ./FIFOtrigger 5 0x80 0x20

Configure struct termios
Every serial port has an associated struct termios. By using this struct termios in a program, you can set the baud rate, character size(number of data bits), parity, control characters, flow control, and input and output mode for each serial port. For further information on the termios structure itself, refer to the terms man page. To view the terms man page, enter the following: linux# man termios To configure your serial port, use a program segment similar to the termios_program.c in your PCMCIA-SERIAL directory.

Test the Configuration

After you connect the cables to the port (as shown in your PCMCIA serial getting started manually), run the serial test program (from your PCMCIA- SERIAL directory) to verify your setup, as shown in the following: Linux PCMCIA-SERIAL#./serialtest
If the test is successful, it will display a SUCCESS message. If the test hangs, type to exit the program. Also, make sure the cable is attached tothe correct ports.To test /dev/ttyS2 and /dev/ttyS3, connect a cable between the two ports and enter the following: Linux PCMCIA-SERIAL# ./serialtest 2 3If serial test does not work immediately or if it causes a segmentation fault, enter the following to recompile serialist.c and rerun the serial test. Also, the source code for serialists is available for viewing and editing at serial test.c provided in the PCMCIA-SERIAL directory.

  • Linux PCMCIA-SERIAL# gcc serial test.c –o serial test
  • Linux PCMCIA-SERIAL# ./serialtest

Using PCMCIA Serial with Linux:www.natinst.com.

natinst.com™, National Instruments™, and NI-Serial™ are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies.322568A-01 © Copyright 1999 National Instruments Corp. All rights reserved.

COMPREHENSIVE SERVICES: We offer competitive repair and calibration services, as well as easily accessible documentation and free downloadable resources.
SELL YOUR SURPLUS: We buy new, used, decommissioned, and surplus parts from every Ni series. We work out the best solution to suit your individual needs.

  • Sell For Cash
  • Get Credit
  • Receive a Trade-In Deal

OBSOLETE NI HARDWARE IN STOCK & READY TO SHIP: We stock New. New Surplus. Refurbished. and Reconditioned NI Hardware.

Request a Quote CLICK HERE (PCMCIA-485 National Instruments Serial Interface Device | Apex Waves) PCMCIA-485

Bridging the gap between the manufacturer and your legacy test system.

All trademarks, brands, and brand names are the property of their respective owners.

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

NATIONAL INSTRUMENTS User Manuals

Related Manuals