Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i know what is the visa input buffer size?

Hi,

 

I'm trying to change the input visa buffer size because of a buffer overflow.

I'm using  visa set IO buffer size VI for that.

 

Even after setting the size to the maximum possible bytes I canl get,  I still get the overflow. 

 

My assumption is that the size wasn't changed by the VI (maybe the device driver in my system doesn't allow it to be changes?)

 

how can I know what is the actual buffer size after I changed it.

 

There is no "visa GET IO buffer size" VI.

 

Any other way to read the buffer size? 

 

 

0 Kudos
Message 1 of 8
(10,484 Views)

Hi

you should read fast enough to keep the buffer from filling up and that is not easy at the maximum baudrate

greetings from the Netherlands
0 Kudos
Message 2 of 8
(10,483 Views)

Albert,

 

Who does it answer my qustion? 

0 Kudos
Message 3 of 8
(10,480 Views)

I have another question.

How fast are you filling your buffer, and how fast are you reading.

with 9600 baud you have an awfull long time before you fill up the buffer

With 115k a lot less.

 

And another problem is that not all usb serial devices have a buffer big enough to read out fast enough.

The visa buffer is a software buffer after the very small hardware buffer available in comports.

And I believe that the visabuffer is OK, buit the hardware buffer can be filled too fast anyway.

Checking the buffersize can be done by letting the buffer grow and display the Bytes At Serial Port that can be found in the visa serial palette.

greetings from the Netherlands
0 Kudos
Message 4 of 8
(10,478 Views)

Thanks,

 

at 9600 i have no problem.

at higer buad i have the problem,

As far as i know the hardware buffer is read out by the OS ISR into the aplication buffer.

So why does the HW buffer will be fill? the ISR isn't fast enogh?

 

Is ther no easy way to read the buffer size?

 

When the default in labview is 4096, does it mean each place in the buffer is 32 bits? 

 

0 Kudos
Message 5 of 8
(10,477 Views)

If you look in the help with set buffer size: it says 4096 bytes

 

size designates the size of the I/O buffer in bytes. Set size slightly higher than the amount of data you expect to transmit or receive. If you call this function without specifying a buffer size, this function sets the buffer size to 4096 bytes. If you do not call this function, the buffer size depends on both VISA and the operating system configuration. 

greetings from the Netherlands
0 Kudos
Message 6 of 8
(10,470 Views)

ALbert,

 

Thanks for your help.

I read in the site the help for visa set buffer vi :

 

"Note  Not all serial drivers support user-defined buffer sizes. Therefore, some implementations of VISA might not be able to perform this operation. If an application requires a specific buffer size for performance reasons and the VISA implementation cannot guarantee that size, use some form of handshaking to prevent overflow conditions."

 

 

Who can i know if the buffer is changed after using the vi? 

 

It's very importent for me to know.

 

please help me in finding a way to find out the buffer size. 

0 Kudos
Message 7 of 8
(10,465 Views)

Hi

I played for a few moments with set buffersize and asked 4G,1G and finally no errormessage at say 100kbyte

so the software buffer will function and otherwise give an errormessage.

 

 

here is some info on the chipsettings in windows from a NI guy called JLS

Another factor that affects how quickly you receive data from a serial port is the UART Receive FIFO size. An interrupt is generated whenever the buffer fills past a setting (which you can access from device manager in Windows XP) so that it can be transferred to RAM and clear the FIFO on the UART to receive other data (this is all to avoid over-writing the data in the FIFOs of course). The idea is that for small transfers, such as 5 bytes, setting the FIFO size to be, say, 8 would cause a delay because the interrupt would not be triggered by the reception of data, rather the regular polling mechanism which services the serial port interrupts (this happens periodically about every 5ms or so I believe). In any event, if you set the FIFO size to something small, even 1, then the interrupt will cause that data to be transferred as quickly as possible to RAM and made available in your application. Of course, if you are receiving lots of data, setting the FIFO size to 1 will cause many interrupts, which can slow down overall processing time since the processor is handling serial interrupts relatively frequently.

Here is a document describing this more:

http://ae.natinst.com/operations/ae/public.nsf/web/searchinternal/2d5f972cd550bbc386256f0b005e9a63?OpenDocument

Here is a document which shows how to modify the FIFO sizes: (linked in the one above as well)

http://ae.natinst.com/operations/ae/public.nsf/web/searchinternal/2d5f972cd550bbc386256f0b005e9a63?OpenDocument

Repost if you are still having trouble or have any more information!

Thank you,

 

the total info is in this message:http://forums.ni.com/ni/board/message?board.id=140&message.id=12256

greetings from the Netherlands
0 Kudos
Message 8 of 8
(10,462 Views)