ccherri has asked for the wisdom of the Perl Monks concerning the following question:
I am opening a serial port to a device that is already streaming data at 9600B. Occasionally I get a "Buffer Overrun detected" message, which I do not know how to get out of and so have to ^C and start over.
I have tried the 'lookclear' and 'purge_all' method (both return a '1') and it still happens.
Even when I read part of the buffer, kill the program, and restart (with data still in the buffer) it may still happen
$AppMainBoard_Port = Win32::SerialPort->start ($app_cfgfile) @result=$AppMainBoard_Port->lookclear; print "Result: @result\n"; @result=$AppMainBoard_Port->purge_all; print "Result: @result\n"; for ($i=0 ;; ) { if ( $c = $AppMainBoard_Port -> input) { print "$c"; do_other-stuff; } }
I will get a print of $result, but often get a buffer overrun as soon as I get to 'input'
Since starting this post, I tried changing '->input' to '->read(4096)' which SEEMS to have solved the problem so far, but would be happy to hear what the Monks have to say!
Thanks, Chris
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Serial Buffer Overrun
by jmlynesjr (Deacon) on Dec 20, 2012 at 02:48 UTC |