Linux System Peripherals Programming Guide; Epm-3032: Driver Installation; Epm-3032: Configuring Baud Rate - Moxa Technologies V2400 Series User Manual

Expansion modules
Table of Contents

Advertisement

V2400 Series Expansion Modules

Linux System Peripherals Programming Guide

EPM-3032: Driver Installation

The EPM-3032 may be accessed over the Linux console as a tty device node. The Moxa driver creates a special
device node that is identified as a
/dev
ttyM9
and
/
these device nodes for RS-232, RS-422, 4-wire RS-485, or 2-wire RS-485.
The EPM-3032 driver is
/lib/modules/2.6.30-bpo.2-686/kernel/drivers/char/mxser.ko
at
automatically when the system boots up.

EPM-3032: Configuring Baud Rate

Example 1: Set the Modulation Rate / Baud)
#define MOXA
#define MOXA_SET_SPECIAL_BAUD_RATE
#define MOXA_GET_SPECIAL_BAUD_RATE
#include
struct termios term;
int
fd = open("/dev/ttyM8", O_RDWR);
tcgetattr(fd, &term);
term.c_cflag &= ~(CBAUD | CBAUDEX);
term.c_cflag |= B4000000;
tcsetattr(fd, TCSANOW, &term);
speed = 115200;
ioctl(fd, MOXA_SET_SPECIAL_BAUD_RATE, &speed);
Example: Return the Modulation Rate / Baud
#define MOXA
#define MOXA_SET_SPECIAL_BAUD_RATE
#define MOXA_GET_SPECIAL_BAUD_RATE
#include
struct termios term;
int
fd = open("/dev/ttyM8", O_RDWR);
tcgetattr(fd, &term);
if ( (term.c_cflag & (CBAUD|CBAUDEX)) != B4000000 ) {
// On this line, you may insert a standard baud rate
} else {
ioctl(fd, MOXA_GET_SPECIAL_BAUD_RATE, &speed);
}
ttyM*
/dev/ttyM16
, or alternately as
mxser.ko
, and has been pre-installed
0x400
<termios.h>
fd, speed;
0x400
<termios.h>
fd, speed;
Software Installation and Programming Guide
device. The EPM-3032 device nodes are listed as
/dev/ttyM17
and
(MOXA+100)
(MOXA+101)
(MOXA+100)
(MOXA+101)
4-2
/dev/ttyM8
. The UART API allows you to configure
. It will be loaded

Advertisement

Table of Contents
loading

Table of Contents