Moxa V2426A-C7-CT-T [22/88] Epm 3032 driver installation

Moxa V2426A-C2 [22/88] Epm 3032 driver installation
V2400A Series Expansion Modules Software Installation and Programming Guide
4-2
Linux System Peripherals Programming Guide
EPM-3032: Driver Installation
The EPM-3032 may be accessed through the Linux console as a tty device node. The Moxa driver creates a
special device node that is identified as a
ttyM* device. The EPM-3032 device nodes are listed as /dev/ttyM0
and
/dev/ttyM1, or alternately as /dev/ttyM8 and /dev/ttyM9. The UART API allows you to configure
these device nodes for RS-232, RS-422, 4-wire RS-485, or 2-wire RS-485.
Upload the driver and tool packages to
/dev/shm, a temporary file system on your computer.
root@Moxa:~# scp v2400a-mxser_1.0.0_amd64.deb moxa@192.168.3.127:/dev/shm
root@Moxa:~# scp v2400a-setinterface_1.0.0_amd64.deb moxa@192.168.3.127:/dev/shm
Install the package
root@Moxa:~# cd /dev/shm
root@Moxa: /dev/shm# dpkg -i v2400a-mxser_1.0.0_amd64.deb
Selecting previously unselected package v2400a-mxser.
(Reading database ... 48005 files and directories currently installed.)
Unpacking v2400a-mxser (from v2400a-mxser_1.0.0_amd64.deb) ...
Setting up v2400a-mxser (1.0.0) ...
root@Moxa: /dev/shm# dpkg -i v2400a- setinterface _1.0.0_amd64.deb
(Reading database ... 48011 files and directories currently installed.)
Unpacking v2400a-setinterface (from v2400a-setinterface_1.0.0_amd64.deb) ...
Setting up v2400a-setinterface (1.0.0) ...
root@Moxa:
/dev/shm# reboot
The EPM-3032 driver, mxser.ko loads automatically when the system boots up.
To uninstall the driver, use the following command:
root@Moxa:~# dpkg --purge v2400a-setinterface
root@Moxa:~# dpkg --purge v2400a-mxser
EPM-3032 Programming Guide
Example 1: Setting the Modulation Rate/Baudrate
#define MOXA 0x400
#define MOXA_SET_SPECIAL_BAUD_RATE (MOXA+100)
#define MOXA_GET_SPECIAL_BAUD_RATE (MOXA+101)
#include <termios.h>
struct termios term;
int fd, speed;
fd = open(“/dev/ttyM0”, 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);

Содержание

Скачать