Leonard Jowers
|
Record buffering when reading data from /dev/ser* issue
|
Leonard Jowers
12/20/2010 2:30 PM
post79466
|
Record buffering when reading data from /dev/ser* issue
Perhaps someone can point out our error. Code snippets are attached.
In a forever loop we wait for messages/pulses. If a pulse that indicates serial data available is received, we call a
receive routine that read()'s the data. We are using "ionotify (sio.serial_fd, _NOTIFY_ACTION_POLLARM,
_NOTIFY_COND_INPUT, &sio.serial_event);" to determine if data are available, and arm the input.
Our issue is that frequently we get a pulse for which there is no data; more exactly, after the pulse, ionotify
indicates data available but read() result is -1. Our program is a simple stand-alone test so we know of no "signal"
involved.
ionotify also reports data available within a record though read() reports -1.
We are receiving 61 byte records at 115200KB,8,N,1 that have been sent from an external device one every 250ms. We seem
to not have data errors and have round trip times averaging about 250ms, but with max round trip of about 500 or 750ms
after these errors.
The incident may not occur for hours, but when it does occur we get thousands of them (we suspect it no data is actually
available but ionotify is hung until new data arrives).
We began this investigation because we have evidence that multiple serial messages are not delivered on a timely basis.
|
|
|