Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

viWrite viRead timeout on USB connection

I am using SUSE linux 10.0 with NI-VISA 4.2, trying to connect to Tektronix TDS2024B oscilloscope though USB, NI-VISA can identify the scope as an instrument
but cannot do viWrite and viRead.  This is the sequence of operation:
1. open default session VI_SUCCESS
2. find resource VI_SUCCESS 1  USB0::0x0699::0x036A::C010527::INSTR
3. open session USB0::0x0699::0x036A::C010527::INSTR VI_SUCCESS
4. set timeout 5 seconds VI_SUCCESS
5. set clear VI_SUCCESS
6. write buffer *IDN?\n  VI_ERROR_TMO
7. read buffer  VI_ERROR_TMO
8. close session VI_SUCCESS
9. close defaiult session VI_SUCCESS
I can use viOpen and viClear on this device, but viWrite (write "*IDN?\n", tried both 0A and 0D as Carriage Return)  and viRead always fail with timeout error.  I checked the usbfs exists, device in /proc/bus/usb/ appears and disappears as I plug and unplug the USB cable.  udev seems working.   The scope's firmware readme states this device supports USBTMC, Tektronix techsupport states "all Tektronix oscilloscopes supports USB 2.0".  
Is there anything missing? 
Thanks for your advice.
0 Kudos
Message 1 of 4
(6,220 Views)
sduck,

The error you are currently seeing is: VI_ERROR_TMO which means Timeout expired before operation completed.

From looking at the code you posted, it seems that the commands being written to the oscilloscope is incorrect, and therefore causing the timeout. Are you sure that this is the correct command to communicate with the scope? You may want to check into that. I do not have access to a manual for that scope, so I am unable to look into it further. You can also make the timeout longer to see if that changes the behavior you are currently seeing.

Hope this is able to help.


Sarah S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(6,192 Views)
This is the link to the programmer's manual
http://www2.tek.com/cmswpt/madownload.lotr?ct=MA&cs=mpm&ci=8784&lc=EN&wt=480&wtwi=8784&wtla=EN&wtty=MA&wtsty=Programmer&wtpt=DOWNLOAD&wtbu=Instruments+Business&wtpl=Value+Scopes+PL&wtsize=1018+KB&wtcat=tds1000b&wtmd=TDS210%2CTDS220%2CTDS224%2CTDS1002%2CTDS1012%2CTDS2002%2CTDS2012%2CTDS2014%2CTDS2022%2CTDS2024%2CTPS2012%2CTPS2014%2CTPS2024%2CTDS1001%2CTDS2004%2CTDS1001B%2CTDS1002B%2CTDS1012B%2CTDS2002B%2CTDS2004B%2CTDS2012B%2CTDS2014B%2CTDS2022B%2CTDS2024B&wtti=TDS2
The manual says "The USB interface also conforms to USB Test and Measurement Class, Subclass USB488 Specification" (page 2-15).
The same code works if I unplug the TDS2024B scope and plug in an Aglient Power Supply, viWrite and viRead would return with VI_SUCCESS.  viWrite and viRead failed only with this scope.  I tried different timeout period up to 100 sec and repeated write, the outcome is the same.  
Maybe the USB contributed the problem, the USB port on my PC is 2.0 compliant, but the scope can only be recognized as full speed USB.  I tried two PC's, no high speed USB connection could be established.   The uhci_hcd modules were installed properly and other USB devices like a memory stick can be recognized as high speed.
0 Kudos
Message 3 of 4
(6,179 Views)
sduck,

Please reference the following KnowledgeBase: Why is NI-VISA Unable to Control my USB Device?
Sarah S.
Applications Engineering
National Instruments
Message 4 of 4
(6,163 Views)