I am (mostly) able to communicate with my Tektronix TDS2014B digital
oscilloscope via USB using the PyVISA software with Ubuntu Linux 2.6.15.
I have all the National Instruments software running and I figure that since I
can communicate with the scope at all shows that I must have most things setup
correctly. I only started doing all this within the last week, so I should have all the
latest NI software and drivers.
The problem I am having occurs if I request a read from the device when the
device isn't ready to reply or the device has a timeout.
For example, if I send a:
cro.ask("*cal?")
and the calibration takes longer than the timeout then all subsequent reads will
fail and I will lose control of the scope.
Here is a NIspy listing of an example where I can successfully request the ID
string (1,2), I perform a read (3) which causes a read timeout, and further ID
string (4,5) requests fail.
1. viWrite (0x08273290, "*idn?..", 7, 7)
Process ID: 0x00006766 Thread ID: 0xB7DEE8E0
Start Time: 10:09:27.743 Call Duration 00:00:00.003
Status: 0 (VI_SUCCESS)
2. viRead (0x08273290, "TEKTRONIX,TDS 2014B,C...", 20480, 48)
Process ID: 0x00006766 Thread ID: 0xB7DEE8E0
Start Time: 10:09:27.747 Call Duration 00:00:00.070
Status: 0 (VI_SUCCESS)
3. viRead (0x08273290, 0x08283040, 20480, 0)
Process ID: 0x00006766 Thread ID: 0xB7DEE8E0
Start Time: 10:09:37.340 Call Duration 00:00:05.028
Status: 0xBFFF0015 (VI_ERROR_TMO)
4. viWrite (0x08273290, "*idn?..", 7, 7)
Process ID: 0x00006766 Thread ID: 0xB7DEE8E0
Start Time: 10:09:44.243 Call Duration 00:00:00.001
Status: 0 (VI_SUCCESS)
5. viRead (0x08273290, 0x08283040, 20480, 0)
Process ID: 0x00006766 Thread ID: 0xB7DEE8E0
Start Time: 10:09:44.244 Call Duration 00:00:00.136
Status: 0xBFFF0072 (VI_ERROR_RSRC_BUSY)
I must point out that writes succeed, just the reads fail. For example,
I can reset the CRO and change settings so the USB connection is still
working - but only one way!
If I want to perform reads, I have to unplug the USB, close Python, replug USB,
restart Python and (most times) I will be able to recover the connection.
I have tried doing a flush, a clear, close then re-open. I just get the same
"VI_ERROR_RSRC_BUSY" error on read or I start getting timeouts on
both reads and writes.
Is there a way to recover from this point? Is the problem with PyVISA, NI-VISA, or the instrument?