[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: serial IO Interface revisited.



Let me ask another question. 
How is framing error handled? can I test for framing errors before I read the bytes from the serial buffer?, i.e is is there a user program flag?

Much thatns.



 --- On Fri 03/10, Robbie < sheriff@excite.com > wrote:
From: Robbie [mailto: sheriff@excite.com]
To: debian-embedded@lists.debian.org
Date: Fri, 10 Mar 2006 13:06:49 -0500 (EST)
Subject: serial IO Interface revisited.

HHi All, below is how I set up my serial device:

The problem I'm having is that I've noticed (using a serial spy software) that I'm missing some bytes between messages and sometimes I would read only one nibble of the next byte. I've looked at several docs and I can't see why that's happening. The sigio handler simply copies the read bytes to another buffer.
Please Help.

Thank You.
Robbie

sio_fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
if(sio_fd < 0) {
perror(MODEMDEVICE);
return 0;
}

/* installing signal handler */
saio.sa_handler = signal_handler_IO;
saio.sa_flags = 0;
saio.sa_restorer = NULL;
sigaction(SIGIO, &saio, NULL);

/* allowing process to receive signal & make async */
fcntl(sio_fd, F_SETOWN, getpid());
fcntl(sio_fd, F_SETFL, FNDELAY);
fcntl(sio_fd, F_SETFL, FASYNC);

tcgetattr(sio_fd, &oldtio);
cfsetispeed(&newtio, B9600);
cfmakeraw(&newtio);
tcflush(sio_fd, TCIOFLUSH);
tcsetattr(sio_fd, TCSANOW, &newtio);

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



-- 
To UNSUBSCRIBE, email to debian-embedded-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!




Reply to: