
Allan Nielsen wrote on Mon, 8 Aug 2011 14:13:08 +0200
Hi
I have a funciton where we I am using boost::asio to read from the serial port of my computer.
I have started out with an implementation which uses read, and I am now trying to convert it to async_read because I want a time out.
When I am trying to use the async_read version, I get timeouts after I have read one or two charterers, even though I know there are more charterers to be read on the wire.
Not sure that this is much help since I've never really used boost.asio and reading further down the thread it may be a problem with how you are calling it. However having done a lot of serial comms in the past seeing a couple of characters only whilst more data is on the wire I'd guess that the timeout is as a result of the low level serial hardware interrupt. The UART is probably signalling that its internal FIFO buffer is full and you need to read this promptly - quite how that all pans out and what daemon / service has the responsibility of reading this these days I haven't got the faintest - I was writing TSR's when I knew the gory technical details of this so life was much simpler. I'm actually impressed that you've found a computer that still has a serial port on it! Most seem to have gone over to the ubiquitous USB these days - though that may be the easiest solution - use USB and a usb/serial converter which would avoid having to rediscover the lost art of programming UART latch timings etc and give you a decent amount of low level buffering so you could ignore low level stuff and just read the data. http://www.bb-europe.com/tech_articles/USB_converters.asp?gclid=CPvOgur5v6oC... or some such. HTH Alex