Hi,
I am using UART1 RS232 port to communicate how Linux console and it works properly.
How to enable the UART2 232 for exchanging data? (Open, read, write and close).
What I have to modify the kernel and in which file?
There are commands that I can give directly from the console to test the port, read and write? (Type cat / dev/ttymxc2 or echo> / dev/ttymxc2?)?
thanks
Hi Giuseppe
On C I use it
int fd,n;
fd = open("/dev/ttymxc2", O_RDWR | O_NOCTTY | O_NONBLOCK);
struct termios tty; // ttymxc2
if (fd == -1)
{
perror("open_port: Unable to open /dev/ttymxc2 \n");
return -1;
}
else
{
tcgetattr(fd, &tty);
tty.c_iflag=IGNBRK;
tty.c_cflag = CREAD | CS8 | CLOCAL | B115200 ;
tty.c_lflag=0;
tty.c_cc[VMIN]=1;
tty.c_cc[VTIME]=100;
cfsetospeed(&tty, B115200);
cfsetispeed(&tty, B115200);
tcsetattr(fd, TCSANOW, &tty);
fcntl(fd, F_SETFL, 0);
}
n = write(fd, &chain, s * sizeof(unsigned char));
printf("2: %s\n",chain);
if (n <0)
fputs("write() Port failed!\n", stderr);
close(fd);