Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ENET/RS-232 timing out connection

I am using LabWindows/CVI v. 7.1 to communicate with a motor controller through an ENET/RS-232 box.
I can open the port and intitialize the controller without issues.  An LED lights up on the ENET/RS-232 to indicate that the port is open.

If I immediately run my tests everything works.
However, if I wait for about a minute, the LED turns off and the controller stops responding to my commands.
The program is not able to read anything from the buffer (0 bytes read) and stops.

It seems as if something is timing out the connection when it is not in use.  I can't find anything in the port/device options that would set such a timeout.

Any help with this would be highly appreciated.
0 Kudos
Message 1 of 5
(3,768 Views)
Hi,

I was just wondering what you meant by waiting a minute. Are you configuring everything and then stopping the program? Are you just placing a wait between the configuration and the next commands? Exactly how are you configuring and then what are you trying to do? Are you getting any errors? The answers to these questions would really help.



Regards
Krista S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(3,754 Views)
I will try to clarify and also add some new things I discovered as I tried to debug the system.


The program is run through a user interface.  It initializes everything and pauses for the user to press a button to start a test.

The port is opened during initialization with:
OpenComConfig(com_port, "", 9600, 0, 8, 1, 512, 512);

If I initialize, wait a minute and then try a test the program breaks.
If I initialize, run a test, wait a minute, then try to run the test again the program breaks.

Normally, a green LED on the front panel of ENET/RS-232 box goes on when the port is opened.  The LED goes off about 60 seconds of sitting idle after initialization or a test.  If I run a test when the LED went off, the test always gives me the same error.  If I reinitialize, the LED goes back on and can run the tests without problems.

The error itself shows up in the following piece of code.
The ComRdTerm times out and returns 0 bytes, so the program enters the if statement and gets terminated with an error message:

nbytes = ComRdTerm(com_port, in_buf, CM6K6_MAX_CMD, 13); 
if (nbytes <= 0)
{
    Fmt(msg, "%s<# bytes in = %i, problem receiving RS232 input", nbytes);
    cm6k6_error(msg);
    return -1;
}

In my mind everything, including the fact that it breaks after exactly 1 minute (which I confirmed yesterday), indicates that something is breaking the connection to the port.

I tried to connect another ENET/RS-232 box in place of the one that gives me trouble, but the problem didn't go away.
I got a PCI serial card and connected the motor controller to it.  The problem I experience disappeared.

But I still want to figure out what is going on, because our lab uses many ENET/RS-232.  It's just that nobody seems to leave their box sitting idle with a com port open.
0 Kudos
Message 3 of 5
(3,744 Views)

Hi

I was wondering what version of NI-Serial you are using. I found a issue similar to this and an upgrade of the driver version solved the issue. The current version of is NI-Serial 3.2 . If you are using an earlier version please install the latest version and let me know if this helps.


 

Regards
Krista S.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(3,737 Views)
It now works, thank you.  You were correct about the drivers.

For some reason we had very old drivers installed (v. 1.01!).  They worked fine, except for the timeout problem.

With the new drivers, when I have a port open, the computer seems to regularly communicate with the device (an LED flashes on the panel a few times per minute), preventing the port from closing.
0 Kudos
Message 5 of 5
(3,695 Views)