Page 19 of 26
Software Programming
API Interface
Once the drivers for the CM17320HR have been properly loaded, all eight RS-232/422/485 ports
should be available as standard serial ports. All eight ports can then be controlled using the
standard serial port interfaces built into the operating system.
A description of serial port programming for operating systems is beyond the scope of this
manual. Consult the operating system documentation for information on how to interface with
serial ports via software.
COM Port Numbering
Serial ports (aka COM ports) are typically assigned numbers by the operating system (e.g.
COM1). These numbers are typically dynamically assigned by the operating system. However,
different applications may enumerate the COM ports differently, assigning different port numbers
(e.g. COM3-10 vs COM5-12). When developing your own serial port application, consult your
operating system’s documentation for the proper method of enumerating COM ports.
Note:
Some applications are written to assume that no more than four COM ports are present
in a system. These applications may have compatibility issues with the Exar PCI UART.
Base Address and Register Mapping
The CM17320HR exposes all of the registers available on the Exar XR17D158. The register set
of the XR17D158 mimics the standard 16C550 UART register map. However, the XR17D158
contains some additional registers not found in a typical ISA-based UART.
Additionally, the base address of the CM17320HR’s serial ports will be different than the standard
PC serial port locations (0x3F8, 0x2F8, etc). The CM17320HR is a memory mapped device.
Since it is PCI-based, it may be mapped to any location within the 4GB address space of the
CPU. The base address of PCI devices is determined by the CPU’s BIOS and operating system
at boot time.
The register-level differences between the CM17320HR and a standard 16C550 UART should be
abstracted via the software drivers. Most users will not need to concern themselves with the
actual registers of the board. If one is interested in directly accessing the registers of the board,
consult the XR17D158 data sheet available from Exar.
Enabling the RS-422/485 Transmitter
See Table 5 – Jumper Settings for mode jumper settings. When using the serial port in RS-422
or RS-485 mode, the serial receiver for RxD (receive data) is always enabled.
In RS-422 mode the driver is always enabled, however in RS-485 mode the driver for TxD
(transmit data) is enabled and disabled under software control in the following two ways.
In RS-485 RTS driver enable mode the transmitter is enabled by manipulating the Request to
Send (RTS) signal of the serial port controller. This signal is controlled by writing bit 1 of the
Modem Control Register (MCR) as follows: