LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial module overrun error

I have a RIO with the serial module NI9870 where I very often get error 65575 when I try to read the response from an instrument.  The error help says that:
 
CompactRIO:  Serial module overrun error: An overrun error has occurred in the data being read. Ensure that the module Flow Control is configured correctly.
 
Unfortunately however, the unit I am trying to communicate with does not have any flow control so the module has been set up to not use any. Earlier I've mainly just polling where I can loose data and if I have seen this error once it was possible to just flush the Rx buffer on the port to get things running smoothly again, however in this case the error comes on every read and I cannot afford to loose any of the replies. The problem does not occur if I use other equipment to communicate to the unit so it seems the NI9870 module is a bit too sensitive to this...
 
Is there anything I can do to get around this problem? To add hardware flow control is not an option. I do have some influence on the code of the replying instrument so I could get someone to make it reply a bit slower e.g....however that is a last resort.
0 Kudos
Message 1 of 3
(3,203 Views)
I suspect that the problem this time around is as the error says - a buffer overflow. The replies on the commands I send to the unit can be 262 bytes long and based on the data type of the bytes at port property it seems the buffer is only 255 long (haven't rechecked the spec of the module yet). Instead of reading the bytes at port until it halts and then read the content I'll check if I can read the data continously to avoid more than 255 waiting bytes...I kind of got biased to believe that the error did not really come from an overflow based on the errors I have seen when the replies are shorter..In any case it's a good tip to flush the port if you get that error, as the module itself will not read any new data until that command has been set - (or, for some reason, if the serial cable is disconnected...not a practicla solution that though...).
 
 
0 Kudos
Message 2 of 3
(3,186 Views)

Testing to read data immediately to avoid a buffer overflow fails. At the current baud rate of 9600 there should be plenty of time to empty the buffer before it overflows so I'm back to my original though that this is not really an overflow, but an issue with the serial hardware; perhaps the serial module throws this error whenever it gets a timing problem (Tx/Rx switching etc.), and not just when the buffer actually overflows...

If the Bytes at port property is read just after sending the poll command it returns 64, which is the value it always returns when the following read throws the buffer overflow error.

Here's what I do:

I send a command to my serial instrument connected to the NI9870 and get the correct 7 byte reply...I then wait for 30 seconds to allow the instrument to do a job, and then send it another command. This is when I always get the error. So - it works fine, and then stops with the buffer overflow error...too quick for the instrument to actually reply with more than a few bytes.

0 Kudos
Message 3 of 3
(3,173 Views)