Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I Get "VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error" On first read of COMS 3 & 4

I've seen lots of VISA posts similar to my problem. But my VISA System works fine on COM ports 1 & 2. But Not 3 & 4!

I Open all four serial ports, set an I/O buffer of 4K for each port, wait for 100ms Then I flush the ports (Mask 48 for both read & write)
Then I go into a loop which reads the number of bytes available at each port, and reads in those bytes if there are any.
The first time the equipment fires up I instantly get the error message...
 "VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error"
From COMs 3 & 4, but not from COM 1.
If I click Continue to these errors the code works fine, and I see all my messages scroll up the screen (Minus the ones I've missed while Clicking Continue)
If I leave my Code running and power down the equipment and power back up again everything runs smoothly. I only get errors the first time the Code reads something from COM 3 or 4
And if I don't read from ports 3 & 4 then I get no errors at all.

LabVIEW 8.0
VISA 3.4.1
Windows XP

Any ideas on this would be greatfully received.
0 Kudos
Message 1 of 19
(29,406 Views)
Ah, I tell a Lie, powering the equipment down and back up again does indeed generate the error.
Sorry about that.
0 Kudos
Message 2 of 19
(29,402 Views)
Hi Pete
 
Are your serial ports COM 3 & 4 showing in Device Manager? Are they also showing in Measurement & Automation Explorer. You may need to download and install the latest NI Serial driver from the NI Website. The link is below. The drivers from COM 1 & 2 maybe different from 3 & 4. See which drivers you need for the latter. I suggest trying the NI-Serial first.
 
 
Kindest Regards
 
YatinM
National Instruments
Applications Engineer
0 Kudos
Message 3 of 19
(29,383 Views)
Thanks for your eply Yatin,

The serial ports are all displayed correctly in both the windows device manager and in MAX- As I say, when the equipment is up and running the code runs fine, but if it is powered up after the Serial Open has been performed then I get the VISA error.

I've downloaded the NI-Serial drivers from your link and installed them, but the problem still persists.
I should also point out that I have swapped the physical secondary serial card (COMs 1&2 being on the mother board) to one from a different manufacturer without any change.

Also if not using LabVIEW at all and carry out the procedure manually using Hyper Terminal, then there is no problem with 3 & 4.

Do you have any other suggestions, because the powering down and back up again of the equipment I am talking to is an actual part of the process I am trying to Atomate.

Reguards - Pete
0 Kudos
Message 4 of 19
(29,373 Views)

Hi Pete,

If you switch off and on a device connected to a com port there always a risk that the port will receive invalid characters. But I would expect a parity and/or framing error and not a I/O error.

Labview (VISA) detects all errors and reports them. Hyperterminal does not repor errors and displays any data that comes in also if it is invalid.

The best way is to start your com port configuration and flush com port after you switch on your device.

You could also ignore the first error  Smiley Sad  but that is no a (real) solution.

 

 

0 Kudos
Message 5 of 19
(29,362 Views)
Cheers KC, I'm kinda changing the way I'm doing things so that I only scan the ports at set points during the test squence.
Bit of a shame though, it would have been much more flexible if I could have left all the ports scanning continuously and possibly recording any activity, regardless of whether one piece of equipment was on or not.

Thanks for your help though... at least now I know I'm not missing something blindingly obvious! Smiley Happy
0 Kudos
Message 6 of 19
(29,354 Views)

I know that this topic is rather old, but since it was the first result on google search, I thought I will post my solution in here. I had identical problem with "VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error".

 

The solution for this issue in my case was to simply remove "VISA Shared Components" from the main list in "Add or Remove Programs".

 

WinXP

LabVIEW 7.1.1

NI VISA 4.5

Serial port on PC motherboard

0 Kudos
Message 7 of 19
(27,908 Views)

ok. please ignore my previous post. it was just a pure luck that the problem was gone after uninstalling this program.

it occured te be a hardware issue and corrupted communication over rs232 (there was additional 0x00 Null symbol added at the end of data transmission)

0 Kudos
Message 8 of 19
(27,878 Views)
unfortunately, I'm suffer from the same I/O error as Pete described. But my port is COM1 and the error pop-up during the loop, rather than the first read. Any suggestions?
0 Kudos
Message 9 of 19
(27,189 Views)

It seems that this problem is hardware related. In my case it was \00 (null) symbol at the end of data transmission generated by my embedded system. Perhaps in your case the device you're communicating with, adds this kind of "forbidden" symbol at random times.Try logging the data using e.g. http://www.hhdsoftware.com/Products/home/serial-monitor.html (there is a free trial version), and check if the response you receive have anything suspicious in it.

 

What LabVIEW version do you use ?  Can you try running you program on another PC ?

0 Kudos
Message 10 of 19
(27,165 Views)