National Instruments PCI-232-4, PCI-232-2, PCI-485-8, PCI-232-8, PCI-485-4, PCI-485-2 User Manual
Specifications and Main Features
Frequently Asked Questions
User Manual
NOTE TO USERS
U
SING
PCI S
Contents
ERIAL 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 PCI-232/2, PCI-232/4, PCI-232/8, PCI-485/2,
PCI-485/4, PCI-485/8, PCI-232/2 Isolated, PCI-232/4 Isolated, PCI-485/2
Isolated, and PCI-485/4 Isolated interfaces.
This document assumes that you are already familiar with Linux.
Related Documentation............................... ............................................2
Test the Setup..........................................................................................11
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.
Thanks to Vern Howie for providing suggestions and examples from his
serial suite. Also, thanks to 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 PCI serial interface for Linux, make sure you have
the following:
•Linux kernel version 2.2.3 or later. The product has been thoroughly
tested with kernel version 2.2.3; howe ver , the product might work with
earlier kernel versions.
If you do not have kernel version 2.2.3 or later, or if you do not have
the following options already compiled into your kernel, you need to
recompile you kernel. Include the following options when you
configure and recompile the kernel using
Using PCI Serial with Linux2www.natinst.com
make menuconfig.
a.General Setup
–PCI Support
–PCI Quirks
–Backward-compatible
/proc/pci
b.Character Devices
–Standard/generic dumb serial support
–Extended dumb serial driver options
–Support more than four serial ports
–Support for sharing serial interrupts
•
setserial 2.14 or later. To find the version of setserial
,
enter the
following:
linux# setserial –V
•PCI Utilities 1.10 or later. You can download PCI Utilities 1.10 from
ftp://metalab.unc.edu/pub/Linux/hardware
•PCI-SERIAL.tar.gz. You can download this file from the National
Instruments FTP site at
ind_comm/serial/linux/
ftp://ftp.natinst.com/support/
After you have the file, extract and unzip it by entering the following:
linux#tar zxvf PCI-SERIAL.tar.gz
The tar command extracts and unzips PCI-SERIAL.tar.gz and
creates the sub-directory
This section is for experienced Linux users who are familiar with the
lspci and setserial tools. If you are not familiar with either of these
tools or if you require a detailed explanation of the steps, skip to the next
section, Setup.
1.If you do not have enough available serial devices (
/dev/ttyS*) for
each port on your multiport interface, create a new serial device by
entering the following:
linux# cd /dev
linux /dev# ./MAKEDEV ttyS<
port number
>
2.Find the port address, IRQ, and memory assignment of your PCI serial
interface by enter the following:
linux# lspci -v -n -d 1093:*
3.Assign the serial driver to your devices. Make sure you precede the
port addresses with
0x.
•For a PCI-232 interface, enter the following:
linux# setserial /dev/ttyS<
16550a port <
^fourport
port address
port number
> irq <
> uart
irq
>
•For a PCI-485 interface, which supports a higher baud_base of
460.8K at startup, enter the following:
linux# setserial /dev/ttyS<
16550a port <
baud_base 460800 ^fourport
port address
port number
> irq <
> uart
irq
>
4.Enable the PCI interrupt on your interface. To use intenable (from
the
PCI-SERIAL directory) to enable interrupts on your PCI serial
interface, enter the following:
linux PCI-SERIAL# ./intenable <
found in lspci
pci memory address
>
5.If you have a PCI-485 interface, set the transcei ver mode for each serial
port. Refer to the section Select Transceiver Mode for more
information about selecting a PCI-485 transceiver mode.
6.After you connect a cable between the two ports, test the setup by
running
linux#./serialtest <
serialtest (from the PCI-SERIAL directory).
port number
receive port number
>
> <
transmit
Using PCI Serial with Linux4www.natinst.com
Setup
Create Devices
After you install the serial hardware (as shown in your PCI serial getting
started manual), follow these steps to set up the interface.
Create a device for each port on your multiport interface. You only need to
do this step once. Port address is the I/O address of the device, and port number is the device/serial port number of the port. Port number is used in
the following context:
your computer are typically named from
port number you choose needs to be four or greater.
ttyS<
port number
/dev/ttyS0 to /dev/ttyS3, the
>. Since serial ports built into
Enter the
each serial port on the interface by entering the following.
linux# cd /dev
linux /dev# ./MAKEDEV ttyS<
MAKEDEV Example
Enter the following to make the devices for a two-port interface:
linux# cd /dev
linux /dev# ./MAKEDEV ttyS4
linux /dev# ./MAKEDEV ttyS5
Find Interface Information
Follow these instructions to find the port address, IRQ, and memory
assignment of your PCI serial interface.
Note
Repeat this section each time you add another interface or physical device to the
computer.
Note
This step may be done in normal user mode.
1.Use
with the
device codes as numbers), and the
information only on devices with a National Instruments Vendor ID
of 1093), to find the resource information of your serial interface.
linux# lspci -v -n -d 1093:*
Something similar to the following should appear. In this output, the
IRQ is 11; the memory location is 0xdff80, and the port addresses are
0xdff0 and 0xdfe0.
/dev directory , then use the MAKEDEV script to create a de vice for
port number
lspci (a command that displays information about the PCI bus)
-v option (be verbose), the -n option (show PCI vendor and
Note PCI Eight-Port Users—The PCI eight-port interfaces show only one I/O port
address listing. The addresses of the other seven I/O ports are calculated b y adding eight to
the previous port address, (n × 8 + I/O port) for 0 < n < 8. The
something similar to the following:
Assign Serial Driver
Note You need to repeat this step each time you restart your computer or until you set up
your
/etc/rc.d/rc.serial file. (Refer to the section Sample /etc/rc.d/rc.serial File for
more information on setting up the
00:0a.0 Class ff00: 1093:d140 (rev 01)
Flags: medium devsel, IRQ 11
Memory at 000dff80 (low-1M, non-prefetchable)
I/O ports at dff0
I/O ports at dfe0
Write down the IRQ, memory location, and all the I/O port addresses
for your computer.
lspci call displays
00:0a.0 Class ff00: 1093:d150 (rev 01)
Flags: medium devsel, IRQ 11
Memory at 000dff80 (low-1M, non-prefetchable)
I/O ports at df00
Assign the serial driver to your devices.
/etc/rc.d/rc.serial file.)
Enter the following to use
UART, port address, and IRQ. Use information returned from the
output, and remember to precede the port address with
linux#setserial /dev/ttyS<
port <
Note
The ^fourport flag is required regardless of how many ports you have on your
interface. The
^fourport flag tells the serial driver that you are not using an AST
setserial to tell the kernel each device’s
port address
port number
> irq <
irq
> uart 16550A
> ^fourport
lspci
0x.
four-port interface.
Caution Using an invalid port can lock up your machine.
setserial Example
Enter the following to assign the serial driver to your devices for the values
in the above two-port
linux#setserial /dev/ttyS4 uart 16550A port 0xdff0 irq
11 ^fourport
Using PCI Serial with Linux6www.natinst.com
lscpi output:
Loading...
+ 13 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.