|
在X210II单板上,通过如下方式访问串口,操作dev/s3c2410_serial0是正常的,操作s3c2410_serial2则始终接收不到数据
fd = open(/dev/s3c2410_serial2, O_RDWR|O_NOCTTY);
if (fd < 0) {
perror(MODEMDEVICE);
exit(1);
}
printf("Open...\n");
tcgetattr(fd, &oldtio);
tcflush(fd, TCIOFLUSH);
cfsetispeed(&oldtio,B115200);
cfsetospeed(&oldtio,B115200);
if(tcsetattr(fd, TCSANOW, &oldtio) != 0 )
{
perror("tcsetattr error");
return -1;
}
tcflush(fd, TCIOFLUSH);
oldtio.c_cflag |= (CLOCAL | CREAD);
oldtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
oldtio.c_oflag &= ~OPOST;
oldtio.c_oflag &= ~(ONLCR | OCRNL); //添加的
oldtio.c_iflag &= ~(ICRNL | INLCR);
oldtio.c_iflag &= ~(IXON | IXOFF | IXANY); /
|
|