I'd like to get data from COM2 by starting a program in the console (at COM1).
But a console is also available on COM2, so that I can't get data there.
The jumpers are in default position (console enabled on COM1).
Is this a normal behaviour?
What to do to use COM2 as "data"-interface?
If logged in on COM2 you can see on COM1:
Technologic Systems TS-LINUX/arm 7.0
ts7200 login: root
login[82]: root login on `ttyAM0'
$
$
$ login[83]: root login on `ttyAM1'
Thanks!
Demo for COM2:
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <fcntl.h>
int main( void )
{
int fd;
struct termios options;
int n;
char buff[255];
/* Open Port */
fd = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY);
if(fd == -1)
{
printf("ERROR Open Serial Port!");
}
else
fcntl(fd, F_SETFL, 0);
/* Serial Configuration */
tcgetattr(fd, &options); // Get Current Config
cfsetispeed(&options, B115200); // Set Baud Rate to 115200
cfsetospeed(&options, B115200);
options.c_cflag &= ~CSIZE; // Set Data Bits to 8 Bits
options.c_cflag |= CS8;
options.c_cflag &= ~PARENB; // No Parity (8N1)
options.c_cflag &= ~CSTOPB;
/* Save The Configure */
tcsetattr(fd, TCSANOW, &options);
do
{
n = read(fd,buff,10); // Read Data From Serial Port
if(n>0)
{
printf("From Serial : %s",buff); // Print Out
write(fd,buff,strlen(buff)); // Write Data Out
}
}while(strncmp(buff,"bye",3)); // If user say bye then Exit
close(fd); // Close Port
return 0; // End Program
}
------------------------------------
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/
|