User manual

6 OnRISC Hardware API
6.4. Serial Interfaces
6.4.1. KS8695 based Devices
RS232/422/485 mode switching The serial ports can operate in one of the three modes RS232,
RS422 or RS485
47
(see Hardware Manual for electrical configuration issues). These modes will
be controlled through the EPLD circuit. Following IOCTLS are to be used to switch the modes
(alternative /proc/vscom/epld_ttySx entries can be used to switch RS modes. See Section 7):
TIOCGEPLD - get EPLD mode
TIOCSEPLD - set EPLD mode
These commands use the following structure to store the desired parameters:
struct e pl d _s t ru c t
{
unsigned long po rt ;
unsigned long r e g _ s h i f t ;
unsigned long va lue ;
} ;
The field value can have one of the following values:
EPLD_RS232 - RS232 mode
EPLD_RS422 - RS422 mode
EPLD_RS485_ART_4W - RS485 mode 4-wire transmit control by ART
EPLD_RS485_ART_2W - RS485 mode 2-wire direction control by ART
EPLD_RS485_ART_ECHO - RS485 mode 2-wire direction control by ART with echo
EPLD_RS485_RTS_4W - RS485 mode 4-wire transmit control by RTS
EPLD_RS485_RTS_2W - RS485 mode 2-wire direction control by RTS
EPLD_RS485_RTS_ECHO - RS485 mode 2-wire direction control by RTS with echo
EPLD_CAN - CAN mode
EPLD_PORTOFF - shutdown the port
RS485 transmission control In RS485 the line driver for transmitting must be disabled (tri-
stated) when the device does not send data. In a 2-wire configuration this is known as data
direction change, with 4-wire it is called line contention. The following modes are provided by
OnRISC:
RTS: if this mode is set user software is responsible to turn transmitter on/off by toggling
the RTS signal (RTS 1 turns sender on, RTS 0 turns sender off)
ART (Automatic Receive Transmit): The sender will be automatically turned on/off by
hardware. The turning off occurs after the stop bit was sent (recommended mode).
47
See include/asm/arch/serial.h to see what EPLD capabilities each port has
May 2014 OnRISC User Manual 42