Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA IC returns error code 0xBFFF003A when reading from USBTMC device

Solved!
Go to solution

Hi,

 

I am creating a USBTMC device and am having some trouble determining why a viRead returns the error code 0xBFFF003A. Strangely enough, it also reports reading the correct number of bytes and the buffer contains the correct data. I am using VISA IC 5.1.2 but I had the same problem with version 5.0.3. I have no trouble with the device being recognized by VISA IC, MAX, LabVIEW SignalExpress or LabVIEW. Using the previous version of VISA IC performing an async read would return a completion code, 0x3FFF009B (VI_SUCCESS_SYNC).

 

The attached file from the NI I/O Trace utility shows all communication from when the USB cable was plugged into the computer.

Lines   1-18  LabVIEW SignalExpress 2011 started

Lines 19-35  VISA IC : Open Selection

Line       36  VISA IC : Clear

Line       37  VISA IC : Read - 10 characters

Line       38  VISA IC : Read - 21 characters

Lines 39-44  LabVIEW : Open, Read 21 characters

Line       45  VISA IC : Read - 18 characters

Line       46  VISA IC : Clear

Line       47  VISA IC : Read - 18 characters

Line       48  VISA IC : Closed

 

Note: LabVIEW crashed on line 44.  At the moment I am not sure if that is related to this problem or not.

 

 

Full error description: Unable to start read operation because setup is invalid (due to attributes being set to an inconsistent state).

 

I am confused by why it indicates it cannot start the operation when in fact it returns the data requested and what attributes is it referring to? I have reviewed the USB descriptor values I am using and they look correct to me.

 

Any ideas?

 

Thanks

0 Kudos
Message 1 of 5
(4,384 Views)

Hi Airaki,

 

I have been looking into this error but have not been able to find any useful information yet to help. However I am hoping that you can provide a clue for me. You mentioned that with previous versions of the VISA driver the application worked. Could you un-install your current version of VISA and install the version that previously worked and make an IO trace and post it. That would give us something to compare to.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,368 Views)

Hi Perry,

 

I will try the test and get back to you.  However, I wasn't very clear regarding the read with the earlier version of VISA.  With the earlier version of VISA the viRead performed the same as it does with the current version, returning the error and the correct data.  The earlier version of VISA IC had a check box to allow an asynchronous read to be performed and it returned success but stating it did it synchronously.

 

I will let you know what I find out.

 

Thanks,

Airaki

0 Kudos
Message 3 of 5
(4,364 Views)

Hi Perry,

 

I removed NI-VISA 5.1.2, or at least parts of it.  Because LabVIEW SignalExpress 2011 had been installed after NI-VISA 5.0.3 I could not remove the Run Time Support or Remote Server plus MAX and a few other components, but I think the system is pretty close to where it originally was.  Configuration and Development Support for NI-VISA 5.0.3 were added.

 

The attached file shows the results of an asynchronous read followed by the same read synchronously.  The async reads on lines 8 and 10 indicate a successful read, but performed synchronously.  What you cannot see from the log file is the VISA IC program reported error 0xBFFF003A  for all 4 reads!  So the VISA IC program and NI I/O Trace program report different results for the async reads.

 

Let me know if you can make some sense of this.

 

Thanks,

Airaki

0 Kudos
Message 4 of 5
(4,358 Views)
Solution
Accepted by topic author Airaki

Hi Perry,

 

I have found the problem.  The TransferSize was not getting converted from big endian to little endian and 0x0A was seen as 0xA000000.

 

Cheers,

Airaki

0 Kudos
Message 5 of 5
(4,353 Views)