[Ftdi-usb-sio-devel] Raspberry Pi FDTI Driver issue
Brought to you by:
bryder
From: Brett W. <wh...@ec...> - 2015-04-08 21:48:56
|
I am having a very strange issue with serial communication through a fdti FT232 device. I have created a serial program that communicated with a device. It is set to blocking mode. When I run the program on a PC, it works just fine. However, when I run the same program on a Raspberry pi 2, it always returns at least one character, even though there is nothing on the line at that time. The code below works on Ubuntu 14.04 with no issues. I get full blocking using either a read of select call. I am just wondering if I am doing something wrong on the PI.... Here is how I am connecting to the port.' fd=open(sDev.c_str(), O_RDWR | O_NOCTTY ); struct termios options; tcgetattr(fd, &options); cfsetispeed(&options, B115200); cfsetospeed(&options, B115200); options.c_cflag |= (CLOCAL | CREAD ); options.c_cflag &= ~CSTOPB; //Set one stop bit options.c_cflag &= ~CRTSCTS; // options.c_cflag &= ~CSIZE; //Mask the character size bits options.c_cflag |= (ICANON); options.c_cflag &= ~(IXON| IXOFF |IXANY); //No software flow control options.c_cc[VTIME]=0; options.c_cc[VMIN]=1; tcsetattr(fd, TCSANOW, &options); int flags; //clear DTR and RTS flags &= ~(TIOCM_DTR | TIOCM_RTS); ioctl(fd, TIOCMSET, &flags); usleep(200); //SET DTR flags |= TIOCM_DTR; ioctl(fd, TIOCMSET, &flags); usleep(200); //clear DTR flags &= ~(TIOCM_DTR); ioctl(fd, TIOCMSET, &flags); usleep(200); Kind Regards, Brett Whittacre Vice President wh...@ec... ec 2 Software Solutions 3035 E. Patrick Ste. 1 Las Vegas, Nevada, 89120 P : 1.866.791.3673 ext 200 | F: 1.702.947.7357 www.ec2software.com Follow the rules. Exceed the standard . Kind Regards, Brett Whittacre Vice President wh...@ec... ec 2 Software Solutions 3035 E. Patrick Ste. 1 Las Vegas, Nevada, 89120 P : 1.866.791.3673 ext 200 | F: 1.702.947.7357 www.ec2software.com Follow the rules. Exceed the standard . |