09-08-2025 08:13 AM
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.
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:
TCP Open Connection.vi → IP = 169.254.168.121, Port = 5025
TCP Write.vi → send SCPI command (*IDN?\n
or *IDN?\r\n
)
TCP Read.vi → set to 256 bytes, 2000 ms timeout
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!
09-08-2025 08:53 AM
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…
09-08-2025 11:01 AM
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.)
09-08-2025 11:54 AM
What happens if you change the TCP/IP read mode to a different option other than "standard"? Such as "Immediate" or "CRLF"?
09-09-2025 02:02 AM
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