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!