Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Alicat and Labview communication drop

Solved!
Go to solution

 

At the moment I have a problem I cannot pin down. Seemingly at random my communication with my RS232 Alicat Device will get held up. It will get held up somewhere in the read or write process and be unable to complete it. Upon closing the VI I will get a "Resetting VI" error in Labview 2020. I am using 7 of the 9 RS232 ports. My question is:

  1. How do I fix this problem so that I do not get a communication drop OR (more likely)
  2. How do I code the system such that I can catch and move through this problem or reset the connection. Something of a VISA read/write timeout?  Open to ideas on how to move past the block

 

Here is what I have gathered about the problem:

1. Windows 10, I’ve tested everything on multiple computers. It happens no matter what.

2. It happens at random. It might happen twice within 20 minutes or not for a couple of hours.

3. I have never experienced the error when probing the line. I don’t’ know if that is a clue, or if that speaks to the randomness of the problem

3. Baud Rate = 9600, Prior to this I was running at 19,200 and experienced equivalent issues. The manufacturer recommended lowering the baud rate to reduce noise. I have also isolated the cable from other parts of the hardware. At this point noise on the connection is not an issue, but I am still experiencing the error.

4. My buffer size is 1000 bytes.

5. By termination character is \r. I cannot imagine a scenario where it fails to read a termination character due to the size of my buffer

6. I'm querying it every 50ms. Far below the threshold of a standard timeout. Too much? 

 

 

What I am currently testing.

Due to how my code block is setup I cannot yet confirm if it is getting locked up on the read or write block or both. I'm attempting to isolate the problem with only minor modifications to see if I can isolate it.

 

Attached is slimmed down version of my code that I isolated the error to. 

0 Kudos
Message 1 of 5
(1,354 Views)
Solution
Accepted by topic author s.angles

How is your device connected to the pc?

Is it via USB I would check the usb power settings first in win10 they default to be be suspended when windows thinks the device is not used!

goto power plans, select the active one and goto advanced 

Control Panel\All Control Panel Items\Power Options\Edit Plan Settings  select advanced here

2020-11-10 16_28_51-Power Options.jpg

 

 

If it is not via USB send the vi, OK a snippet shows me the program also and I see a quite complicated program with several problems on board.

 

Which serial library do you use?

I don't see error wires connected from the init comport.vi to the beginning of the for loop where you check for each letter. You should connect those and in the for loop have a shift register to connect the input and output. I now you can because you use the shift register in the timed while loop.

 

Why do you use a timed while loop anyway?

 

and why not an event regiter that reacts on changes of setpoints?

 

But OK it is readable when I have the missing subvi's

greetings from the Netherlands
Message 2 of 5
(1,335 Views)

Hi Albert,

 

Thanks for the quick reply! I do have the system connected via USB, and per your advice, have changed the computer's power settings.

 

To answer your other questions, though...

 

I'm not sure which serial library I'm using. How would I figure this out?

 

Some of the missing sub vis you see are Alicat-created drivers for the RS232 devices. I brought this issue to Alicat support, who advised me to disconnect the error lines because of how their driver is created; if a single error is passed via shift register, the driver will no longer function i.e., return all 0s.

 

I misunderstood the function of timed loops. I have since replaced the it with a while loop and wait configuration.

 

I could definitely use an event register that reacts to setpoint changes. Do you think this would resolve the issue?

 

Thanks again for your help, I'll let you know if these fixes resolve the problem.

 

Best,

Sam

 

 

 

0 Kudos
Message 3 of 5
(1,328 Views)

Hi

 

Can you post the alicat driver vi's? Eventually to my private email address.

It is very strange that error lines should be disconnected. They are there to detect errors and to act accordingly after that. In fact it gives me the impression that their software contains errors.

 

Maybe you can use visa directly to communicate with the Alicat instrument.

Your serial device could be a standard serial cable e.g. from ftdi directly.

 

An error can be introduced if two alicat devices send at the same moment and interfere with each other.

In theory this should not happen but I did not yet study your program well enough to be sure.

 

Anyway I like to have a look at the Alicat software to see if they are implemented correctly.

greetings from the Netherlands
0 Kudos
Message 4 of 5
(1,307 Views)

Hi Albert,

 

You rock!! Looks like Window's stupid suspend USB function was what threw the error. Thanks a ton!!

 

And I've reviewed the Alicat drivers a few time, they work great. Plus the team over there was VERY supportive throughout the whole troubleshooting process. Kudos to them for all the help.

 

Best,

Sam

0 Kudos
Message 5 of 5
(1,269 Views)