LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-15-2007, 03:02 PM   #1
v_v
LQ Newbie
 
Registered: Feb 2007
Posts: 1

Rep: Reputation: 0
Serial 8O1 Problem


Hello All,

I'm working on a program that should read serial data from GPS receiver (Trimble ACEIII card). The receiver features 16C550 UART set to 9600 8O1 no flow control. The problem is that the most significant bit in every received byte is always set to 0 ('dead' bit #7).
As recommended in the 'Serial Programming Guide for POSIX Operating Systems', the serial port is set as follows:

/***********************************************/
struct termios options;
int fd;

fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);

ret = fcntl(fd, F_SETFL, 0);

tcgetattr(fd, &options); // Get current options
cfsetispeed(&options, B9600); // Set input speed
cfsetospeed(&options, B9600); // Set output speed
options.c_cflag |= (CLOCAL | CREAD); // Set local mode
options.c_cflag |= PARENB; // Enable parity
options.c_cflag |= PARODD; // Set ODD parity
options.c_cflag &= ~CSTOPB; // Set 1 stop bit
options.c_cflag &= ~CSIZE; // Data size
options.c_cflag |= CS8; // Set 8 data bits
options.c_cflag &= ~CRTSCTS; // Disable hw flow ctrl
// Disable canonical input
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG | IEXTEN);
// Disable sw flow control
options.c_iflag &= ~(IXON | IXOFF | IXANY);
// Enable parity, strip parity bit
options.c_iflag |= (INPCK | ISTRIP );
options.c_oflag &= ~OPOST;

tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &options); // Set new options now
/**********************************************/

The problem ('masked' bit #7) occurs only for the data RECEIVED from the serial port. The data SENT to the serial port is delivered correctly...

Anything you may suggest will be greatly appreciated!

Thanks,
VV
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RH doesn't detect my Serial modem connected to a PCI Serial card ricky_ds Linux - Hardware 1 08-17-2006 02:37 PM
problem with serial ports houssamfarag Linux - Hardware 1 02-24-2006 01:48 PM
serial mouse problem et1977 Linux - Newbie 1 05-26-2005 04:42 PM
zoom external serial with usb to serial adapter foustware Linux - Hardware 1 12-07-2003 02:02 AM
serial port problem... linux4john Linux - Software 1 10-30-2003 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration