Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

No device response even with open serial port under linux -- normal behavior under Windows

Hi,

now that I am convinced it is not a baud rate problem, I am still struggling how to connect to my device:
I have a running labview vi with which I try to control a wavelength meter. It uses a USB/serial bridge. The necessary drivers are installed. I have a dual boot computer to test in windows and linux environment. On the windows side, i can connect and get data as expected. On the linux side, I had first to create a static local serial port with visaconf (to tell VISA that /dev/ttyUSB0 is the path to look for the additional port) and then the port was detecetd by labview. i can open it and no error message comes up. Now I send a request to the wavelength meter, again no error shows up, but I don't get any response from the wavelength meter. Using the debud mode and comparing the windows and labview behavior, everythig is identical until the VISA write command. Just the VISA REAd command afterwards gives the data on the Windows side, but not under linux. Any suggestions how to troubleshoot? Is the problem related to the static serial port? Is there a general serial command to see if I get at least something from the device like the version (I know this is better to ask the wavelength comapny just thought there is some general handshake command)?

I am running Labview 8.2 on Linux (Mandriva 2007.1 kernel 2.6.17-13) and Windows (XP, silabs cp210x driver), also NI-VISA 4.2 (in the process of upgrading to 4.3 -- have to recompile the kernel first)

Thanks
Thomas
0 Kudos
Message 1 of 26
(8,272 Views)
OK now even more puzzling:
after adding an indicator for the response counts to the VISA write command, I get timeout errors from VISA read if I want one wavelength, and if I go into autoscan mode, it works!!!!!????
how is this possible" Please note, under windows both modes work flawlessly. Do I have an issue with diffrent timedelays in several sub vi's which don't shwo up under winows as this OS is ust too slow? Just under Linux this issue becomes obvious?
I write ad read in the same squence with time delays of 10ms. The mode buttons (to see what mode I am using) are checked every 250ms and to create the message to be sent via the VISA write command I also use 10ms.
Hope someone can help to get this system running
Thanks
Thomas
0 Kudos
Message 2 of 26
(8,266 Views)
Hi Fusselpelusa,

One thing you can try to troubleshoot the behavior you're seeing is to do a serial loopback test. This involves connecting the send and receive lines on your serial port, and making sure that you're reading the same data that you're writing. If you can conduct a serial loopback test, but are still unable to communicate with the device, there might be something wrong with your port settings. The serial loopback test is used to establish that LV is communicating with the serial port and is able to send data to the port.

There is more information in this DevZone article here. There is a section that deals with perfomringa loopback test in Windows Hyperterminal. You can conduct the same test using the Basic Serial Read and Write Example VI in LabVIEW when you're doing this in Linux.

Also, there is a good KnowledgeBase article here that discusses using a 3rd party USB-Serial Interface in Linux.

Let us know how it goes!
Rasheel
0 Kudos
Message 3 of 26
(8,243 Views)
Hm, I alreadsy thought about this, but as I am using a USB/serial driver and hence a USB cable I cannto to this test. Also the cp210x board is in the wavelength meter and therefore not accessible. Using a "normal" serial port does not help either i suppose as this woudl just behave normally. This is rather a USB/serial issue, I suppose. Is there another idea how to troubleshoot?
Thanks
Thomas
0 Kudos
Message 4 of 26
(8,241 Views)
More troubleshooting and comparison between the linux and the windows progr gave (hopefully) a glue to what happens:
I am sending out the exact same string for both OS's.
I am getting back 17 bytes and no error on VISA read on windows, whereas I am getting back 19 bytes and a timeout on linux. After I click continue, 17 bytes are on the returncount indicator (where are the missing two bytes ...?). The 17 byte outut string itself looks (besides to byte number 3 and 5 that are always changing) looks the same for each OS. hence it is the fact that I am getting 19 bytes back instead of 17. The reason why I am only getting 17 instead of 19 after the timeout error (and clocking the continue button) is that in the string it is possibly written down only 17 bytes are to be read -- the cause of the timeout ...
So now where are these two bytes written onto the string? Possilby somewhere on the return line as the 17 bytes output string looks the same, hecne the wavemeter gets the right string and also provides the right data, somewhere now I am getting 2 bytes more ...
Did anyone have such a behavior? A wrong end of string byte or something like this, not identified by the linux driver but by the windows driver?
Thanks so much for the help
Thomas
0 Kudos
Message 5 of 26
(8,235 Views)
OK using the labview simple serial vi, I was able to see the last 2 bytes. They show the first two bytes again (?) and not what i thought end of line characters.
This coudl only be seen in linux with 0ms time delay. If I had a delay of 500ms I got the usual timeout error.
Under windows nothing at all would usually show up. occasionally I would get the request 17 bytes.Why is the behavior between linux and windows for one and the same vi so different? I set up the port characrteriztics exactly the same (at least form the vi). In order to set the required 921600 baud under visaconf (not possible to be set from the scroll down menu, it would be great if an NI engineer could explain this to me), I have to change visaconf.ini to the 921600 bauds. under edit in visaconf it shows up as 110. But the port opens with no problems .... is perhaps this issue still my problem?
Please ley me know what you think
Thanks
Thomas
0 Kudos
Message 6 of 26
(8,226 Views)
Sorry for sending so many new messages, don't find the button to edit old messages ....
Anyway I was now using a linux terminal srial communication program to see if it is a labview or a driver problem. And it tunrs out that sending wiht a terminal I do get the required 17 bytes back. This means it is definitely in labview, where things get screwed up. I assume it is visaconf that does not allow me to use 921600 baud from the pull down menu. even if i change it invisaconf.ini this does not help. Is there any work around?
Please advice if you have an idea
Thanks
Thomas
0 Kudos
Message 7 of 26
(8,203 Views)
Hi Fusselpelusa,

Have you used NI-Spy before? You can use NI-Spy to capture the calls being made by the VISA driver to the port, and we can see what's going on in the low levels calls to see where these extra 2 bytes is coming from by comparing the NI-Spy captures in Windows and in Linux.

Here is the Linux NI-Spy Capture instructions, and here is the one for Windows.

Please post the captures here so that we can have a look at them and see what's going on.

I would advise that you use the Basic Serial Read and Write Example VI on both Linux and Windows, and send the same commands. It would be best if you keep the commands to be the simplest possible that will replicate the issue so that it will be easier to sort through the NI-Spy captures.
Rasheel
0 Kudos
Message 8 of 26
(8,188 Views)
Hi,
here is the NISPY linux output (executed twice with 0ms time delay as the output does only come every second request)

1.  viParseRsrc (0x0A7318D8, "ASRL5::INSTR", 4, 5)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.779       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

2.  VISA Set Attribute ("ASRL5::INSTR", TMO_VALUE, 10000)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.779       Call Duration 00:00:00.016
Status: 0 (VI_SUCCESS)

3.  VISA Set Attribute ("ASRL5::INSTR", ASRL_BAUD, 921600)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

4.  VISA Set Attribute ("ASRL5::INSTR", ASRL_DATA_BITS, 😎
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

5.  VISA Set Attribute ("ASRL5::INSTR", ASRL_STOP_BITS, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

6.  VISA Set Attribute ("ASRL5::INSTR", ASRL_PARITY, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

7.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR_EN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

8.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

9.  VISA Set Attribute ("ASRL5::INSTR", ASRL_FLOW_CNTRL, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

10.  VISA Set Attribute ("ASRL5::INSTR", ASRL_END_IN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

11.  VISA Write ("ASRL5::INSTR", "~E.E.....")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.795       Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

12.  VISA Get Attribute ("ASRL5::INSTR", ASRL_AVAIL_NUM, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.796       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

13.  VISA Read ("ASRL5::INSTR", 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.796       Call Duration 00:00:00.000
Status: 0x3FFF0006 (VI_SUCCESS_MAX_CNT)

14.  VISA Close ("ASRL5::INSTR")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:52:58.796       Call Duration 00:00:00.008
Status: 0 (VI_SUCCESS)

15.  viParseRsrc (0x0A7318D8, "ASRL5::INSTR", 4, 5)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.886       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

16.  VISA Set Attribute ("ASRL5::INSTR", TMO_VALUE, 10000)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.886       Call Duration 00:00:00.015
Status: 0 (VI_SUCCESS)

17.  VISA Set Attribute ("ASRL5::INSTR", ASRL_BAUD, 921600)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

18.  VISA Set Attribute ("ASRL5::INSTR", ASRL_DATA_BITS, 😎
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

19.  VISA Set Attribute ("ASRL5::INSTR", ASRL_STOP_BITS, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

20.  VISA Set Attribute ("ASRL5::INSTR", ASRL_PARITY, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

21.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR_EN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

22.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

23.  VISA Set Attribute ("ASRL5::INSTR", ASRL_FLOW_CNTRL, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

24.  VISA Set Attribute ("ASRL5::INSTR", ASRL_END_IN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

25.  VISA Write ("ASRL5::INSTR", "~E.E.....")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.901       Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

26.  VISA Get Attribute ("ASRL5::INSTR", ASRL_AVAIL_NUM, 19)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.902       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

27.  VISA Read ("ASRL5::INSTR", 19, "~kÍ.2............~k")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.902       Call Duration 00:00:00.029
Status: 0x3FFF0006 (VI_SUCCESS_MAX_CNT)

28.  VISA Close ("ASRL5::INSTR")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 15:53:01.931       Call Duration 00:00:00.009
Status: 0 (VI_SUCCESS)

********************************************************************************************8
to be continued in next message ....
Thomas
0 Kudos
Message 9 of 26
(8,182 Views)
----- continuation of previous message
And here is the ouptut for the same windows command (interestingly, with 0ms delay only sporadigly it would give any output ...whereas for linux every second output is displayed):

1.  viParseRsrc (0x02425500, "COM3", 4, 3)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.093       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

2.  VISA Set Attribute ("COM3", TMO_VALUE, 10000)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.093       Call Duration 00:00:00.047
Status: 0 (VI_SUCCESS)

3.  VISA Set Attribute ("COM3", ASRL_BAUD, 460800)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.140       Call Duration 00:00:00.016
Status: 0 (VI_SUCCESS)

4.  VISA Set Attribute ("COM3", ASRL_DATA_BITS, 😎
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.156       Call Duration 00:00:00.015
Status: 0 (VI_SUCCESS)

5.  VISA Set Attribute ("COM3", ASRL_STOP_BITS, 10)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.171       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

6.  VISA Set Attribute ("COM3", ASRL_PARITY, 0)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.171       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

7.  VISA Set Attribute ("COM3", TERMCHAR_EN, 0)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.171       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

8.  VISA Set Attribute ("COM3", TERMCHAR, 10)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.171       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

9.  VISA Set Attribute ("COM3", ASRL_FLOW_CNTRL, 0)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.171       Call Duration 00:00:00.016
Status: 0 (VI_SUCCESS)

10.  VISA Set Attribute ("COM3", ASRL_END_IN, 0)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.187       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

11.  VISA Write ("COM3", "~E.E.....")
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.187       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

12.  VISA Get Attribute ("COM3", ASRL_AVAIL_NUM, 17)
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.187       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

13.  VISA Read ("COM3", 17, "~k..*............")
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.187       Call Duration 00:00:00.000
Status: 0x3FFF0006 (VI_SUCCESS_MAX_CNT)

14.  VISA Close ("COM3")
Process ID: 0x00000DCC         Thread ID: 0x00000954
Start Time: 16:14:25.187       Call Duration 00:00:00.031
Status: 0 (VI_SUCCESS)

************************************************************************************************************
Now i do the same with 50ms time delay error under linux:
1.  viParseRsrc (0x0A7318D8, "ASRL5::INSTR", 4, 5)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.914       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

2.  VISA Set Attribute ("ASRL5::INSTR", TMO_VALUE, 10000)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.915       Call Duration 00:00:00.013
Status: 0 (VI_SUCCESS)

3.  VISA Set Attribute ("ASRL5::INSTR", ASRL_BAUD, 921600)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.928       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

4.  VISA Set Attribute ("ASRL5::INSTR", ASRL_DATA_BITS, 😎
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.928       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

5.  VISA Set Attribute ("ASRL5::INSTR", ASRL_STOP_BITS, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.928       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

6.  VISA Set Attribute ("ASRL5::INSTR", ASRL_PARITY, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.928       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

7.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR_EN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.928       Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

8.  VISA Set Attribute ("ASRL5::INSTR", TERMCHAR, 10)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.929       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

9.  VISA Set Attribute ("ASRL5::INSTR", ASRL_FLOW_CNTRL, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.929       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

10.  VISA Set Attribute ("ASRL5::INSTR", ASRL_END_IN, 0)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.929       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

11.  VISA Write ("ASRL5::INSTR", "~E.E.....")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.929       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

12.  VISA Get Attribute ("ASRL5::INSTR", ASRL_AVAIL_NUM, 19)
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:29.986       Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)

> 13.  VISA Read ("ASRL5::INSTR", 19, "~k×.(............")
> Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
> Start Time: 16:17:29.987       Call Duration 00:00:10.002
> Status: 0xBFFF0015 (VI_ERROR_TMO)

14.  VISA Close ("ASRL5::INSTR")
Process ID: 0x000021C2         Thread ID: 0xB56CBBA0
Start Time: 16:17:39.989       Call Duration 00:00:00.009
Status: 0 (VI_SUCCESS)

**********************************************************************************
Under windows I could not get any data this way  I had the required 17 bytes but normally nothing would come up (different to the vi i am using which checks every 10ms on the port to see if bytes are waiting to be processed ...)
but this output I get always from a serial terminal under linux (the requested 17 bytes hence somehow labview adds the two bytes, the driver seems to behave, please note I have 921600 baut used at teh serial terminal):
00000000: 7e 6b 0a 9c f5 08 00 ff   ff 00 00 00 00 00 00 00
00000010: 00

Hope this helps to clarify
Thanks
0 Kudos
Message 10 of 26
(8,181 Views)