Hello,
I tried to access the serial port "com2" of ep9312. i used device file ttyAM1 but when i run programm the program access com1 of ep9312, i change the device file to ttyAM0 to use the other com port but the programm still uses the same come port. there are only 2 files in ramdisk "ttyAM0 and ttyAM1" both files using com1 How can i access the com2, is there any special device files fo it or i am doing any mistake i am using the programm
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
int open_port();
int main()
{ struct termios options;
int i;
int n;
int fd;
int open_port(void)
{
fd=open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd==-1)
{
perror("open_port: unable to open /dev/ttyAM1 - ");
}
else
fcntl(fd, F_SETFL, 0);
return (fd);
}
tcgetattr(fd, &options);
cfsetispeed(&options,B19200);
cfsetospeed(&options,B19200);
options.c_cflag |= ( CLOCAL | CREAD);
tcsetattr(fd, TCSANOW, &options);
for (i=0; i<=10; i++)
{
n= write(fd, "ALLAH O AKBER\n", 14);
write(fd, "Hello World\n", 12);
if (n<0)
fputs("write() of 4 bytes failed!\n", stderr);
}
return 0;
}
I complaid this code with ARM cross compiler provided by cirrus logic cross compiler 2.95.3
can any one tell what is the problem?