Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

strange data loss reading large amount of data fast using serial VISA?

Hi all,

I am frustrated on VISA serial comm. It looks so neat and its fantastic what it supposes to do for a develloper, but sometimes one runs into trouble very deep.
I have an app where I have to read large amounts of data streamed by 13 �Cs at 230kBaud. (They do not necessarily need to stream all at the same time.)
I use either a Moxa multiport adapter C320 with 16 serial ports or - for test purposes - a Keyspan serial-2-USB adapter with 4 serial ports.
I write commands to those �Cs and expect data streams. I read them back using VISA.
But when I analyse those streams - data is lost; sometimes just one or two bytes and sometimes some thousends of Bytes.
Performing the same functions programmed straight using the old serial functions everything workes OK - Not one single Byte lost within some some 100000!

Yes, I have set an appropriate data buffer of 32760 Bytes. And I have set 'ASRL End In' to 0 as proposed by Dan Mondrik.

I performed a test using that Keyspan adapter and a nullmodem cable. Wrote word values increasing from 0 to 65k in chunks of 32 Bytes and waited some multiple next ms before proceeding.
On the connected port I read those data back. Checked how many bytes are there, read them in and concatenate them behind old data in a shift register. Then the data in the shift reg are transferred back into word values and displayed. Sometimes it workes, mostly not.

What was mostly annoying me was the fact _how_ those data are read:
First when there are just a few bytes there - all of tem are read. Then, when sending is faster than reading, the VISa read just returned a very few bytes, mostly just two bytes. And the system buffer fills up. When its filling level reaches more than about half of its size, VISA read starts to return 512 bytes and looses some data. Then it empties the system buffer and from then on it reads all the data there.
I suppose this is not a problem of the serial device drivers, because it happens similar on both types of devices.

I think I will have to expiate and return to those good old serial functions and do all my necessary stuff myself.
It is frustrating!!!

Anyone having some hints or another solution?

TIA and Greetings from Germany!
0 Kudos
Message 1 of 4
(3,082 Views)
LuI wrote:
>
> Hi all,
>
> I am frustrated on VISA serial comm. It looks so neat and its
> fantastic what it supposes to do for a develloper, but sometimes one
> runs into trouble very deep.
> I have an app where I have to read large amounts of data streamed by
> 13 µCs at 230kBaud. (They do not necessarily need to stream all at the
> same time.)
> I use either a Moxa multiport adapter C320 with 16 serial ports or -
> for test purposes - a Keyspan serial-2-USB adapter with 4 serial
> ports.

Does it work better if you use the serial port(s) on your motherboard?
If so, then get a better serial adapter. If not, look more closely at
VISA.

Some programs have some issues on serial adapters but run fine on a
regular serial port. We've had that problem recent
ly.

Best, Mark
0 Kudos
Message 2 of 4
(3,082 Views)
Hi !

Sorry for being so late but I had a similar problem once.

If you are using a windows operating system try the following:
Go to the System settings for the serial ports and click the advanced settings there you will find the settings for buffers connected to that port. Put them all to the lowest possible settings. For large amounts of data this might do the trick of reading all data back using the VISA serial functions. Probably you will have to do this ritual for all ports separately.

Good luck
0 Kudos
Message 3 of 4
(3,082 Views)
Hi all,

thanx for your response so far. After returning from holidays I fount a bug confirmation from Moxa (producer of the multiport serial adapter); their driver did use only below 8kB in my configuration, but does not report this and reacts as if it had 32kB availabel..
I had to change my app to never have more than about 7.5kB in the serial buffer - now it workes.
I could not use the PCs internal ports because I have to operate at 230kBaud. The µCs can use only a partial HW handshake. So I have to limit the serial buffer usage to the avail. size.
A newer driver from Moxa is supposed to report the really availabel buffer size, but because I know the exact config of this app I can stay with my actual solution. It might however be a little faster and more elegant, but de
vellopment time is much more important...
Greetings from Germany -- Uwe
0 Kudos
Message 4 of 4
(3,082 Views)