NATIONAL INSTRUMENTS PCMCIA-485 Serial Interface Device User Guide
- June 12, 2024
- NATIONAL INSTRUMENTS
Table of Contents
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.
- Linux Serial-Programming-HOWTO by Peter Baumann. You can find the latest version of this document at the following locations: ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/Serial-P programming-HOWTO. http://metalab.unc.edu/LDP/HOWTO/Serial-Programming-HOWTO.html.
- Linux Serial-HOWTO by David Lawyer. You can find the latest version of this document at the following locations: ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/Serial-H OWTO. http://metalab.unc.edu/LDP/HOWTO/Serial-HOWTO.html.
- Linux PCMCIA-HOWTO by David Hinds. You can find the latest version of this document at the following locations: ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/PCMCIA-H OWTO. http://metalab.unc.edu/LDP/HOWTO/PCMCIA-HOWTO.html.
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.
- To modify the device in the /etc/pcmcia/config file, enter the following: linux# pico /etc/pcmcia/config
- 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 -HUP
cat /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
- 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
- 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
- Test and Measurement Systems, a part of Emerson - NI
- Test and Measurement Systems, a part of Emerson - NI
- PCMCIA-485 National Instruments Serial Interface Device | Apex Waves
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>