LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa READ stops working at some point

Solved!
Go to solution

Hello everyone,

 

I am trying to connect to a Rohde&Schwarz SMB100A. I am able to communicate with it succesfully quite often - but not always, and that's an issue. The box seems to go through three phases:

 

1. VISA Read and VISA Write work fine
2. Only VISA WRITE works
3. Neither functions work. 

 

It never goes back a phase, only forward, meaning it gets worse and worse until I simply reboot the box. I've also noticed that these issues are more likely to occur when performing many functions in short succession (no more than 20 per second, with up to 10 bytes per READ or WRITE). I am using a USB connection to the box. I changed all my VISA READs and WRITEs to synchronous and made sure to apply the correct termination character on the WRITEs. I changed the BaudRate from 9600 to 57600 on the box and through Device Manager. I believe phase 3 happens due to not properly using VISA CLOSE. It's also an issue that doesn't happen as often, so for now I'd like to focus on solving the problem of going from phase 1 to phase 2.

 

I tried to adjust settings on the Serial Port Configuration function, but I get: Error -1073807331 occured at Property Node (arg 2) in VISA Configure Serial Port (Instr).vi->ESR_R&S_ReadFreqPow.vi // Possible reason(s): VISA: (Hex 0xBFFF001D) The specified attribute is not defined or supported by the referenced resource. This makes it kind of hard for me. This is without any values attached on the Configure Serial Port.

 

I've tried looking into VISA Flush, VISA Clear thinking that maybe there are too many bytes waiting to be read or something, but there too I get an error (-1073807299 : Hex( 0xBFFF03D) Invalid buffer mask specified). I've switched USB cables, to no avail. 

 

The problem with phase 2 is not necessarily that I cannot read, it's also that now I have to deal with all the time-outs which makes it slower. I cannot seem to change the timeouts, because I cannot access the Configure Serial Port vi. 

 

Attached below is a screenshot of the code that we use every 300ms to read the current frequency and power of the device.

 

 

Parallel to this, we also adjust some settings, using the following code:

2021-07-10 15_18_07-ESR_R&S_SetFreqPow.vi Block Diagram.png

 

These two codes run in parallel, so maybe they are performed at roughly the same time. Could this be the cause of the issue? I wouldn't understand why that could lead to being able to write, but not read, though. 

 

Thank you for your time!

0 Kudos
Message 1 of 4
(1,699 Views)
Solution
Accepted by topic author Wobzter

I know some instruments that will freeze up if you try to talk to it too much.  So that is one possibility.

 

But since you are writing commands and querying it in parallel, it is quite possible you are sending a command and interrupting the response from the query.  You might want to consider using the VISA Lock to lock the reference while you query the instrument and then unlock it after the response.  That should keep any write from interrupting a query.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(1,664 Views)

I indeed removed one of the parallel lines (the read line) and it works without any issue now.

What I appreciate about your response is also a long-term solution, using the locked function. I was not aware this existed. I will look into it once the experiment is finished. Thank you very much!

0 Kudos
Message 3 of 4
(1,656 Views)

@Wobzter wrote:

I indeed removed one of the parallel lines (the read line) and it works without any issue now.

What I appreciate about your response is also a long-term solution, using the locked function. I was not aware this existed. I will look into it once the experiment is finished. Thank you very much!


I would also consider a different architecture. I prefer to do all of my communications in the same loop so as to prevent issues such as this. You can use a queue to send the commands to your COM loop and additional queues to send data back to the requesting loop. 

0 Kudos
Message 4 of 4
(1,639 Views)