【发布时间】:2015-11-26 19:55:12
【问题描述】:
我正在尝试使用 National Instruments 的 GPIB-USB-HS 适配器与 Tektronix 示波器 TDS 210 通信。我的系统是 Ubuntu 14.04.3,我在此链接中安装了 linux-gpib:Linux GPIB Driver package (source) 和 python-gpib。我像这样重新配置了/etc/gpib.conf:
interface {
minor = 0 /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
board_type = "ni_usb_b" /* type of interface board being used */
name = "tds" /* optional name, allows you to get a board descriptor using ibfind() */
pad = 0 /* primary address of interface */
sad = 0 /* secondary address of interface */
master = yes /* interface board is system controller */
timeout = TNONE /* timeout for commands */
}
device {
minor = 0
name = "ATTN"
pad = 0
sad = 0
}
lsmod 给我这个:
$ lsmod | grep gpib
ni_usb_gpib 36515 1
gpib_common 38274 3 ni_usb_gpib
dmesg:
$ dmesg | grep gpib
[ 2173.992039] ni_usb_gpib driver loadingni_usb_gpib: probe succeeded for path: usb-0000:00:1a.0-1.2
[ 2173.992098] usbcore: registered new interface driver ni_usb_gpib
[ 2173.992102] gpib: registered ni_usb_b interface
[ 2173.995077] ni_usb_gpib: attach
但是当尝试使用 ibtest 与示波器通信时,我收到此错误:
gpib status is:
ibsta = 0x8100 < ERR CMPL >
iberr= 0
EDVR 0: OS error
ibcnt = 25
使用 Python:
import Gpib
tds = Gpib.Gpib(0,0)
tds.write("*IDN?")
---------------------------------------------------------------------------
GpibError Traceback (most recent call last)
<ipython-input-4-e61e6a76ac49> in <module>()
1 import Gpib
2 inst = Gpib.Gpib(0,0)
----> 3 inst.write("*IDN?")
/usr/local/lib/python2.7/dist-packages/Gpib.pyc in write(self, str)
47
48 def write(self,str):
---> 49 gpib.write(self.id, str)
50
51 def write_async(self,str):
GpibError: write() error: Inappropriate ioctl for device (errno: 25)
是否有人已经遇到过类似的问题或知道如何解决?
【问题讨论】:
-
您是否先尝试与供应商提供的工具进行沟通?在自己编程之前,我发现这非常有用,因为通常需要考虑许多参数,例如每行末尾是否有字符,甚至何时切换某些控制信号。此外,您甚至可能在布线或兼容性方面遇到问题。最后,并非所有设备都支持*IDN? (我有一些古老的设备,我认为他们有 *ID?而不是)。
-
我认为问题出在 GPIB 配置中...我已经为泰克示波器、锁定、单色仪制作了许多 python 脚本,但始终使用 ttyUSB 或 usbtmc,换句话说,RS232 协议,与并且没有适配器插头......这个错误以前从未发生过。供应商总是试图卖给我 Labview =/。可能是电缆...我会检查的。 *国际化域名?是 Tektronix 和 National Instruments 的通用 SCPI。谢谢!
标签: python linux ioctl gpib communication-protocol