NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9871 Size of the Rx buffer

Solved!
Go to solution

Hello Everyone,

 

I write here because I have had some trouble with the NI 9871 which I use through the FPGA of cRIO 9038.

 

It is used to read NMEA sentences which come by pair every 10ms like the following example

 

$HEXYZ,+0188,000000.0,X,000000.0,Y,000000.0,Z,V*6F\r\n
$HERPY,+0188,-000.464,R,-00.056,P,+162.157,Y,V*47\r\n

 

To read them I built a state machine with the following steps:

 

1) check if there any is byte at port with the dedicated method every 2ms

2) if there is something, read port until I find the newline character

3) doing some parsing on the data

4) go to 1

 

At first it appears that the state machine was only able to read the first sentence of each pair. After some debugging I discover that when the state machine try to read the second sentence, it receives only "$HERPY,+0188" and there was nothing else to read. Then I realized that the string "$HEXYZ,+0188,000000.0,X,000000.0,Y,000000.0,Z,V*6F\r\n$HERPY,+0188" counts 64 bytes. I concluded that I was encountering some buffer overflow because I was trying the read a sentence of 103 character with a buffer of apparently 64 bytes.

 

I modified the state machine by removing the 2ms waiting time during the first step of the state machine and it seems to work now

 

Now the questions are:

 

1) Is there anybody who can confirms that the Rx buffer of the NI 9871 has a size of 64 bytes?

2) Is there any way to change this size ?

 

I thank you a lot in advance for any information about this topic

 

 

 

0 Kudos
Message 1 of 2
(2,910 Views)
Solution
Accepted by noar12

Hi noar12,

 

You are correct--the NI 9871 has an Rx buffer of size 64 bytes. There is no way to control the buffer size, though the NI-Serial driver is designed to generate buffer fill level interrupts dynamically depending on performance needs.

 

From your description, it does sound like the Rx buffer may have been overflowing during the 2ms wait. You should be able to test this and modify the wait time with the "Number of Bytes at Serial Port" property node provided by NI-VISA.

 

Best regards,

 

Tom D.
Staff Software Engineer
NI
Message 2 of 2
(2,884 Views)