12-20-2022 06:54 AM
I have two different types of measurement intruments (say A and B) that communicate data with my labview program through a USB connection and plain VISA serial, flush buffer, read bytes at port and then read all the bytes available.
My vi allows you to read two instruments at the same time (two VISA "lines" with each their own COMM port and settings) and when I attach two instruments of the same type (say A + A or B + B) it works fine. But when I take two instruments of a different kind (so A + B), I always get a "framing error occured during data transfer".
The only thing I can think of that might cause some trouble is the fact that both intruments have a different baud rate (9600 for the first and 115200 for the second).
Anyone any idea or workaround ?
12-20-2022 07:39 AM
@Jan145 wrote:
I have two different types of measurement intruments (say A and B) that communicate data with my labview program through a USB connection and plain VISA serial, flush buffer, read bytes at port and then read all the bytes available.
My vi allows you to read two instruments at the same time (two VISA "lines" with each their own COMM port and settings) and when I attach two instruments of the same type (say A + A or B + B) it works fine. But when I take two instruments of a different kind (so A + B), I always get a "framing error occured during data transfer".
The only thing I can think of that might cause some trouble is the fact that both intruments have a different baud rate (9600 for the first and 115200 for the second).
Anyone any idea or workaround ?
If I had to make a guess - which I do, since I don't have the VI to look at in front of me - I'd say there was something wrong with the code.
12-20-2022 07:54 AM
What is more likely to be wrong is the way you do the VISA Reads. There have been numerous posts (and talks at NIWeek by @crossrulz) about not using "Bytes at Port". You want to set VISA up with the default Termination character, then do a VISA Read with, say, 1000 characters (way more than the message you expect). Instead of Bytes at Port, you simply do a Read, and check the Error Line -- if there were no characters read (and you timed out, default timeout = 10 sec), you'll get an Error, and can deal with it, otherwise you'll have a complete String from your VISA-sending device.
I'd post the link to @crossrulz's video or attachment in this Forum, but don't know it -- I'm sure someone will add it for you to read ...
Bob Schor
12-20-2022 08:51 AM
@Bob_Schor wrote:
There have been numerous posts (and talks at NIWeek by @crossrulz) about not using "Bytes at Port".
It was actually at VI Week. VIWeek 2020/Proper way to communicate over serial
But I don't think that would be causing a framing issue. It could be the USB drivers conflicting somehow. It could be a USB hub power issue, which would reset the devices and causing the framing issues.
We just need a lot more information:
12-20-2022 08:54 AM
Apparently this makes little sense. A framing error indicates a malformed character on the wire or alike. Are you using a single USB adapter or two?
The problem may be due to a bad driver. In the past it once occurred to me that this same error was generated but the correct packet was actually received (I used VISA Read directly with no Read Bytes at Port involved), so I simply ignored the error altogether.
12-20-2022 08:55 AM
@billko wrote:
@Jan145 wrote:
I have two different types of measurement intruments (say A and B) that communicate data with my labview program through a USB connection and plain VISA serial, flush buffer, read bytes at port and then read all the bytes available.
My vi allows you to read two instruments at the same time (two VISA "lines" with each their own COMM port and settings) and when I attach two instruments of the same type (say A + A or B + B) it works fine. But when I take two instruments of a different kind (so A + B), I always get a "framing error occured during data transfer".
The only thing I can think of that might cause some trouble is the fact that both intruments have a different baud rate (9600 for the first and 115200 for the second).
Anyone any idea or workaround ?
If I had to make a guess - which I do, since I don't have the VI to look at in front of me - I'd say there was something wrong with the code.
I would say that is a very good guess 🤣
12-22-2022 06:52 AM
Thanks everyone for the inputs.
I didn't put my code as it was basically the same as the simple serial example. I think the error I made was indeed the "bytes at port" node which I used to read exacly this amount of data. As suggested in the webinar, I removed the node and read way more bytes than I expect (1000 or so) and the vi runs fine (up to now ... ).