12-17-2024 01:17 AM
Hello Everyone!
I am communicating with a device through COM port. That device response (1 byte to read) to command right away (<0.5s?) for all of the commands except one. That special command will take 3s to execute on the device then generate response back on the COM port. So when I use "VISA read" it error -1073807339 Timeout expired before operation complete.
I added 5s wait after send the command and before reading the response, but still same error.
I tried pause 5s after send the command then read the response, but still same error.
So how to code to get the response of this special command? Thank you!
12-17-2024 06:55 AM
What device are you trying to talk with? Could you share more of your code that shows the full communication scheme you are using?
12-17-2024 09:41 AM
So, are you sure there is an answer after 3 seconds? How did you prove it?
Did you set a terminator? If so, this would cause problems with a 1-byte response.
To debug your problem, this time it is useful to make a loop (with a small wait timeout) with a bytes-at-port node, to control whether there is a response at all.
12-17-2024 03:37 PM
I would have to agree with crossrulz here, more information is needed on your device and its communication protocol.
NI-VISA timeout defaults to 2 seconds (2000mS) have you tried increasing that to 3 or 4 seconds?
12-17-2024 09:58 PM
The device is a communication module with ASIC. I am just using the common VISA vi from NI. The problem is all of the other commands work fine except this one which take 3s to response on the COM.
12-17-2024 10:03 PM
Yes, I had used RealTerm to send the command and watch the response.
No, I did not set a terminator.
Yes, I can use Bytes at Port node to debug, thank you !
12-17-2024 10:07 PM
Yes, I can set the timeout = 4s like below. Thank you !
12-18-2024 12:40 AM
I'd do it like this to preserve the original timeout value:
12-18-2024 07:02 AM
@RTSLVU wrote:NI-VISA timeout defaults to 2 seconds (2000mS) have you tried increasing that to 3 or 4 seconds?
If using the VISA Configure Serial Port, the default is 10 seconds.
12-18-2024 07:03 AM
@BigDrum wrote:
Yes, I had used RealTerm to send the command and watch the response.
No, I did not set a terminator.
My guess is that you are not sending the termination character with this command, so the ASIC does not know the command has been fully transmitted.