LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication with EXFO T500S laser via LabVIEW TCP/IP (SCPI over Ethernet)

Hello,

I am trying to control an EXFO T500S-SCL-M tunable laser using SCPI commands over Ethernet from LabVIEW.

  • The laser automatically assigns itself an IP address (169.254.168.121) and listens on port 5025.

  • According to the datasheet, it should be controllable with standard SCPI commands.

  • The laser in pingable on the console
  • When I connect with PuTTY in Raw mode, communication works perfectly:

    • *IDN? returns the expected identification string

    • I can also successfully send commands to open/close the laser output

In LabVIEW, I built a very basic VI:

  1. TCP Open Connection.vi → IP = 169.254.168.121, Port = 5025

  2. TCP Write.vi → send SCPI command (*IDN?\n or *IDN?\r\n)

  3. TCP Read.vi → set to 256 bytes, 2000 ms timeout

  4. TCP Close Connection.vi

The connection opens correctly and the Write returns the correct number of bytes written, but TCP Read always fails with error 56 (timeout). No response is ever received.

I also tested opening and closing the TCP connection without sending anything, and that works without errors — so the issue seems specifically related to the TCP Read behavior in LabVIEW.

 

Any guidance would be very helpful. Thanks!

Download All
0 Kudos
Message 1 of 5
(227 Views)

Hi Antocea,

 


@ANTOCEA wrote:
  • The laser automatically assigns itself an IP address (169.254.168.121) and listens on port 5025.


In the first step you should configure your laser correctly using a fixed IP address from allowed public address range. Right now you try to use a "link-local" address…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(192 Views)

Does it show up as a VISA resource in NI-MAX?  If so, it's a lot easier to communicate with it.  (Make sure you have TCPIP Passport enabled in NI-MAX.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 5
(167 Views)

What happens if you change the TCP/IP read mode to a different option other than "standard"?  Such as "Immediate" or "CRLF"?

0 Kudos
Message 4 of 5
(153 Views)

Hello everyone,

Thanks a lot for your answers!

I finally managed to solve the issue. The key point was that TCP Read expects the exact number of bytes to be returned.

- If the number of bytes is set too low, the data will be truncated.

- If it is set too high, LabVIEW throws Error 56.

 

This error does not occur when no data is expected (e.g., when opening or closing the laser output).

As for the connection, the laser does not allow me to assign a public IP address, but it works fine with a local one for now. It also does not appear as a VISA resource in NI MAX (which would indeed have been easier).

I also tested changing the TCP read mode (other than Standard), but it made no difference.

 

I’ll share a simple VI that works for me to open and close the laser output, in case it helps others.

 

Best regards,
Anto

0 Kudos
Message 5 of 5
(125 Views)