MTAC-MFSER Usage
The multi-function serial accessory card supports these modes:
- Loopback (default) (
loopback
) - RS-232 with RTS/CTS flow control (
rs232
)- For RS232, the supported range of speeds are (in bps): 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, and 921600.
- RS422/485 full-duplex (
rs422-485-full
) - RS-485 half-duplex (
rs485-half
)- For rs422-485-full with 1000ft cable, the speeds that have been tested are (in bps): 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, and 4000000.
Use the provided mts-io-sysfs utility to interface with the accessory card.
Examples:
Set RS-232 mode (depending on which port the card is connected to):
$ mts-io-sysfs store ap1/serial-mode rs232
OR
$ mts-io-sysfs store ap2/serial-mode rs232
Set RS-422-485-full mode (depending on which port the card is connected to):
$ mts-io-sysfs store ap1/serial-mode rs422-485-full
OR
$ mts-io-sysfs store ap2/serial-mode rs422-485-full
Launch terminal with microcom:
$ microcom -s 115200 /dev/ttyAP1
$ microcom -s 115200 /dev/ttyAP2
Ctrl-X will close the microcom session.
Additional configuration for RS-485 half duplex mode:
In addition to configuring the serial transceiver using mts-io-sysfs, the UART must also be configured for RS-485 half-duplex. mLinux™ provides a simple command-line utility to configure this mode using an ioctl() C call.
Note that if you are using set-rs485 in conjunction with other software that doesn’t enable RS485 mode (such as minicom), you must call set-rs485 *after* the port has been opened and initialized. Otherwise, the RS485 mode setting will be cleared when the port is initialized. Also, note that the RS-485 half duplex requires a different cable from the full duplex.
Configure UART for RS-485 half-duplex:
$ set-rs485 /dev/ttyAP1 1
Disable:
$ set-rs485 /dev/ttyAP1 0
To integrate this functionality into your own C application, see the setRS485()
function in the set-rs485 source for an example:
http://git.multitech.net/cgi-bin/cgit.cgi/meta-mlinux.git/tree/recipes-extended/multitech/set-rs485/set-rs485.c
Getting Started
Basic RS422-485-full test:
- Install DTE card in API and DCE card in AP2 of MTCDT.
- Type the following commands to MTCDT:
"mts-io-sysfs store ap1/serial-mode rs422-485-full"
"mts-io-sysfs store ap2/serial-mode rs422-485-full"
"mts-io-sysfs store ap1/rs4xx-term-res 1"
"mts-io-sysfs store ap2/rs4xx-term-res 1" - Connect ports together through 1000-foot Cat 5e cable.
- Establish to ssh connections to MTCDT and run minicom on each one. Have one minicom session use serial device /dev/ttyAP1. Have the other one use /dev/ttyAP2. Configure both for required speed with HW flow control enabled.
- Type some characters in each minicom session and observe whether the characters are output in the opposite minicom session.
Basic RS-232 test:
- Install DTE serial card in AP1, and install DCE serial card in AP2 of MTCDT.
- Power up the MTCDT, log in as root, and Enter the following commands:
mts-io-sysfs store ap1/serial-mode rs232
mts-io-sysfs store ap2/serial-mode rs232 - Establish two SSH connections to the MTCDT. On one run minicom and connect to /dev/ttyAP1. On the other run minicom and connect to /dev/ttyAP2. Set both connections to required speed and hardware flow control.
- Connect a serial cable between the two serial cards.
- Type some characters in each minicom session and observe whether the characters are visible on the opposite minicom session.
File Transfer:
For further testing, you can also try transferring files between two ports using zmodem file transfer.
- Perform zmodem file transfers between the serial ports – first in one direction, then in the other using a utility that supports zmodem for example TeraTerm.
- Observe the file transfer speeds.