I have written a C program that opens the device (/dev/ttyAM1), configures the
port for RS-485HD (using ioctl as shown in ts7200 manual), and reads the data
being sent by the device. This program worked during a few days of testing.
However, now when it gets executed all I get is garbage characters being
printed out. Nothing has changed except that the computer was physically moved
from one location to another. Now, even when I do testing in the lab with
another ts-7200 computer I get the same garbage results.
Anyone encounter such inconsistency or similar with RS-485 devices on ts-7200?
In case it helps...here is my open and port configuration:
#define TIOC_SBCS485 _IOW('T',0x71, int) /*TS RTS/485 mode Set */
#define AUTO485HD 4
#define BUFFERSIZE 4109
#define BAUDRATE 19200
/* Open the port */
fd = open(dev, O_RDWR | O_NOCTTY);
if (fd < 0) {
printf("ERROR! Failed to open %s\n", dev);
return -1;
}
/* Configure the port */
//-->Set the port speed
tcgetattr(fd,&ti_prev);
tcgetattr(fd, &ti);
cfsetospeed(&ti, BAUDRATE);
cfsetispeed(&ti, BAUDRATE);
ti.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
tcsetattr(fd, TCSANOW, &ti);
//-->Enable RS-485 in half duplex mode
mcr = AUTO485HD;
status=ioctl (fd, TIOC_SBCS485, &mcr); //from TS Linux manual
if (status) {
printf("ERROR PORT 1! TIOCSERSETRS485 failed %i\r\n", status);
return -1;
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|