Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port VISA read error

I'm trying to set up serial port communication between host and target and get VISA read error.

 

Here is what the code does (also see the attached VI)

write - "VISA Write" sends out "connection" command from host contiuously.

read - use state machine to read response from target by byte with "VISA Read" and check if the byte is the expected value. If yes, read the next byte,,,,until the end of byte.

 

There is no problem with write operation, but VISA read always gets the errors

0xBFFF006B (A framing error occurred during transfer) and

0xBFFF0015 (Timeout expired before operation completed)

"Unflatten From String" of the 1st state gets the error "Memory or data structure corrupt"

 

Any suggestions? Thank you.

 

 

 

 

 

 

 

0 Kudos
Message 1 of 8
(3,685 Views)

By the way, I tried the loopback on local computer RS232 and there is no any problem.

0 Kudos
Message 2 of 8
(3,676 Views)

are both systems indeed using the same baudrate?

greetings from the Netherlands
0 Kudos
Message 3 of 8
(3,663 Views)

Yes, the same baudrate. The test on real target works few times but most of the time just gets the error.

0 Kudos
Message 4 of 8
(3,660 Views)

I switched the laptop with virtual serial port to a desktop with real serial port and it seems working fine 99% of the time.

When I used the laptop with virtual serial port, it didn't work 99% of the time. And when it didn't work, an unexpected character was prepended at the output of VISA read.

Any explanation?

 

Thanks,

 

 

 

0 Kudos
Message 5 of 8
(3,654 Views)

Hi MileP,

 

If you increase the wait time on the serial write loop, does that change the failure rate?

 

Thank you!

Chris T.
0 Kudos
Message 6 of 8
(3,591 Views)

Why would you even need to be constantly sending the exact same data at a high rate? Typically, you send the command and wait for the response - all in the same loop.

0 Kudos
Message 7 of 8
(3,585 Views)

Thank you, everyone. The problem is fixed although I'm not so sure why the 1st byte read from port is not the 1st byte write to port. I changed the type of "Unflatten From String" to an array of byte in the first case "Start Byte 1".

 

This VI is to set up the serial communication. Our protocol requires continuous "connect" command until it's get connected. But once the communication is set up, "read" or "write" command will be sent out once only.

 

0 Kudos
Message 8 of 8
(3,563 Views)